Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4139

Merged
merged 5 commits into from
Nov 25, 2024
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
69 changes: 66 additions & 3 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3617,6 +3617,8 @@ fn test_linux(target: &str) {
"linux/netlink.h",
// FIXME: requires Linux >= 5.6:
[!musl]: "linux/openat2.h",
// FIXME: some items require Linux >= 5.6:
"linux/ptp_clock.h",
[!musl]: "linux/ptrace.h",
"linux/quota.h",
"linux/random.h",
Expand Down Expand Up @@ -3766,6 +3768,11 @@ fn test_linux(target: &str) {
return true;
}

// FIXME: CI has old headers
if ty == "ptp_sys_offset_extended" {
return true;
}

// LFS64 types have been removed in musl 1.2.4+
if musl && (ty.ends_with("64") || ty.ends_with("64_t")) {
return true;
Expand Down Expand Up @@ -3881,12 +3888,25 @@ fn test_linux(target: &str) {

// FIXME: Requires >= 5.4 kernel headers.
// Everything that uses install-musl.sh has 4.19 kernel headers.
"xdp_umem_reg" | "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true,
"xdp_ring_offset" | "xdp_mmap_offsets" if musl => true,

// FIXME: 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: Requires >= 5.9 kernel headers.
// Everything that uses install-musl.sh has 4.19 kernel headers.
"xdp_statistics" if musl => true,

// FIXME: Requires >= 6.8 kernel headers.
"xsk_tx_metadata"
| "__c_anonymous_xsk_tx_metadata_union"
| "xsk_tx_metadata_request"
| "xsk_tx_metadata_completion" => true,

// A new field was added in kernel 5.4, this is the old version for backwards compatibility.
// https://github.com/torvalds/linux/commit/77cd0d7b3f257fd0e3096b4fdcff1a7d38e99e10
"xdp_ring_offset_v1" | "xdp_mmap_offsets_v1" => true,
Expand Down Expand Up @@ -3961,6 +3981,22 @@ fn test_linux(target: &str) {
{
return true;
}
// FIXME: Requires >= 4.20 kernel headers
if name == "PTP_SYS_OFFSET_EXTENDED" {
return true;
}
// FIXME: Requires >= 5.4 kernel headers
if 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: Requires >= 5.4.1 kernel headers
if name.starts_with("J1939")
|| name.starts_with("RTEXT_FILTER_")
Expand Down Expand Up @@ -4315,6 +4351,23 @@ fn test_linux(target: &str) {
true
}

// FIXME: Requires >= 6.8 kernel headers.
"XDP_UMEM_TX_SW_CSUM"
| "XDP_TXMD_FLAGS_TIMESTAMP"
| "XDP_TXMD_FLAGS_CHECKSUM"
| "XDP_TX_METADATA"
=>
{
true
}

// FIXME: Requires >= 6.11 kernel headers.
"XDP_UMEM_TX_METADATA_LEN"
=>
{
true
}

// FIXME: Requires >= 6.6 kernel headers.
"SYS_fchmodat2" => true,

Expand Down Expand Up @@ -4490,7 +4543,11 @@ fn test_linux(target: &str) {
// `__exit_status` type is a patch which is absent in musl
(struct_ == "utmpx" && field == "ut_exit" && musl) ||
// `can_addr` is an anonymous union
(struct_ == "sockaddr_can" && field == "can_addr")
(struct_ == "sockaddr_can" && field == "can_addr") ||
// `anonymous_1` is an anonymous union
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
// `anonymous_2` is an anonymous union
(struct_ == "ptp_perout_request" && field == "anonymous_2")
});

cfg.volatile_item(|i| {
Expand Down Expand Up @@ -4561,11 +4618,17 @@ fn test_linux(target: &str) {
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
// `handle` is a VLA
(struct_ == "fanotify_event_info_fid" && field == "handle") ||
// `anonymous_1` is an anonymous union
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
// `anonymous_2` is an anonymous union
(struct_ == "ptp_perout_request" && field == "anonymous_2") ||
// invalid application of 'sizeof' to incomplete type 'long unsigned int[]'
(musl && struct_ == "mcontext_t" && field == "__extcontext" && loongarch64) ||
// FIXME(#4121): a new field was added from `f_spare`
(struct_ == "statvfs" && field == "__f_spare") ||
(struct_ == "statvfs64" && field == "__f_spare")
(struct_ == "statvfs64" && field == "__f_spare") ||
// the `xsk_tx_metadata_union` field is an anonymous union
(struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union")
});

cfg.skip_roundtrip(move |s| match s {
Expand Down
38 changes: 38 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,27 @@ PTHREAD_PRIO_PROTECT
PTHREAD_PROCESS_PRIVATE
PTHREAD_PROCESS_SHARED
PTHREAD_STACK_MIN
PTP_ENABLE_PPS
PTP_ENABLE_PPS2
PTP_EXTTS_REQUEST
PTP_EXTTS_REQUEST2
PTP_MAX_SAMPLES
PTP_PEROUT_REQUEST
PTP_PEROUT_REQUEST2
PTP_PF_EXTTS
PTP_PF_NONE
PTP_PF_PEROUT
PTP_PF_PHYSYNC
PTP_PIN_GETFUNC
PTP_PIN_GETFUNC2
PTP_PIN_SETFUNC
PTP_PIN_SETFUNC2
PTP_SYS_OFFSET
PTP_SYS_OFFSET2
PTP_SYS_OFFSET_EXTENDED
PTP_SYS_OFFSET_EXTENDED2
PTP_SYS_OFFSET_PRECISE
PTP_SYS_OFFSET_PRECISE2
PTRACE_ATTACH
PTRACE_CONT
PTRACE_DETACH
Expand Down Expand Up @@ -3367,6 +3388,11 @@ W_EXITCODE
W_STOPCODE
XATTR_CREATE
XATTR_REPLACE
XDP_TXMD_FLAGS_CHECKSUM
XDP_TXMD_FLAGS_TIMESTAMP
XDP_TX_METADATA
XDP_UMEM_TX_METADATA_LEN
XDP_UMEM_TX_SW_CSUM
XTABS
YESEXPR
YESSTR
Expand Down Expand Up @@ -3558,11 +3584,15 @@ __WNOTHREAD
__c_anonymous_ifc_ifcu
__c_anonymous_ifr_ifru
__c_anonymous_ifru_map
__c_anonymous_ptp_perout_request_1
__c_anonymous_ptp_perout_request_2
__c_anonymous_sockaddr_can_can_addr
__c_anonymous_sockaddr_can_j1939
__c_anonymous_sockaddr_can_tp
__errno_location
__exit_status
__kernel_clockid_t
__kernel_fsid_t
__s16
__s32
__u16
Expand Down Expand Up @@ -3916,6 +3946,14 @@ pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptp_clock_time
ptp_extts_event
ptp_extts_request
ptp_perout_request
ptp_pin_desc
ptp_sys_offset
ptp_sys_offset_extended
ptp_sys_offset_precise
ptrace
ptsname_r
pwrite64
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ s! {
pub chunk_size: ::__u32,
pub headroom: ::__u32,
pub flags: ::__u32,
pub tx_metadata_len: ::__u32,
}

pub struct xdp_umem_reg_v1 {
Expand Down
Loading