From 0bada910e1c192bc6c8fae52dbe09075fae25155 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 17:37:14 -0400 Subject: [PATCH 1/8] test: linux: Unskip `statx` and `statx_timestamp` tests The mentioned issues with `#include` no longer seem to happen, so start testing these again. --- libc-test/build.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index e502c2a4780b..8c19d1e4ce9b 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3989,12 +3989,6 @@ fn test_linux(target: &str) { // glibcs (see https://github.com/rust-lang/libc/issues/1410) "ucontext_t" if gnu => true, - // FIXME(linux): Somehow we cannot include headers correctly in glibc 2.30. - // So let's ignore for now and re-visit later. - // Probably related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91085 - "statx" => true, - "statx_timestamp" => true, - // On Linux, the type of `ut_exit` field of struct `utmpx` // can be an anonymous struct, so an extra struct, // which is absent in musl, has to be defined. From a79056f426417acfb7c40fd65eb3fa61331728ff Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 17:41:15 -0400 Subject: [PATCH 2/8] test: linux: Unskip `ip_mreqn` and `hwtstamp_config` The reason these failed in the first place was unclear, but they now pass. Closes: https://github.com/rust-lang/libc/issues/1558 --- libc-test/build.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 8c19d1e4ce9b..eaac04c4ca32 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3942,11 +3942,6 @@ fn test_linux(target: &str) { return true; } - // FIXME(#1558): passing by value corrupts the value for reasons not understood. - if (gnu && sparc64) && (ty == "ip_mreqn" || ty == "hwtstamp_config") { - return true; - } - // FIXME(rust-lang/rust#43894): pass by value for structs that are not an even 32/64 bits // on big-endian systems corrupts the value for unknown reasons. if (sparc64 || ppc || ppc64 || s390x) From 078f574fa724aa01ace09a6dd1543f8a976f237a Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 17:52:27 -0400 Subject: [PATCH 3/8] linux: Update the definition for `ucontext_t` and unskip its tests The distributed versions of glibc now have the `__ssp` field, so we can add it here and start testing the type again. A field rename is needed since loongarch calls `__uc_flags` by a different name. --- libc-test/build.rs | 11 ++++------- src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs | 6 +----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index eaac04c4ca32..77ef29164974 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3849,7 +3849,7 @@ fn test_linux(target: &str) { } }); - cfg.rename_struct_field(|struct_, field| { + cfg.rename_struct_field(move |struct_, field| { let struct_ = struct_.ident(); match field.ident() { // Our stat *_nsec fields normally don't actually exist but are part @@ -3872,6 +3872,9 @@ fn test_linux(target: &str) { Some("type".to_string()) } + // FIXME(1.0): field has a different name on loongarch + "uc_flags" if loongarch64 && struct_ == "ucontext_t" => Some("__uc_flags".to_string()), + _ => None, } }); @@ -3978,12 +3981,6 @@ fn test_linux(target: &str) { // structs. "termios2" => true, - // FIXME(linux): remove once we set minimum supported glibc version. - // ucontext_t added a new field as of glibc 2.28; our struct definition is - // conservative and omits the field, but that means the size doesn't match for newer - // glibcs (see https://github.com/rust-lang/libc/issues/1410) - "ucontext_t" if gnu => true, - // On Linux, the type of `ut_exit` field of struct `utmpx` // can be an anonymous struct, so an extra struct, // which is absent in musl, has to be defined. diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index f4555ee42023..cf871f2a7d84 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -310,11 +310,7 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, pub uc_sigmask: crate::sigset_t, __private: [u8; 512], - // FIXME(glibc): the shadow stack field requires glibc >= 2.28. - // Re-add once we drop compatibility with glibc versions older than - // 2.28. - // - // __ssp: [c_ulonglong; 4], + __ssp: [c_ulonglong; 4], } #[repr(align(16))] From e03a055530bbf7d0b5ba00743ff7610a08d4bce2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 17:56:37 -0400 Subject: [PATCH 4/8] test: linux: Unskip `clone_args` and `open_how` The concerns about changing across versions was resolved a long time ago. However, there is still a mismatch on PowerPC64, so a specific skip is added for now. --- libc-test/build.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 77ef29164974..156aaca26ff2 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3986,11 +3986,9 @@ fn test_linux(target: &str) { // which is absent in musl, has to be defined. "__exit_status" if musl => true, - // clone_args might differ b/w libc versions - "clone_args" => true, - - // Might differ between kernel versions - "open_how" => true, + // FIXME(ppc): tests fail due to a field type mismatch (`long long unsigned` vs + // `long unsigned`). + "clone_args" if ppc64 => true, // Linux >= 6.13 (pidfd_info.exit_code: Linux >= 6.15) // Might differ between kernel versions From 03919a2e099737db4940586c04a7de2e0447d2bb Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 18:33:59 -0400 Subject: [PATCH 5/8] linux: Remove incorrect `repr(align(8))` for `canxl_frame` `can_frame` and `canfd_frame` need this, but `canxl_frame` does not. This was causing the struct to be incorrectly aligned. --- src/new/linux_uapi/linux/can.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/new/linux_uapi/linux/can.rs b/src/new/linux_uapi/linux/can.rs index 20d1e6acfdfd..887ab869ca70 100644 --- a/src/new/linux_uapi/linux/can.rs +++ b/src/new/linux_uapi/linux/can.rs @@ -72,7 +72,6 @@ pub const CANXL_XLF: c_int = 0x80; pub const CANXL_SEC: c_int = 0x01; s! { - #[repr(align(8))] pub struct canxl_frame { pub prio: canid_t, pub flags: u8, From b10c0dd5c6aee727cafb72bd4b04fc88abec6e53 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 18:09:13 -0400 Subject: [PATCH 6/8] test: linux: Unskip some types that now pass Unskip a number of types and constants that were added in more recent kernel versions but are now available in our CI setup. --- libc-test/build.rs | 69 ++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 156aaca26ff2..7f0e1c11602d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3997,13 +3997,6 @@ fn test_linux(target: &str) { "sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo" | "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true, - // FIXME(linux): requires >= 6.1 kernel headers - "canxl_frame" => true, - - // FIXME(linux): The size of `iv` has been changed since Linux v6.0 - // https://github.com/torvalds/linux/commit/94dfc73e7cf4a31da66b8843f0b9283ddd6b8381 - "af_alg_iv" => true, - // FIXME(linux): Requires >= 5.1 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "tls12_crypto_info_aes_gcm_256" @@ -4356,43 +4349,21 @@ fn test_linux(target: &str) { // is a private value for kernel usage normally "FUSE_SUPER_MAGIC" => true, - // linux 5.17 min - "PR_SET_VMA" | "PR_SET_VMA_ANON_NAME" => true, - - // present in recent kernels only - "PR_SCHED_CORE" | "PR_SCHED_CORE_CREATE" | "PR_SCHED_CORE_GET" | "PR_SCHED_CORE_MAX" | "PR_SCHED_CORE_SCOPE_PROCESS_GROUP" | "PR_SCHED_CORE_SCOPE_THREAD" | "PR_SCHED_CORE_SCOPE_THREAD_GROUP" | "PR_SCHED_CORE_SHARE_FROM" | "PR_SCHED_CORE_SHARE_TO" => true, - - // present in recent kernels only >= 5.13 - "PR_PAC_SET_ENABLED_KEYS" | "PR_PAC_GET_ENABLED_KEYS" => true, - // present in recent kernels only >= 5.19 - "PR_SME_SET_VL" | "PR_SME_GET_VL" | "PR_SME_VL_LEN_MAX" | "PR_SME_SET_VL_INHERIT" | "PR_SME_SET_VL_ONE_EXEC" => true, - - // Added in Linux 5.14 - "FUTEX_LOCK_PI2" => true, - - // Added in linux 6.1 - "STATX_DIOALIGN" - | "CAN_RAW_XL_FRAMES" - | "CANXL_HDR_SIZE" - | "CANXL_MAX_DLC" - | "CANXL_MAX_DLC_MASK" - | "CANXL_MAX_DLEN" - | "CANXL_MAX_MTU" - | "CANXL_MIN_DLC" - | "CANXL_MIN_DLEN" - | "CANXL_MIN_MTU" - | "CANXL_MTU" - | "CANXL_PRIO_BITS" - | "CANXL_PRIO_MASK" - | "CANXL_SEC" - | "CANXL_XLF" - => true, - - // FIXME(linux): Parts of netfilter/nfnetlink*.h require more recent kernel headers: - | "RTNLGRP_MCTP_IFADDR" // linux v5.17+ - | "RTNLGRP_TUNNEL" // linux v5.18+ - | "RTNLGRP_STATS" // linux v5.18+ - => true, + // Not present on old musl + "PR_SET_VMA" + | "PR_SET_VMA_ANON_NAME" + | "PR_SCHED_CORE" + | "PR_SCHED_CORE_CREATE" + | "PR_SCHED_CORE_GET" + | "PR_SCHED_CORE_MAX" + | "PR_SCHED_CORE_SCOPE_PROCESS_GROUP" + | "PR_SCHED_CORE_SCOPE_THREAD" + | "PR_SCHED_CORE_SCOPE_THREAD_GROUP" + | "PR_SCHED_CORE_SHARE_FROM" + | "PR_SCHED_CORE_SHARE_TO" if old_musl => true, + + // Not present in glibc + "PR_SME_VL_LEN_MAX" | "PR_SME_SET_VL_INHERIT" | "PR_SME_SET_VL_ONE_EXEC" if gnu => true, // FIXME(linux): The below is no longer const in glibc 2.34: // https://github.com/bminor/glibc/commit/5d98a7dae955bafa6740c26eaba9c86060ae0344 @@ -4401,15 +4372,9 @@ fn test_linux(target: &str) { | "MINSIGSTKSZ" if gnu => true, - // FIXME(linux): Linux >= 5.16: - // https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96 - "NF_NETDEV_EGRESS" if sparc64 => true, // value changed "NF_NETDEV_NUMHOOKS" if sparc64 => true, - // FIXME(linux): requires Linux >= v5.8 - "IF_LINK_MODE_TESTING" if sparc64 => true, - // FIXME(linux): Requires >= 6.3 kernel headers "MFD_EXEC" | "MFD_NOEXEC_SEAL" if sparc64 => true, @@ -4809,7 +4774,9 @@ fn test_linux(target: &str) { // After musl 1.2.0, the type becomes `int` instead of `long`. (old_musl && struct_ == "utmpx" && field == "ut_session") || // `frames` is a flexible array member - (struct_ == "bcm_msg_head" && field == "frames") + (struct_ == "bcm_msg_head" && field == "frames") || + // FAM + (struct_ == "af_alg_iv" && field == "iv") }); cfg.skip_roundtrip(move |s| match s { From 4c63568221b1b0cdcee03fc3bacf371179de4c91 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 18:09:53 -0400 Subject: [PATCH 7/8] test: linux: musl: Unskip types that needed newer kernel headers Our musl tests now use more recent headers, so we can start testing a number of types again. --- libc-test/build.rs | 70 ---------------------------------------------- 1 file changed, 70 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 7f0e1c11602d..556d595ffbd7 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3997,30 +3997,6 @@ fn test_linux(target: &str) { "sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo" | "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true, - // FIXME(linux): Requires >= 5.1 kernel headers. - // Everything that uses install-musl.sh has 4.19 kernel headers. - "tls12_crypto_info_aes_gcm_256" - if (aarch64 || arm || i686 || s390x || x86_64) && musl => - { - true - } - - // FIXME(linux): Requires >= 5.11 kernel headers. - // Everything that uses install-musl.sh has 4.19 kernel headers. - "tls12_crypto_info_chacha20_poly1305" - if (aarch64 || arm || i686 || s390x || x86_64) && musl => - { - true - } - - // FIXME(linux): Requires >= 5.3 kernel headers. - // Everything that uses install-musl.sh has 4.19 kernel headers. - "xdp_options" if musl => true, - - // FIXME(linux): Requires >= 5.4 kernel headers. - // Everything that uses install-musl.sh has 4.19 kernel headers. - "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true, - // FIXME(linux): Requires >= 6.8 kernel headers. // A field was added in 6.8. // https://github.com/torvalds/linux/commit/341ac980eab90ac1f6c22ee9f9da83ed9604d899 @@ -4028,10 +4004,6 @@ fn test_linux(target: &str) { // https://github.com/torvalds/linux/commit/32654bbd6313b4cfc82297e6634fa9725c3c900f "xdp_umem_reg" => true, - // FIXME(linux): Requires >= 5.9 kernel headers. - // Everything that uses install-musl.sh has 4.19 kernel headers. - "xdp_statistics" if musl => true, - // FIXME(linux): Requires >= 6.8 kernel headers. "xsk_tx_metadata" | "__c_anonymous_xsk_tx_metadata_union" @@ -4115,48 +4087,6 @@ fn test_linux(target: &str) { } } if musl { - // FIXME(linux): Requires >= 5.0 kernel headers - if name == "SECCOMP_GET_NOTIF_SIZES" - || name == "SECCOMP_FILTER_FLAG_NEW_LISTENER" - || name == "SECCOMP_FILTER_FLAG_TSYNC_ESRCH" - || name == "SECCOMP_USER_NOTIF_FLAG_CONTINUE" // requires >= 5.5 - || name == "SECCOMP_ADDFD_FLAG_SETFD" // requires >= 5.9 - || name == "SECCOMP_ADDFD_FLAG_SEND" // requires >= 5.9 - || name == "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" // requires >= 5.19 - { - return true; - } - // FIXME(linux): Requires >= 4.20 kernel headers - if name == "PTP_SYS_OFFSET_EXTENDED" { - return true; - } - // FIXME(linux): Requires >= 5.4 kernel headers - if name == "PTP_CLOCK_GETCAPS2" - || name == "PTP_ENABLE_PPS2" - || name == "PTP_EXTTS_REQUEST2" - || name == "PTP_PEROUT_REQUEST2" - || name == "PTP_PIN_GETFUNC2" - || name == "PTP_PIN_SETFUNC2" - || name == "PTP_SYS_OFFSET2" - || name == "PTP_SYS_OFFSET_PRECISE2" - || name == "PTP_SYS_OFFSET_EXTENDED2" - { - return true; - } - // FIXME(linux): Requires >= 5.4.1 kernel headers - if name.starts_with("J1939") - || name.starts_with("RTEXT_FILTER_") - || name.starts_with("SO_J1939") - || name.starts_with("SCM_J1939") - { - return true; - } - // FIXME(linux): Requires >= 5.10 kernel headers - if name.starts_with("MEMBARRIER_CMD_REGISTER") - || name.starts_with("MEMBARRIER_CMD_PRIVATE") - { - return true; - } // LFS64 types have been removed in musl 1.2.4+ if name.starts_with("RLIM64") { return true; From 27f9f7d853095a6c5bdf42dc172df47b1b5e8a43 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 22 Oct 2025 18:45:20 -0400 Subject: [PATCH 8/8] ci: Log the output of uname -a Indicate which kernel version we are working with. --- ci/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/run.sh b/ci/run.sh index 5ccd6d74160b..88956b6a3d9a 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -9,6 +9,9 @@ target="$1" export RUST_BACKTRACE="${RUST_BACKTRACE:-1}" +# For logging +uname -a + cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}" test_flags="--skip check_style"