]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl) | |
c11b1abf | 4 | .\" and Copyright (C) 2002 Michael Kerrisk <mtk.manpages@gmail.com> |
af5f9508 | 5 | .\" and Copyright Guillem Jover <guillem@hadrons.org> |
fea681da MK |
6 | .\" |
7 | .\" Permission is granted to make and distribute verbatim copies of this | |
8 | .\" manual provided the copyright notice and this permission notice are | |
9 | .\" preserved on all copies. | |
10 | .\" | |
11 | .\" Permission is granted to copy and distribute modified versions of this | |
12 | .\" manual under the conditions for verbatim copying, provided that the | |
13 | .\" entire resulting derived work is distributed under the terms of a | |
14 | .\" permission notice identical to this one. | |
c13182ef | 15 | .\" |
fea681da MK |
16 | .\" Since the Linux kernel and libraries are constantly changing, this |
17 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
18 | .\" responsibility for errors or omissions, or for damages resulting from | |
19 | .\" the use of the information contained herein. The author(s) may not | |
20 | .\" have taken the same level of care in the production of this manual, | |
21 | .\" which is licensed free of charge, as they might when working | |
22 | .\" professionally. | |
c13182ef | 23 | .\" |
fea681da MK |
24 | .\" Formatted or processed versions of this manual, if unaccompanied by |
25 | .\" the source, must acknowledge the copyright and authors of this work. | |
26 | .\" | |
27 | .\" Modified Thu Nov 11 04:19:42 MET 1999, aeb: added PR_GET_PDEATHSIG | |
28 | .\" Modified 27 Jun 02, Michael Kerrisk | |
c13182ef | 29 | .\" Added PR_SET_DUMPABLE, PR_GET_DUMPABLE, |
fea681da | 30 | .\" PR_SET_KEEPCAPS, PR_GET_KEEPCAPS |
e87fdd92 MK |
31 | .\" Modified 2006-08-30 Guillem Jover <guillem@hadrons.org> |
32 | .\" Updated Linux versions where the options where introduced. | |
33 | .\" Added PR_SET_TIMING, PR_GET_TIMING, PR_SET_NAME, PR_GET_NAME, | |
34 | .\" PR_SET_UNALIGN, PR_GET_UNALIGN, PR_SET_FPEMU, PR_GET_FPEMU, | |
35 | .\" PR_SET_FPEXC, PR_GET_FPEXC | |
8ab8b43f MK |
36 | .\" 2008-04-29 Serge Hallyn, Document PR_CAPBSET_READ and PR_CAPBSET_DROP |
37 | .\" 2008-06-13 Erik Bosman, <ejbosman@cs.vu.nl> | |
38 | .\" Document PR_GET_TSC and PR_SET_TSC. | |
39 | .\" 2008-06-15 mtk, Document PR_SET_SECCOMP, PR_GET_SECCOMP | |
bc02b3ea | 40 | .\" 2009-10-03 Andi Kleen, document PR_MCE_KILL |
06afe673 | 41 | .\" 2012-04 Cyrill Gorcunov, Document PR_SET_MM |
bc02b3ea MK |
42 | .\" 2012-04-25 Michael Kerrisk, Document PR_TASK_PERF_EVENTS_DISABLE and |
43 | .\" PR_TASK_PERF_EVENTS_ENABLE | |
fea681da | 44 | .\" |
e14baeeb | 45 | .\" FIXME: Document PR_SET_TIMERSLACK and PR_GET_TIMERSLACK (new in 2.6.28) |
bc02b3ea | 46 | .\" commit 6976675d94042fbd446231d1bd8b7de71a980ada |
e14baeeb | 47 | .\" |
c7c7235c | 48 | .TH PRCTL 2 2012-04-23 "Linux" "Linux Programmer's Manual" |
fea681da MK |
49 | .SH NAME |
50 | prctl \- operations on a process | |
51 | .SH SYNOPSIS | |
521bf584 | 52 | .nf |
fea681da MK |
53 | .B #include <sys/prctl.h> |
54 | .sp | |
521bf584 MK |
55 | .BI "int prctl(int " option ", unsigned long " arg2 ", unsigned long " arg3 , |
56 | .BI " unsigned long " arg4 ", unsigned long " arg5 ); | |
57 | .fi | |
fea681da | 58 | .SH DESCRIPTION |
e511ffb6 | 59 | .BR prctl () |
fea681da | 60 | is called with a first argument describing what to do |
1a329b56 | 61 | (with values defined in \fI<linux/prctl.h>\fP), and further |
c4bb193f | 62 | arguments with a significance depending on the first one. |
fea681da MK |
63 | The first argument can be: |
64 | .TP | |
2e781e20 | 65 | .BR PR_CAPBSET_READ " (since Linux 2.6.25)" |
8ab8b43f MK |
66 | Return (as the function result) 1 if the capability specified in |
67 | .I arg2 | |
68 | is in the calling thread's capability bounding set, | |
69 | or 0 if it is not. | |
70 | (The capability constants are defined in | |
71 | .IR <linux/capability.h> .) | |
72 | The capability bounding set dictates | |
73 | whether the process can receive the capability through a | |
2914a14d | 74 | file's permitted capability set on a subsequent call to |
8ab8b43f MK |
75 | .BR execve (2). |
76 | ||
77 | If the capability specified in | |
78 | .I arg2 | |
79 | is not valid, then the call fails with the error | |
80 | .BR EINVAL . | |
81 | .TP | |
82 | .BR PR_CAPBSET_DROP " (since Linux 2.6.25)" | |
83 | If the calling thread has the | |
84 | .B CAP_SETPCAP | |
85 | capability, then drop the capability specified by | |
86 | .I arg2 | |
87 | from the calling thread's capability bounding set. | |
88 | Any children of the calling thread will inherit the newly | |
89 | reduced bounding set. | |
90 | ||
91 | The call fails with the error: | |
92 | .B EPERM | |
2914a14d | 93 | if the calling thread does not have the |
8ab8b43f MK |
94 | .BR CAP_SETPCAP ; |
95 | .BR EINVAL | |
96 | if | |
97 | .I arg2 | |
98 | does not represent a valid capability; or | |
99 | .BR EINVAL | |
100 | if file capabilities are not enabled in the kernel, | |
101 | in which case bounding sets are not supported. | |
102 | .TP | |
88989295 MK |
103 | .BR PR_SET_DUMPABLE " (since Linux 2.3.20)" |
104 | Set the state of the flag determining whether core dumps are produced | |
105 | for this process upon delivery of a signal whose default behavior is | |
106 | to produce a core dump. | |
107 | (Normally this flag is set for a process by default, but it is cleared | |
108 | when a set-user-ID or set-group-ID program is executed and also by | |
109 | various system calls that manipulate process UIDs and GIDs). | |
110 | In kernels up to and including 2.6.12, | |
8ab8b43f | 111 | .I arg2 |
88989295 MK |
112 | must be either 0 (process is not dumpable) or 1 (process is dumpable). |
113 | Between kernels 2.6.13 and 2.6.17, the value 2 was also permitted, | |
114 | which caused any binary which normally would not be dumped | |
115 | to be dumped readable by root only; | |
116 | for security reasons, this feature has been removed. | |
117 | .\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2 | |
118 | .\" Subject: Fix prctl privilege escalation (CVE-2006-2451) | |
119 | .\" From: Marcel Holtmann <marcel () holtmann ! org> | |
120 | .\" Date: 2006-07-12 11:12:00 | |
121 | (See also the description of | |
122 | .I /proc/sys/fs/suid_dumpable | |
123 | in | |
124 | .BR proc (5).) | |
cadcf1b1 | 125 | Processes that are not dumpable can not be attached via |
6fdbc779 | 126 | .BR ptrace (2) |
cadcf1b1 | 127 | .BR PTRACE_ATTACH . |
64536a1b | 128 | .TP |
88989295 MK |
129 | .BR PR_GET_DUMPABLE " (since Linux 2.3.20)" |
130 | Return (as the function result) the current state of the calling | |
131 | process's dumpable flag. | |
132 | .\" Since Linux 2.6.13, the dumpable flag can have the value 2, | |
133 | .\" but in 2.6.13 PR_GET_DUMPABLE simply returns 1 if the dumpable | |
c7094399 | 134 | .\" flags has a nonzero value. This was fixed in 2.6.14. |
64536a1b | 135 | .TP |
8ab8b43f | 136 | .BR PR_SET_ENDIAN " (since Linux 2.6.18, PowerPC only)" |
c13182ef | 137 | Set the endian-ness of the calling process to the value given |
64536a1b | 138 | in \fIarg2\fP, which should be one of the following: |
8ab8b43f | 139 | .\" Respectively 0, 1, 2 |
64536a1b MK |
140 | .BR PR_ENDIAN_BIG , |
141 | .BR PR_ENDIAN_LITTLE , | |
142 | or | |
0daa9e92 | 143 | .B PR_ENDIAN_PPC_LITTLE |
64536a1b | 144 | (PowerPC pseudo little endian). |
e87fdd92 | 145 | .TP |
8ab8b43f MK |
146 | .BR PR_GET_ENDIAN " (since Linux 2.6.18, PowerPC only)" |
147 | Return the endian-ness of the calling process, | |
148 | in the location pointed to by | |
149 | .IR "(int\ *) arg2" . | |
150 | .TP | |
8ab8b43f | 151 | .BR PR_SET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)" |
e87fdd92 MK |
152 | Set floating-point emulation control bits to \fIarg2\fP. |
153 | Pass \fBPR_FPEMU_NOPRINT\fP to silently emulate fp operations accesses, or | |
8bd58774 MK |
154 | \fBPR_FPEMU_SIGFPE\fP to not emulate fp operations and send |
155 | .B SIGFPE | |
156 | instead. | |
e87fdd92 | 157 | .TP |
8ab8b43f MK |
158 | .BR PR_GET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)" |
159 | Return floating-point emulation control bits, | |
160 | in the location pointed to by | |
161 | .IR "(int\ *) arg2" . | |
e87fdd92 | 162 | .TP |
8ab8b43f | 163 | .BR PR_SET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)" |
1c44bd5b MK |
164 | Set floating-point exception mode to \fIarg2\fP. |
165 | Pass \fBPR_FP_EXC_SW_ENABLE\fP to use FPEXC for FP exception enables, | |
c45bd688 MK |
166 | \fBPR_FP_EXC_DIV\fP for floating-point divide by zero, |
167 | \fBPR_FP_EXC_OVF\fP for floating-point overflow, | |
168 | \fBPR_FP_EXC_UND\fP for floating-point underflow, | |
169 | \fBPR_FP_EXC_RES\fP for floating-point inexact result, | |
170 | \fBPR_FP_EXC_INV\fP for floating-point invalid operation, | |
e87fdd92 | 171 | \fBPR_FP_EXC_DISABLED\fP for FP exceptions disabled, |
b28f6e56 | 172 | \fBPR_FP_EXC_NONRECOV\fP for async nonrecoverable exception mode, |
e87fdd92 MK |
173 | \fBPR_FP_EXC_ASYNC\fP for async recoverable exception mode, |
174 | \fBPR_FP_EXC_PRECISE\fP for precise exception mode. | |
175 | .TP | |
8ab8b43f MK |
176 | .BR PR_GET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)" |
177 | Return floating-point exception mode, | |
178 | in the location pointed to by | |
179 | .IR "(int\ *) arg2" . | |
180 | .TP | |
88989295 MK |
181 | .BR PR_SET_KEEPCAPS " (since Linux 2.2.18)" |
182 | Set the state of the thread's "keep capabilities" flag, | |
028cb080 MK |
183 | which determines whether the threads's permitted |
184 | capability set is cleared when a change is made to the threads's user IDs | |
88989295 | 185 | such that the threads's real UID, effective UID, and saved set-user-ID |
c7094399 | 186 | all become nonzero when at least one of them previously had the value 0. |
028cb080 MK |
187 | By default, the permitted capability set is cleared when such a change is made; |
188 | setting the "keep capabilities" flag prevents it from being cleared. | |
88989295 | 189 | .I arg2 |
028cb080 MK |
190 | must be either 0 (permitted capabilities are cleared) |
191 | or 1 (permitted capabilities are kept). | |
192 | (A thread's | |
193 | .I effective | |
194 | capability set is always cleared when such a credential change is made, | |
195 | regardless of the setting of the "keep capabilities" flag.) | |
196 | The "keep capabilities" value will be reset to 0 on subsequent calls to | |
88989295 MK |
197 | .BR execve (2). |
198 | .TP | |
199 | .BR PR_GET_KEEPCAPS " (since Linux 2.2.18)" | |
200 | Return (as the function result) the current state of the calling threads's | |
201 | "keep capabilities" flag. | |
202 | .TP | |
203 | .BR PR_SET_NAME " (since Linux 2.6.9)" | |
204 | Set the process name for the calling process, | |
205 | using the value in the location pointed to by | |
206 | .IR "(char\ *) arg2" . | |
207 | The name can be up to 16 bytes long, | |
208 | .\" TASK_COMM_LEN in include/linux/sched.h | |
bd74a873 | 209 | and should be null-terminated if it contains fewer bytes. |
88989295 MK |
210 | .TP |
211 | .BR PR_GET_NAME " (since Linux 2.6.11)" | |
212 | Return the process name for the calling process, | |
213 | in the buffer pointed to by | |
214 | .IR "(char\ *) arg2" . | |
215 | The buffer should allow space for up to 16 bytes; | |
bd74a873 | 216 | the returned string will be null-terminated if it is shorter than that. |
88989295 MK |
217 | .TP |
218 | .BR PR_SET_PDEATHSIG " (since Linux 2.1.57)" | |
219 | Set the parent process death signal | |
220 | of the calling process to \fIarg2\fP (either a signal value | |
221 | in the range 1..maxsig, or 0 to clear). | |
222 | This is the signal that the calling process will get when its | |
223 | parent dies. | |
224 | This value is cleared for the child of a | |
c7c7235c MK |
225 | .BR fork (2) |
226 | and (since Linux 2.5.36 / 2.6.23) | |
9a830e62 | 227 | when executing a set-user_ID or set-group-ID binary. |
88989295 MK |
228 | .TP |
229 | .BR PR_GET_PDEATHSIG " (since Linux 2.3.15)" | |
230 | Return the current value of the parent process death signal, | |
231 | in the location pointed to by | |
232 | .IR "(int\ *) arg2" . | |
233 | .TP | |
8ab8b43f MK |
234 | .BR PR_SET_SECCOMP " (since Linux 2.6.23)" |
235 | .\" See http://thread.gmane.org/gmane.linux.kernel/542632 | |
236 | .\" [PATCH 0 of 2] seccomp updates | |
237 | .\" andrea@cpushare.com | |
238 | Set the secure computing mode for the calling thread. | |
239 | In the current implementation, | |
240 | .IR arg2 | |
241 | must be 1. | |
242 | After the secure computing mode has been set to 1, | |
243 | the only system calls that the thread is permitted to make are | |
244 | .BR read (2), | |
245 | .BR write (2), | |