Skip to content

Commit 4759d68

Browse files
rusty-snaketgross35
authored andcommitted
Add constants for Memory-Deny-Write-Execute prctls
(cherry picked from commit 4ed4eb6) (backport <rust-lang#4400>)
1 parent c9943c3 commit 4759d68

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

libc-test/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4302,6 +4302,10 @@ fn test_linux(target: &str) {
43024302
if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") {
43034303
return true;
43044304
}
4305+
// FIXME: Requires >= 6.3 (6.6) kernel headers
4306+
if name == "PR_GET_MDWE" || name == "PR_MDWE_NO_INHERIT" || name == "PR_MDWE_REFUSE_EXEC_GAIN" || name == "PR_SET_MDWE" {
4307+
return true;
4308+
}
43054309
// FIXME(musl): Requires musl >= 1.2
43064310
if name == "SO_PREFER_BUSY_POLL"
43074311
|| name == "SO_BUSY_POLL_BUDGET"
@@ -4583,6 +4587,9 @@ fn test_linux(target: &str) {
45834587
true
45844588
}
45854589

4590+
// FIXME(linux): Requires >= 6.6 kernel headers.
4591+
"PR_MDWE_NO_INHERIT" => true,
4592+
45864593
// FIXME(linux): Requires >= 6.8 kernel headers.
45874594
"XDP_UMEM_TX_SW_CSUM"
45884595
| "XDP_TXMD_FLAGS_TIMESTAMP"

libc-test/semver/linux.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,7 @@ PR_GET_FPEMU
22562256
PR_GET_FPEXC
22572257
PR_GET_FP_MODE
22582258
PR_GET_KEEPCAPS
2259+
PR_GET_MDWE
22592260
PR_GET_NAME
22602261
PR_GET_NO_NEW_PRIVS
22612262
PR_GET_PDEATHSIG
@@ -2274,6 +2275,8 @@ PR_MCE_KILL_EARLY
22742275
PR_MCE_KILL_GET
22752276
PR_MCE_KILL_LATE
22762277
PR_MCE_KILL_SET
2278+
PR_MDWE_NO_INHERIT
2279+
PR_MDWE_REFUSE_EXEC_GAIN
22772280
PR_MPX_DISABLE_MANAGEMENT
22782281
PR_MPX_ENABLE_MANAGEMENT
22792282
PR_SCHED_CORE
@@ -2292,6 +2295,7 @@ PR_SET_FPEMU
22922295
PR_SET_FPEXC
22932296
PR_SET_FP_MODE
22942297
PR_SET_KEEPCAPS
2298+
PR_SET_MDWE
22952299
PR_SET_MM
22962300
PR_SET_MM_ARG_END
22972301
PR_SET_MM_ARG_START

src/unix/linux_like/linux/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,6 +3342,11 @@ pub const PR_GET_CHILD_SUBREAPER: c_int = 37;
33423342
pub const PR_SET_NO_NEW_PRIVS: c_int = 38;
33433343
pub const PR_GET_NO_NEW_PRIVS: c_int = 39;
33443344

3345+
pub const PR_SET_MDWE: c_int = 65;
3346+
pub const PR_GET_MDWE: c_int = 66;
3347+
pub const PR_MDWE_REFUSE_EXEC_GAIN: c_uint = 1 << 0;
3348+
pub const PR_MDWE_NO_INHERIT: c_uint = 1 << 1;
3349+
33453350
pub const PR_GET_TID_ADDRESS: c_int = 40;
33463351

33473352
pub const PR_SET_THP_DISABLE: c_int = 41;

0 commit comments

Comments
 (0)