Skip to content

Commit 8edaeca

Browse files
authored
Add NOEXEC_SEAL and EXEC to MemfdFlags (#976)
* Bump libc to 0.2.153 NOEXEC_SEAL and EXEC constants were added in libc 0.2.153 * Add NOEXEC_SEAL and EXEC to MemfdFlags Enabling non-executable memfds: https://lwn.net/Articles/918106/
1 parent 095d800 commit 8edaeca

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ once_cell = { version = "1.5.2", optional = true }
3838
[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies]
3939
linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] }
4040
libc_errno = { package = "errno", version = "0.3.8", default-features = false, optional = true }
41-
libc = { version = "0.2.152", default-features = false, features = ["extra_traits"], optional = true }
41+
libc = { version = "0.2.153", default-features = false, features = ["extra_traits"], optional = true }
4242

4343
# Dependencies for platforms where only libc is supported:
4444
#
4545
# On all other Unix-family platforms, and under Miri, we always use the libc
4646
# backend, so enable its dependencies unconditionally.
4747
[target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
4848
libc_errno = { package = "errno", version = "0.3.8", default-features = false }
49-
libc = { version = "0.2.152", default-features = false, features = ["extra_traits"] }
49+
libc = { version = "0.2.153", default-features = false, features = ["extra_traits"] }
5050

5151
# Additional dependencies for Linux with the libc backend:
5252
#
@@ -74,7 +74,7 @@ default-features = false
7474

7575
[dev-dependencies]
7676
tempfile = "3.5.0"
77-
libc = "0.2.152"
77+
libc = "0.2.153"
7878
libc_errno = { package = "errno", version = "0.3.8", default-features = false }
7979
serial_test = "2.0.0"
8080
memoffset = "0.9.0"

src/backend/libc/fs/types.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,13 @@ bitflags! {
600600
/// `MFD_HUGETLB` (since Linux 4.14)
601601
const HUGETLB = c::MFD_HUGETLB;
602602

603+
/// `MFD_NOEXEC_SEAL` (since Linux 6.3)
604+
#[cfg(linux_kernel)]
605+
const NOEXEC_SEAL = c::MFD_NOEXEC_SEAL;
606+
/// `MFD_EXEC` (since Linux 6.3)
607+
#[cfg(linux_kernel)]
608+
const EXEC = c::MFD_EXEC;
609+
603610
/// `MFD_HUGE_64KB`
604611
const HUGE_64KB = c::MFD_HUGE_64KB;
605612
/// `MFD_HUGE_512JB`

src/backend/linux_raw/fs/types.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ bitflags! {
428428
/// `MFD_HUGETLB` (since Linux 4.14)
429429
const HUGETLB = linux_raw_sys::general::MFD_HUGETLB;
430430

431+
/// `MFD_NOEXEC_SEAL` (since Linux 6.3)
432+
const NOEXEC_SEAL = linux_raw_sys::general::MFD_NOEXEC_SEAL;
433+
/// `MFD_EXEC` (since Linux 6.3)
434+
const EXEC = linux_raw_sys::general::MFD_EXEC;
435+
431436
/// `MFD_HUGE_64KB`
432437
const HUGE_64KB = linux_raw_sys::general::MFD_HUGE_64KB;
433438
/// `MFD_HUGE_512JB`

0 commit comments

Comments
 (0)