Skip to content

Several fixes for Linux/musl/s390x #4549

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions libc-test/semver/linux-gnu-s390x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
sysctl
4 changes: 0 additions & 4 deletions libc-test/semver/linux-s390x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ NFT_MSG_DELOBJ
NFT_MSG_GETOBJ
NFT_MSG_GETOBJ_RESET
NFT_MSG_NEWOBJ
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
SIGSTKFLT
SIGUNUSED
SO_BSDCOMPAT
Expand Down Expand Up @@ -113,6 +110,5 @@ makecontext
mcontext_t
setcontext
swapcontext
sysctl
termios2
ucontext_t
4 changes: 4 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,10 @@ SCTP_STATUS
SCTP_STREAM_RESET_INCOMING
SCTP_STREAM_RESET_OUTGOING
SCTP_UNORDERED
SECBIT_EXEC_DENY_INTERACTIVE
SECBIT_EXEC_DENY_INTERACTIVE_LOCKED
SECBIT_EXEC_RESTRICT_FILE
SECBIT_EXEC_RESTRICT_FILE_LOCKED
SECBIT_KEEP_CAPS
SECBIT_KEEP_CAPS_LOCKED
SECBIT_NOROOT
Expand Down
17 changes: 16 additions & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4750,9 +4750,24 @@ pub const SECBIT_NO_CAP_AMBIENT_RAISE: c_int = issecure_mask(SECURE_NO_CAP_AMBIE
pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED: c_int =
issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED);

const SECURE_EXEC_RESTRICT_FILE: c_int = 8;
const SECURE_EXEC_RESTRICT_FILE_LOCKED: c_int = 9;

pub const SECBIT_EXEC_RESTRICT_FILE: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE);
pub const SECBIT_EXEC_RESTRICT_FILE_LOCKED: c_int =
issecure_mask(SECURE_EXEC_RESTRICT_FILE_LOCKED);

const SECURE_EXEC_DENY_INTERACTIVE: c_int = 10;
const SECURE_EXEC_DENY_INTERACTIVE_LOCKED: c_int = 11;

pub const SECBIT_EXEC_DENY_INTERACTIVE: c_int = issecure_mask(SECURE_EXEC_DENY_INTERACTIVE);
pub const SECBIT_EXEC_DENY_INTERACTIVE_LOCKED: c_int =
issecure_mask(SECURE_EXEC_DENY_INTERACTIVE_LOCKED);

pub const SECUREBITS_DEFAULT: c_int = 0x00000000;
pub const SECURE_ALL_BITS: c_int =
SECBIT_NOROOT | SECBIT_NO_SETUID_FIXUP | SECBIT_KEEP_CAPS | SECBIT_NO_CAP_AMBIENT_RAISE;
SECBIT_NOROOT | SECBIT_NO_SETUID_FIXUP | SECBIT_KEEP_CAPS | SECBIT_NO_CAP_AMBIENT_RAISE |
SECBIT_EXEC_RESTRICT_FILE | SECBIT_EXEC_DENY_INTERACTIVE;
pub const SECURE_ALL_LOCKS: c_int = SECURE_ALL_BITS << 1;

const fn issecure_mask(x: c_int) -> c_int {
Expand Down
31 changes: 31 additions & 0 deletions src/unix/linux_like/linux/musl/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ s! {
pub st_blocks: crate::blkcnt64_t,
__unused: [c_long; 3],
}

pub struct statfs {
pub f_type: c_uint,
pub f_bsize: c_uint,
pub f_blocks: crate::fsblkcnt_t,
pub f_bfree: crate::fsblkcnt_t,
pub f_bavail: crate::fsblkcnt_t,
pub f_files: crate::fsfilcnt_t,
pub f_ffree: crate::fsfilcnt_t,
pub f_fsid: crate::fsid_t,
pub f_namelen: c_uint,
pub f_frsize: c_uint,
pub f_flags: c_uint,
pub f_spare: [c_uint; 4],
}

pub struct statfs64 {
pub f_type: c_uint,
pub f_bsize: c_uint,
pub f_blocks: crate::fsblkcnt_t,
pub f_bfree: crate::fsblkcnt_t,
pub f_bavail: crate::fsblkcnt_t,
pub f_files: crate::fsfilcnt_t,
pub f_ffree: crate::fsfilcnt_t,
pub f_fsid: crate::fsid_t,
pub f_namelen: c_uint,
pub f_frsize: c_uint,
pub f_flags: c_uint,
pub f_spare: [c_uint; 4],
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -715,3 +745,4 @@ pub const SYS_futex_waitv: c_long = 449;
pub const SYS_set_mempolicy_home_node: c_long = 450;
pub const SYS_cachestat: c_long = 451;
pub const SYS_fchmodat2: c_long = 452;
pub const SYS_mseal: c_long = 462;
8 changes: 4 additions & 4 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ s! {
pub tcpi_snd_wnd: u32,
}

// MIPS implementation is special (see mips arch folders)
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
// MIPS/s390x implementation is special (see arch folders)
#[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "s390x")))]
pub struct statfs {
pub f_type: c_ulong,
pub f_bsize: c_ulong,
Expand All @@ -389,8 +389,8 @@ s! {
pub f_spare: [c_ulong; 4],
}

// MIPS implementation is special (see mips arch folders)
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
// MIPS/s390x implementation is special (see arch folders)
#[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "s390x")))]
pub struct statfs64 {
pub f_type: c_ulong,
pub f_bsize: c_ulong,
Expand Down
Loading