From 8b68569939151c1390ee8b7ffcc0772f517d6ecd Mon Sep 17 00:00:00 2001 From: rusty-snake <41237666+rusty-snake@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:18:30 +0100 Subject: [PATCH] Add MFD_NOEXEC_SEAL and MFD_EXEC --- libc-test/build.rs | 4 ++++ libc-test/semver/android.txt | 2 ++ libc-test/semver/linux.txt | 2 ++ src/unix/linux_like/android/mod.rs | 2 ++ src/unix/linux_like/linux/mod.rs | 2 ++ 5 files changed, 12 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 1b65d65f95ec9..b505a93e96ae6 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3786,6 +3786,10 @@ fn test_linux(target: &str) { if name.starts_with("NI_IDN") { return true; } + // FIXME: Requires >= 6.3 kernel headers + if name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC" { + return true; + } } match name { // These constants are not available if gnu headers have been included diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index f0e4358d37c62..901b7ca768d41 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1214,7 +1214,9 @@ MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ MFD_ALLOW_SEALING MFD_CLOEXEC +MFD_EXEC MFD_HUGETLB +MFD_NOEXEC_SEAL MINIX2_SUPER_MAGIC MINIX2_SUPER_MAGIC2 MINIX_SUPER_MAGIC diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index ff82d18b355ee..f14476525db06 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1448,7 +1448,9 @@ MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ MFD_ALLOW_SEALING MFD_CLOEXEC +MFD_EXEC MFD_HUGETLB +MFD_NOEXEC_SEAL MINSIGSTKSZ MMAP_PAGE_ZERO MNT_DETACH diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 94c4eace85539..484d0ab4724a8 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -2275,6 +2275,8 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; pub const MFD_HUGETLB: ::c_uint = 0x0004; +pub const MFD_NOEXEC_SEAL: ::c_uint = 0x0008; +pub const MFD_EXEC: ::c_uint = 0x0010; pub const MFD_HUGE_64KB: ::c_uint = 0x40000000; pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000; pub const MFD_HUGE_1MB: ::c_uint = 0x50000000; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index acb10c603f725..cbb3f7bdf5fe8 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -2433,6 +2433,8 @@ pub const CMSPAR: ::tcflag_t = 0o10000000000; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; pub const MFD_HUGETLB: ::c_uint = 0x0004; +pub const MFD_NOEXEC_SEAL: ::c_uint = 0x0008; +pub const MFD_EXEC: ::c_uint = 0x0010; pub const MFD_HUGE_64KB: ::c_uint = 0x40000000; pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000; pub const MFD_HUGE_1MB: ::c_uint = 0x50000000;