| 1 |
.\" Copyright 2012-2015, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH PR_SET_NO_NEW_PRIVS 2const 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
PR_SET_NO_NEW_PRIVS |
| 9 |
\- |
| 10 |
set the calling thread's no_new_privs attribute |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 17 |
.B #include <sys/prctl.h> |
| 18 |
.P |
| 19 |
.B int prctl(PR_SET_NO_NEW_PRIVS, 1L, 0L, 0L, 0L); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Set the calling thread's |
| 23 |
.I no_new_privs |
| 24 |
attribute. |
| 25 |
With |
| 26 |
.I no_new_privs |
| 27 |
set to 1, |
| 28 |
.BR execve (2) |
| 29 |
promises not to grant privileges to do anything |
| 30 |
that could not have been done without the |
| 31 |
.BR execve (2) |
| 32 |
call (for example, |
| 33 |
rendering the set-user-ID and set-group-ID mode bits, |
| 34 |
and file capabilities non-functional). |
| 35 |
.P |
| 36 |
Once set, the |
| 37 |
.I no_new_privs |
| 38 |
attribute cannot be unset. |
| 39 |
The setting of this attribute is inherited by children created by |
| 40 |
.BR fork (2) |
| 41 |
and |
| 42 |
.BR clone (2), |
| 43 |
and preserved across |
| 44 |
.BR execve (2). |
| 45 |
.SH RETURN VALUE |
| 46 |
On success, |
| 47 |
0 is returned. |
| 48 |
On error, \-1 is returned, and |
| 49 |
.I errno |
| 50 |
is set to indicate the error. |
| 51 |
.SH ERRORS |
| 52 |
.TP |
| 53 |
.B EINVAL |
| 54 |
The second argument |
| 55 |
is not equal to |
| 56 |
.IR 1L . |
| 57 |
.SH FILES |
| 58 |
.TP |
| 59 |
.IR /proc/ pid /status |
| 60 |
Since Linux 4.10, |
| 61 |
the value of a thread's |
| 62 |
.I no_new_privs |
| 63 |
attribute can be viewed via the |
| 64 |
.I NoNewPrivs |
| 65 |
field in this file. |
| 66 |
.SH STANDARDS |
| 67 |
Linux. |
| 68 |
.SH HISTORY |
| 69 |
Linux 3.5. |
| 70 |
.SH SEE ALSO |
| 71 |
.BR prctl (2), |
| 72 |
.BR PR_GET_NO_NEW_PRIVS (2const), |
| 73 |
.BR seccomp (2) |
| 74 |
.P |
| 75 |
For more information, see the kernel source file |
| 76 |
.IR Documentation/\:userspace\-api/\:no_new_privs.rst . |