Skip to content

Commit 3840939

Browse files
fspvJohnTitor
authored andcommitted
Add PR_SET_MEMORY_MERGE and PR_GET_MEMORY_MERGE for linux
Add `PR_SET_MEMORY_MERGE` and `PR_GET_MEMORY_MERGE` prctl constants for the linux target. These control [per-process opt-in to KSM](https://lwn.net/Articles/953141/) and have been available since kernel 6.4. They were already defined for the android target but missing from linux (cherry picked from commit 545663c)
1 parent f697deb commit 3840939

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4422,6 +4422,8 @@ fn test_linux(target: &str) {
44224422
| "PR_MDWE_NO_INHERIT"
44234423
| "PR_MDWE_REFUSE_EXEC_GAIN"
44244424
| "PR_SET_MDWE"
4425+
| "PR_GET_MEMORY_MERGE"
4426+
| "PR_SET_MEMORY_MERGE"
44254427
| "IPPROTO_ETHERNET"
44264428
| "IPPROTO_MPTCP"
44274429
| "SI_DETHREAD"

libc-test/semver/linux.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,7 @@ PR_GET_FPEXC
24042404
PR_GET_FP_MODE
24052405
PR_GET_KEEPCAPS
24062406
PR_GET_MDWE
2407+
PR_GET_MEMORY_MERGE
24072408
PR_GET_NAME
24082409
PR_GET_NO_NEW_PRIVS
24092410
PR_GET_PDEATHSIG
@@ -2443,6 +2444,7 @@ PR_SET_FPEXC
24432444
PR_SET_FP_MODE
24442445
PR_SET_KEEPCAPS
24452446
PR_SET_MDWE
2447+
PR_SET_MEMORY_MERGE
24462448
PR_SET_MM
24472449
PR_SET_MM_ARG_END
24482450
PR_SET_MM_ARG_START

src/unix/linux_like/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,8 @@ pub const PR_SET_MDWE: c_int = 65;
16441644
pub const PR_GET_MDWE: c_int = 66;
16451645
pub const PR_MDWE_REFUSE_EXEC_GAIN: c_uint = 1 << 0;
16461646
pub const PR_MDWE_NO_INHERIT: c_uint = 1 << 1;
1647+
pub const PR_SET_MEMORY_MERGE: c_int = 67;
1648+
pub const PR_GET_MEMORY_MERGE: c_int = 68;
16471649

16481650
pub const GRND_NONBLOCK: c_uint = 0x0001;
16491651
pub const GRND_RANDOM: c_uint = 0x0002;

0 commit comments

Comments
 (0)