Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
169 changes: 25 additions & 144 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
}
});
Expand Down Expand Up @@ -3942,11 +3945,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)
Expand Down Expand Up @@ -3983,28 +3981,14 @@ 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,

// 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.
"__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
Expand All @@ -4013,48 +3997,13 @@ 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"
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
// The previous version of the struct was removed in 6.11 due to a bug.
// 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"
Expand Down Expand Up @@ -4138,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;
Expand Down Expand Up @@ -4372,43 +4279,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
Expand All @@ -4417,15 +4302,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,

Expand Down Expand Up @@ -4825,7 +4704,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 {
Expand Down
1 change: 0 additions & 1 deletion src/new/linux_uapi/linux/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down