Skip to content

Commit 0a8f04a

Browse files
authored
Merge pull request #3921 from tammela/musl-headers
ci: update musl headers to 6.6
2 parents 63cf6a1 + 55f9451 commit 0a8f04a

File tree

7 files changed

+78
-166
lines changed

7 files changed

+78
-166
lines changed

ci/docker/aarch64-unknown-linux-musl/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ubuntu:24.10
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
5-
gcc-aarch64-linux-gnu qemu-user
5+
gcc-aarch64-linux-gnu qemu-user xz-utils patch rsync
66

77
COPY install-musl.sh /
88
RUN /install-musl.sh aarch64

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
55
/etc/apt/sources.list && \
66
apt-get update && apt-get install -y --no-install-recommends \
77
gcc make libc6-dev git curl ca-certificates \
8-
gcc-arm-linux-gnueabihf qemu-user
8+
gcc-arm-linux-gnueabihf qemu-user xz-utils patch rsync
99

1010
COPY install-musl.sh /
1111
RUN /install-musl.sh arm

ci/docker/i686-unknown-linux-musl/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM ubuntu:23.10
22

3-
43
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
54
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
65
/etc/apt/sources.list && \
76
dpkg --add-architecture i386 && \
87
apt-get update && apt-get install -y --no-install-recommends \
9-
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386
8+
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386 \
9+
xz-utils patch rsync
1010

1111
COPY install-musl.sh /
1212
RUN /install-musl.sh i686

ci/docker/s390x-unknown-linux-musl/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
44
curl ca-certificates \
55
gcc \
66
gcc-s390x-linux-gnu \
7-
qemu-user
7+
qemu-user \
8+
xz-utils patch rsync
89

910
COPY install-musl.sh /
1011
RUN /install-musl.sh s390x

ci/docker/x86_64-unknown-linux-musl/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu:24.10
22

33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
5-
gcc make libc6-dev git curl ca-certificates
5+
gcc make libc6-dev git curl ca-certificates \
6+
xz-utils patch rsync
67

78
COPY install-musl.sh /
89
RUN /install-musl.sh x86_64

ci/install-musl.sh

+58-8
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,63 @@ esac
6464
cd ..
6565
rm -rf "$musl"
6666

67-
# Download, configure, build, and install musl-sanitized kernel headers:
68-
kernel_header_ver="4.19.88"
69-
curl --retry 5 -L \
70-
"https://github.com/sabotage-linux/kernel-headers/archive/v${kernel_header_ver}.tar.gz" |
71-
tar xzf -
67+
# Download, configure, build, and install musl-sanitized kernel headers.
68+
69+
# Alpine follows stable kernel releases, 3.20 uses Linux 6.6 headers.
70+
alpine_version=3.20
71+
alpine_git=https://gitlab.alpinelinux.org/alpine/aports
72+
73+
# This routine piggybacks on: https://git.alpinelinux.org/aports/tree/main/linux-headers?h=3.20-stable
74+
git clone -n --depth=1 --filter=tree:0 -b "${alpine_version}-stable" "$alpine_git"
7275
(
73-
cd "kernel-headers-${kernel_header_ver}"
74-
make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
76+
cd aports
77+
git sparse-checkout set --no-cone main/linux-headers
78+
git checkout
79+
80+
cd main/linux-headers
81+
cp APKBUILD APKBUILD.vars
82+
cat <<- EOF >> APKBUILD.vars
83+
echo "\$source" > alpine-source
84+
echo "\$_kernver" > alpine-kernver
85+
echo "\$pkgver" > alpine-pkgver
86+
echo "\$sha512sums" > alpine-sha512sums
87+
EOF
88+
89+
# Retrieve all the variables
90+
sh APKBUILD.vars
91+
92+
cat APKBUILD.vars
93+
94+
kernel_version=$(tr -d "[:space:]" < alpine-kernver)
95+
pkg_version=$(tr -d "[:space:]" < alpine-pkgver)
96+
97+
urls=$(grep -o 'https.*' alpine-source)
98+
kernel=""
99+
patch=""
100+
for url in $urls; do
101+
base=$(basename "$url")
102+
curl --retry 5 -L "$url" > "$base"
103+
case $base in
104+
linux-*) kernel=$base;;
105+
patch-*) patch=$base;;
106+
esac
107+
# Check if file is known
108+
grep -o "$base" alpine-sha512sums
109+
done
110+
111+
# Double check checksums
112+
sha512sum -c alpine-sha512sums
113+
114+
# Extract, apply patches, compile and install headers
115+
tar -xf "$kernel"
116+
cd "linux-$kernel_version"
117+
if [ "$pkg_version" != "$kernel_version" ]; then
118+
unxz -c < "../$patch" | patch -p1
119+
fi
120+
for p in ../*.patch; do
121+
patch -p1 < "$p"
122+
done
123+
make headers_install ARCH="${kernel_arch}" INSTALL_HDR_PATH="/musl-${musl_arch}"
75124
)
76-
rm -rf kernel-headers-${kernel_header_ver}
125+
126+
rm -rf aports

libc-test/build.rs

+12-152
Original file line numberDiff line numberDiff line change
@@ -3505,8 +3505,7 @@ fn test_linux(target: &str) {
35053505
[gnu]: "linux/aio_abi.h",
35063506
"linux/can.h",
35073507
"linux/can/raw.h",
3508-
// FIXME: requires kernel headers >= 5.4.1.
3509-
[!musl]: "linux/can/j1939.h",
3508+
"linux/can/j1939.h",
35103509
"linux/dccp.h",
35113510
"linux/errqueue.h",
35123511
"linux/falloc.h",
@@ -3531,8 +3530,7 @@ fn test_linux(target: &str) {
35313530
"linux/mempolicy.h",
35323531
"linux/mman.h",
35333532
"linux/module.h",
3534-
// FIXME: requires kernel headers >= 5.1.
3535-
[!musl]: "linux/mount.h",
3533+
"linux/mount.h",
35363534
"linux/net_tstamp.h",
35373535
"linux/netfilter/nfnetlink.h",
35383536
"linux/netfilter/nfnetlink_log.h",
@@ -3544,11 +3542,10 @@ fn test_linux(target: &str) {
35443542
"linux/netfilter_ipv6.h",
35453543
"linux/netfilter_ipv6/ip6_tables.h",
35463544
"linux/netlink.h",
3547-
// FIXME: requires Linux >= 5.6:
3548-
[!musl]: "linux/openat2.h",
3545+
"linux/openat2.h",
35493546
// FIXME: some items require Linux >= 5.6:
35503547
"linux/ptp_clock.h",
3551-
[!musl]: "linux/ptrace.h",
3548+
"linux/ptrace.h",
35523549
"linux/quota.h",
35533550
"linux/random.h",
35543551
"linux/reboot.h",
@@ -3566,7 +3563,7 @@ fn test_linux(target: &str) {
35663563
"sys/fanotify.h",
35673564
// <sys/auxv.h> is not present on uclibc
35683565
[!uclibc]: "sys/auxv.h",
3569-
[gnu]: "linux/close_range.h",
3566+
[gnu || musl]: "linux/close_range.h",
35703567
}
35713568

35723569
// note: aio.h must be included before sys/mount.h
@@ -3657,11 +3654,6 @@ fn test_linux(target: &str) {
36573654
// specific type.
36583655
"Ioctl" => true,
36593656

3660-
// FIXME: requires >= 5.4.1 kernel headers
3661-
"pgn_t" if musl => true,
3662-
"priority_t" if musl => true,
3663-
"name_t" if musl => true,
3664-
36653657
// FIXME: "'__uint128' undeclared" in C
36663658
"__uint128" => true,
36673659

@@ -3680,22 +3672,6 @@ fn test_linux(target: &str) {
36803672
if ty.starts_with("__c_anonymous_") {
36813673
return true;
36823674
}
3683-
// FIXME: musl CI has old headers
3684-
if musl && ty.starts_with("uinput_") {
3685-
return true;
3686-
}
3687-
if musl && ty == "seccomp_notif" {
3688-
return true;
3689-
}
3690-
if musl && ty == "seccomp_notif_addfd" {
3691-
return true;
3692-
}
3693-
if musl && ty == "seccomp_notif_resp" {
3694-
return true;
3695-
}
3696-
if musl && ty == "seccomp_notif_sizes" {
3697-
return true;
3698-
}
36993675

37003676
// FIXME: CI has old headers
37013677
if ty == "ptp_sys_offset_extended" {
@@ -3779,12 +3755,6 @@ fn test_linux(target: &str) {
37793755
// Might differ between kernel versions
37803756
"open_how" => true,
37813757

3782-
// FIXME: requires >= 5.4.1 kernel headers
3783-
"j1939_filter" if musl => true,
3784-
3785-
// FIXME: requires >= 5.4 kernel headers
3786-
"sockaddr_can" if musl => true,
3787-
37883758
"sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo"
37893759
| "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true,
37903760

@@ -3949,7 +3919,7 @@ fn test_linux(target: &str) {
39493919
return true;
39503920
}
39513921
// FIXME: Requires >= 6.3 kernel headers
3952-
if name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC" {
3922+
if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") {
39533923
return true;
39543924
}
39553925
}
@@ -4036,7 +4006,7 @@ fn test_linux(target: &str) {
40364006
"SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" if sparc64 => true,
40374007

40384008
// FIXME: Not currently available in headers on ARM and musl.
4039-
"NETLINK_GET_STRICT_CHK" if arm || musl => true,
4009+
"NETLINK_GET_STRICT_CHK" if arm => true,
40404010

40414011
// kernel constants not available in uclibc 1.0.34
40424012
| "EXTPROC"
@@ -4105,62 +4075,14 @@ fn test_linux(target: &str) {
41054075
| "MINSIGSTKSZ"
41064076
if gnu => true,
41074077

4108-
// FIXME: Linux >= 5.10:
4109-
// https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493
4110-
"NF_INET_INGRESS" if musl => true,
4111-
41124078
// FIXME: Linux >= 5.16:
41134079
// https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96
4114-
"NF_NETDEV_EGRESS" if musl || sparc64 => true,
4080+
"NF_NETDEV_EGRESS" if sparc64 => true,
41154081
// value changed
4116-
"NF_NETDEV_NUMHOOKS" if musl || sparc64 => true,
4117-
4118-
// FIXME: requires Linux >= 5.6:
4119-
| "RESOLVE_BENEATH"
4120-
| "RESOLVE_CACHED"
4121-
| "RESOLVE_IN_ROOT"
4122-
| "RESOLVE_NO_MAGICLINKS"
4123-
| "RESOLVE_NO_SYMLINKS"
4124-
| "RESOLVE_NO_XDEV" if musl => true,
4125-
4126-
// FIXME: requires Linux >= 5.4:
4127-
| "CAN_J1939"
4128-
| "CAN_NPROTO" if musl => true,
4129-
4130-
// FIXME: requires Linux >= 5.6
4131-
"GRND_INSECURE" if musl => true,
4132-
4133-
// FIXME: requires Linux >= 5.7:
4134-
"MREMAP_DONTUNMAP" if musl => true,
4082+
"NF_NETDEV_NUMHOOKS" if sparc64 => true,
41354083

41364084
// FIXME: requires Linux >= v5.8
4137-
"IF_LINK_MODE_TESTING" if musl || sparc64 => true,
4138-
4139-
// FIXME: Requires more recent kernel headers (5.9 / 5.11):
4140-
| "CLOSE_RANGE_UNSHARE"
4141-
| "CLOSE_RANGE_CLOEXEC" if musl => true,
4142-
4143-
// FIXME: requires Linux >= 5.12:
4144-
"MPOL_F_NUMA_BALANCING" if musl => true,
4145-
4146-
// FIXME: Requires more recent kernel headers
4147-
| "NFNL_SUBSYS_COUNT" // bumped in v5.14
4148-
| "NFNL_SUBSYS_HOOK" // v5.14+
4149-
| "NFULA_VLAN" // v5.4+
4150-
| "NFULA_L2HDR" // v5.4+
4151-
| "NFULA_VLAN_PROTO" // v5.4+
4152-
| "NFULA_VLAN_TCI" // v5.4+
4153-
| "NFULA_VLAN_UNSPEC" // v5.4+
4154-
| "RTNLGRP_NEXTHOP" // linux v5.3+
4155-
| "RTNLGRP_BRVLAN" // linux v5.6+
4156-
if musl => true,
4157-
4158-
| "MADV_COLD"
4159-
| "MADV_PAGEOUT"
4160-
| "MADV_POPULATE_READ"
4161-
| "MADV_POPULATE_WRITE"
4162-
if musl => true,
4163-
"CLONE_CLEAR_SIGHAND" | "CLONE_INTO_CGROUP" => true,
4085+
"IF_LINK_MODE_TESTING" if sparc64 => true,
41644086

41654087
// FIXME: Requires >= 6.3 kernel headers
41664088
"MFD_EXEC" | "MFD_NOEXEC_SEAL" if sparc64 => true,
@@ -4182,9 +4104,6 @@ fn test_linux(target: &str) {
41824104
=> true,
41834105
"SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+
41844106

4185-
// FIXME: Requires more recent kernel headers
4186-
"HWTSTAMP_TX_ONESTEP_P2P" if musl => true, // linux v5.6+
4187-
41884107
// kernel 6.5 minimum
41894108
"MOVE_MOUNT_BENEATH" => true,
41904109
// FIXME: Requires linux 6.1
@@ -4206,10 +4125,8 @@ fn test_linux(target: &str) {
42064125
| "FAN_INFO" // linux v5.16+
42074126
=> true,
42084127

4209-
// FIXME: Requires linux 5.15+
4210-
"FAN_REPORT_PIDFD" if musl => true,
4211-
4212-
// FIXME: Requires linux 5.9+
4128+
// musl doesn't use <linux/fanotify.h> in <sys/fanotify.h>
4129+
"FAN_REPORT_PIDFD"
42134130
| "FAN_REPORT_DIR_FID"
42144131
| "FAN_REPORT_NAME"
42154132
| "FAN_REPORT_DFID_NAME"
@@ -4223,55 +4140,6 @@ fn test_linux(target: &str) {
42234140
// FIXME: Requires linux 6.5
42244141
"NFT_MSG_MAX" => true,
42254142

4226-
// FIXME: Requires >= 5.1 kernel headers.
4227-
// Everything that uses install-musl.sh has 4.19 kernel headers.
4228-
"TLS_1_3_VERSION"
4229-
| "TLS_1_3_VERSION_MAJOR"
4230-
| "TLS_1_3_VERSION_MINOR"
4231-
| "TLS_CIPHER_AES_GCM_256"
4232-
| "TLS_CIPHER_AES_GCM_256_IV_SIZE"
4233-
| "TLS_CIPHER_AES_GCM_256_KEY_SIZE"
4234-
| "TLS_CIPHER_AES_GCM_256_SALT_SIZE"
4235-
| "TLS_CIPHER_AES_GCM_256_TAG_SIZE"
4236-
| "TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE"
4237-
if (aarch64 || arm || i686 || s390x || x86_64) && musl =>
4238-
{
4239-
true
4240-
}
4241-
4242-
// FIXME: Requires >= 5.11 kernel headers.
4243-
// Everything that uses install-musl.sh has 4.19 kernel headers.
4244-
"TLS_CIPHER_CHACHA20_POLY1305"
4245-
| "TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE"
4246-
| "TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE"
4247-
| "TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE"
4248-
| "TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE"
4249-
| "TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE"
4250-
if (aarch64 || arm || i686 || s390x || x86_64) && musl =>
4251-
{
4252-
true
4253-
}
4254-
4255-
// FIXME: Requires >= 5.3 kernel headers.
4256-
// Everything that uses install-musl.sh has 4.19 kernel headers.
4257-
"XDP_OPTIONS_ZEROCOPY" | "XDP_OPTIONS"
4258-
if musl =>
4259-
{
4260-
true
4261-
}
4262-
4263-
// FIXME: Requires >= 5.4 kernel headers.
4264-
// Everything that uses install-musl.sh has 4.19 kernel headers.
4265-
"XSK_UNALIGNED_BUF_OFFSET_SHIFT"
4266-
| "XSK_UNALIGNED_BUF_ADDR_MASK"
4267-
| "XDP_UMEM_UNALIGNED_CHUNK_FLAG"
4268-
| "XDP_RING_NEED_WAKEUP"
4269-
| "XDP_USE_NEED_WAKEUP"
4270-
if musl =>
4271-
{
4272-
true
4273-
}
4274-
42754143
// FIXME: Requires >= 6.6 kernel headers.
42764144
"XDP_USE_SG"
42774145
| "XDP_PKT_CONTD"
@@ -4330,14 +4198,6 @@ fn test_linux(target: &str) {
43304198
| "PF_MCE_EARLY"
43314199
| "PF_MEMALLOC_PIN" => true,
43324200

4333-
"SCHED_FLAG_KEEP_POLICY"
4334-
| "SCHED_FLAG_KEEP_PARAMS"
4335-
| "SCHED_FLAG_UTIL_CLAMP_MIN"
4336-
| "SCHED_FLAG_UTIL_CLAMP_MAX"
4337-
| "SCHED_FLAG_KEEP_ALL"
4338-
| "SCHED_FLAG_UTIL_CLAMP"
4339-
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.
4340-
43414201
// FIXME: Requires >= 6.9 kernel headers.
43424202
"EPIOCSPARAMS"
43434203
| "EPIOCGPARAMS" => true,

0 commit comments

Comments
 (0)