Skip to content

Commit 2c99002

Browse files
authored
Add more Linux-specific mprotect flags. (#741)
Add `PROT_SEM`, `PROT_BTI`, and others.
1 parent 7914500 commit 2c99002

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/backend/libc/mm/types.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ bitflags! {
4040
/// `PROT_GROWSDOWN`
4141
#[cfg(linux_kernel)]
4242
const GROWSDOWN = bitcast!(c::PROT_GROWSDOWN);
43+
/// `PROT_SEM`
44+
#[cfg(linux_kernel)]
45+
const SEM = linux_raw_sys::general::PROT_SEM;
46+
/// `PROT_BTI`
47+
#[cfg(all(linux_kernel, target_arch = "aarch64"))]
48+
const BTI = linux_raw_sys::general::PROT_BTI;
49+
/// `PROT_MTE`
50+
#[cfg(all(linux_kernel, target_arch = "aarch64"))]
51+
const MTE = linux_raw_sys::general::PROT_MTE;
52+
/// `PROT_SAO`
53+
#[cfg(all(linux_kernel, any(target_arch = "powerpc", target_arch = "powerpc64")))]
54+
const SAO = linux_raw_sys::general::PROT_SAO;
55+
/// `PROT_ADI`
56+
#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
57+
const ADI = linux_raw_sys::general::PROT_ADI;
4358
}
4459
}
4560

src/backend/linux_raw/mm/types.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ bitflags! {
3838
const GROWSUP = linux_raw_sys::general::PROT_GROWSUP;
3939
/// `PROT_GROWSDOWN`
4040
const GROWSDOWN = linux_raw_sys::general::PROT_GROWSDOWN;
41+
/// `PROT_SEM`
42+
const SEM = linux_raw_sys::general::PROT_SEM;
43+
/// `PROT_BTI`
44+
#[cfg(target_arch = "aarch64")]
45+
const BTI = linux_raw_sys::general::PROT_BTI;
46+
/// `PROT_MTE`
47+
#[cfg(target_arch = "aarch64")]
48+
const MTE = linux_raw_sys::general::PROT_MTE;
49+
/// `PROT_SAO`
50+
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
51+
const SAO = linux_raw_sys::general::PROT_SAO;
52+
/// `PROT_ADI`
53+
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
54+
const ADI = linux_raw_sys::general::PROT_ADI;
4155
}
4256
}
4357

0 commit comments

Comments
 (0)