| 1 |
.\" Copyright 2012, Cyrill Gorcunov <[email protected]> |
| 2 |
.\" Copyright 2012-2015, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH PR_SET_MM 2const 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
PR_SET_MM |
| 10 |
\- |
| 11 |
modify kernel memory map descriptor fields |
| 12 |
.SH LIBRARY |
| 13 |
Standard C library |
| 14 |
.RI ( libc ,\~ \-lc ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 18 |
.B #include <sys/prctl.h> |
| 19 |
.P |
| 20 |
.BI "int prctl(PR_SET_MM, long " op ", ...);" |
| 21 |
.fi |
| 22 |
.SH DESCRIPTION |
| 23 |
Modify certain kernel memory map descriptor fields |
| 24 |
of the calling process. |
| 25 |
Usually these fields are set by the kernel and dynamic loader (see |
| 26 |
.BR ld.so (8) |
| 27 |
for more information) and a regular application should not use this feature. |
| 28 |
However, there are cases, such as self-modifying programs, |
| 29 |
where a program might find it useful to change its own memory map. |
| 30 |
.P |
| 31 |
The calling process must have the |
| 32 |
.B CAP_SYS_RESOURCE |
| 33 |
capability. |
| 34 |
The value in |
| 35 |
.I op |
| 36 |
is one of the options below. |
| 37 |
.TP |
| 38 |
.B PR_SET_MM_START_CODE |
| 39 |
.TQ |
| 40 |
.B PR_SET_MM_END_CODE |
| 41 |
.TQ |
| 42 |
.B PR_SET_MM_START_DATA |
| 43 |
.TQ |
| 44 |
.B PR_SET_MM_END_DATA |
| 45 |
.TQ |
| 46 |
.B PR_SET_MM_START_STACK |
| 47 |
.TQ |
| 48 |
.B PR_SET_MM_START_BRK |
| 49 |
.TQ |
| 50 |
.B PR_SET_MM_BRK |
| 51 |
.TQ |
| 52 |
.B PR_SET_MM_ARG_START |
| 53 |
.TQ |
| 54 |
.B PR_SET_MM_ARG_END |
| 55 |
.TQ |
| 56 |
.B PR_SET_MM_ENV_START |
| 57 |
.TQ |
| 58 |
.B PR_SET_MM_ENV_END |
| 59 |
.TQ |
| 60 |
.B PR_SET_MM_AUXV |
| 61 |
.TQ |
| 62 |
.B PR_SET_MM_EXE_FILE |
| 63 |
.TQ |
| 64 |
.B PR_SET_MM_MAP |
| 65 |
.TQ |
| 66 |
.B PR_SET_MM_MAP_SIZE |
| 67 |
.SH RETURN VALUE |
| 68 |
On success, |
| 69 |
0 is returned. |
| 70 |
On error, \-1 is returned, and |
| 71 |
.I errno |
| 72 |
is set to indicate the error. |
| 73 |
.SH ERRORS |
| 74 |
.TP |
| 75 |
.B EINVAL |
| 76 |
.I op |
| 77 |
is not a valid value. |
| 78 |
.TP |
| 79 |
.B EPERM |
| 80 |
The caller does not have the |
| 81 |
.B CAP_SYS_RESOURCE |
| 82 |
capability. |
| 83 |
.SH STANDARDS |
| 84 |
Linux. |
| 85 |
.SH HISTORY |
| 86 |
Linux 3.3. |
| 87 |
.\" commit 028ee4be34a09a6d48bdf30ab991ae933a7bc036 |
| 88 |
.P |
| 89 |
Before Linux 3.10, |
| 90 |
.\" commit 52b3694157e3aa6df871e283115652ec6f2d31e0 |
| 91 |
this feature is available only if the kernel is built with the |
| 92 |
.B CONFIG_CHECKPOINT_RESTORE |
| 93 |
option enabled. |
| 94 |
.SH SEE ALSO |
| 95 |
.BR prctl (2), |
| 96 |
.BR PR_SET_MM_START_CODE (2const), |
| 97 |
.BR PR_SET_MM_END_CODE (2const), |
| 98 |
.BR PR_SET_MM_START_DATA (2const), |
| 99 |
.BR PR_SET_MM_END_DATA (2const), |
| 100 |
.BR PR_SET_MM_START_STACK (2const), |
| 101 |
.BR PR_SET_MM_START_BRK (2const), |
| 102 |
.BR PR_SET_MM_BRK (2const), |
| 103 |
.BR PR_SET_MM_ARG_START (2const), |
| 104 |
.BR PR_SET_MM_ARG_END (2const), |
| 105 |
.BR PR_SET_MM_ENV_START (2const), |
| 106 |
.BR PR_SET_MM_ENV_END (2const), |
| 107 |
.BR PR_SET_MM_EXE_FILE (2const), |
| 108 |
.BR PR_SET_MM_MAP (2const), |
| 109 |
.BR PR_SET_MM_MAP_SIZE (2const) |