| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH PR_SET_MDWE 2const 2026-01-17 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
PR_SET_MDWE |
| 8 |
\- |
| 9 |
set the Memory-Deny-Write-Execute protection mask for the calling process |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 16 |
.B #include <sys/prctl.h> |
| 17 |
.P |
| 18 |
.BI "int prctl(PR_SET_MDWE, unsigned long " mask ", 0L, 0L, 0L);" |
| 19 |
.fi |
| 20 |
.SH DESCRIPTION |
| 21 |
Set the calling process' Memory-Deny-Write-Execute protection mask. |
| 22 |
Once protection bits are set, |
| 23 |
they can not be changed. |
| 24 |
.P |
| 25 |
.I mask |
| 26 |
must be a bit mask of: |
| 27 |
.TP |
| 28 |
.B PR_MDWE_REFUSE_EXEC_GAIN |
| 29 |
New memory mappings can't be writable and executable. |
| 30 |
Non-executable mappings can't become executable. |
| 31 |
.TP |
| 32 |
.B PR_MDWE_NO_INHERIT " (since Linux 6.6)" |
| 33 |
.\" commit 2a87e5520554034e8c423479740f95bea4a086a0 |
| 34 |
Do not propagate MDWE protection to child processes on |
| 35 |
.BR fork (2). |
| 36 |
Setting this bit requires setting |
| 37 |
.B PR_MDWE_REFUSE_EXEC_GAIN |
| 38 |
too. |
| 39 |
.SH RETURN VALUE |
| 40 |
On success, |
| 41 |
0 is returned. |
| 42 |
On error, \-1 is returned, and |
| 43 |
.I errno |
| 44 |
is set to indicate the error. |
| 45 |
.SH ERRORS |
| 46 |
.TP |
| 47 |
.B EINVAL |
| 48 |
.I mask |
| 49 |
is not a valid value. |
| 50 |
.SH STANDARDS |
| 51 |
Linux. |
| 52 |
.SH HISTORY |
| 53 |
Linux 6.3. |
| 54 |
.\" commit b507808ebce23561d4ff8c2aa1fb949fe402bc61 |
| 55 |
.SH SEE ALSO |
| 56 |
.BR prctl (2), |
| 57 |
.BR PR_GET_MDWE (2const) |