Debian Codegraph @

upstream/debian-trixie/man2/PR_SET_NO_NEW_PRIVS.2const

raw
1 .\" Copyright 2012, Kees Cook <[email protected]>
2 .\" Copyright 2012, 2013, 2015, Michael Kerrisk <[email protected]>
3 .\" Copyright 2024, Alejandro Colomar <[email protected]>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH PR_SET_NO_NEW_PRIVS 2const 2024-06-01 "Linux man-pages 6.9.1"
8 .SH NAME
9 PR_SET_NO_NEW_PRIVS
10 \-
11 set the calling thread's no_new_privs attribute
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 .B int prctl(PR_SET_NO_NEW_PRIVS, 1L, 0L, 0L, 0L);
21 .fi
22 .SH DESCRIPTION
23 Set the calling thread's
24 .I no_new_privs
25 attribute.
26 With
27 .I no_new_privs
28 set to 1,
29 .BR execve (2)
30 promises not to grant privileges to do anything
31 that could not have been done without the
32 .BR execve (2)
33 call (for example,
34 rendering the set-user-ID and set-group-ID mode bits,
35 and file capabilities non-functional).
36 .P
37 Once set, the
38 .I no_new_privs
39 attribute cannot be unset.
40 The setting of this attribute is inherited by children created by
41 .BR fork (2)
42 and
43 .BR clone (2),
44 and preserved across
45 .BR execve (2).
46 .SH RETURN VALUE
47 On success,
48 0 is returned.
49 On error, \-1 is returned, and
50 .I errno
51 is set to indicate the error.
52 .SH ERRORS
53 .TP
54 .B EINVAL
55 The second argument
56 is not equal to
57 .IR 1L .
58 .SH FILES
59 .TP
60 .IR /proc/ pid /status
61 Since Linux 4.10,
62 the value of a thread's
63 .I no_new_privs
64 attribute can be viewed via the
65 .I NoNewPrivs
66 field in this file.
67 .SH STANDARDS
68 Linux.
69 .SH HISTORY
70 Linux 3.5.
71 .SH SEE ALSO
72 .BR prctl (2),
73 .BR PR_GET_NO_NEW_PRIVS (2const),
74 .BR seccomp (2)
75 .P
76 For more information, see the kernel source file
77 .I Documentation/\:userspace\-api/\:no_new_privs.rst
78 .\" commit 40fde647ccb0ae8c11d256d271e24d385eed595b
79 (or
80 .I Documentation/\:prctl/\:no_new_privs.txt
81 before Linux 4.13).