]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/prctl.2
prctl.2: Minor tweaks to Eugene Syromyatnikov's patch
[thirdparty/man-pages.git] / man2 / prctl.2
1 .\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl)
2 .\" and Copyright (C) 2002, 2006, 2008, 2012, 2013 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" and Copyright Guillem Jover <guillem@hadrons.org>
4 .\" and Copyright (C) 2014 Dave Hansen / Intel
5 .\"
6 .\" %%%LICENSE_START(VERBATIM)
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.
15 .\"
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.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" %%%LICENSE_END
27 .\"
28 .\" Modified Thu Nov 11 04:19:42 MET 1999, aeb: added PR_GET_PDEATHSIG
29 .\" Modified 27 Jun 02, Michael Kerrisk
30 .\" Added PR_SET_DUMPABLE, PR_GET_DUMPABLE,
31 .\" PR_SET_KEEPCAPS, PR_GET_KEEPCAPS
32 .\" Modified 2006-08-30 Guillem Jover <guillem@hadrons.org>
33 .\" Updated Linux versions where the options where introduced.
34 .\" Added PR_SET_TIMING, PR_GET_TIMING, PR_SET_NAME, PR_GET_NAME,
35 .\" PR_SET_UNALIGN, PR_GET_UNALIGN, PR_SET_FPEMU, PR_GET_FPEMU,
36 .\" PR_SET_FPEXC, PR_GET_FPEXC
37 .\" 2008-04-29 Serge Hallyn, Document PR_CAPBSET_READ and PR_CAPBSET_DROP
38 .\" 2008-06-13 Erik Bosman, <ejbosman@cs.vu.nl>
39 .\" Document PR_GET_TSC and PR_SET_TSC.
40 .\" 2008-06-15 mtk, Document PR_SET_SECCOMP, PR_GET_SECCOMP
41 .\" 2009-10-03 Andi Kleen, document PR_MCE_KILL
42 .\" 2012-04 Cyrill Gorcunov, Document PR_SET_MM
43 .\" 2012-04-25 Michael Kerrisk, Document PR_TASK_PERF_EVENTS_DISABLE and
44 .\" PR_TASK_PERF_EVENTS_ENABLE
45 .\" 2012-09-20 Kees Cook, update PR_SET_SECCOMP for mode 2
46 .\" 2012-09-20 Kees Cook, document PR_SET_NO_NEW_PRIVS, PR_GET_NO_NEW_PRIVS
47 .\" 2012-10-25 Michael Kerrisk, Document PR_SET_TIMERSLACK and
48 .\" PR_GET_TIMERSLACK
49 .\" 2013-01-10 Kees Cook, document PR_SET_PTRACER
50 .\" 2012-02-04 Michael Kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER
51 .\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
52 .\"
53 .\"
54 .TH PRCTL 2 2016-07-17 "Linux" "Linux Programmer's Manual"
55 .SH NAME
56 prctl \- operations on a process
57 .SH SYNOPSIS
58 .nf
59 .B #include <sys/prctl.h>
60 .sp
61 .BI "int prctl(int " option ", unsigned long " arg2 ", unsigned long " arg3 ,
62 .BI " unsigned long " arg4 ", unsigned long " arg5 );
63 .fi
64 .SH DESCRIPTION
65 .BR prctl ()
66 is called with a first argument describing what to do
67 (with values defined in \fI<linux/prctl.h>\fP), and further
68 arguments with a significance depending on the first one.
69 The first argument can be:
70 .\"
71 .TP
72 .BR PR_CAP_AMBIENT " (since Linux 4.3)"
73 .\" commit 58319057b7847667f0c9585b9de0e8932b0fdb08
74 Reads or changes the ambient capability set, according to the value of
75 .IR arg2 ,
76 which must be one of the following:
77 .RS
78 .\"
79 .TP
80 .B PR_CAP_AMBIENT_RAISE
81 The capability specified in
82 .I arg3
83 is added to the ambient set.
84 The specified capability must already be present in
85 both the permitted and the inheritable sets of the process.
86 This operation is not permitted if the
87 .B SECBIT_NO_CAP_AMBIENT_RAISE
88 securebit is set.
89 .TP
90 .B PR_CAP_AMBIENT_LOWER
91 The capability specified in
92 .I arg3
93 is removed from the ambient set.
94 .TP
95 .B PR_CAP_AMBIENT_IS_SET
96 The
97 .BR prctl ()
98 call returns 1 if the capability in
99 .I arg3
100 is in the ambient set and 0 if it is not.
101 .TP
102 .BR PR_CAP_AMBIENT_CLEAR_ALL
103 All capabilities will be removed from the ambient set.
104 This operation requires setting
105 .I arg3
106 to zero.
107 .RE
108 .IP
109 In all of the above operations,
110 .I arg4
111 and
112 .I arg5
113 must be specified as 0.
114 .TP
115 .BR PR_CAPBSET_READ " (since Linux 2.6.25)"
116 Return (as the function result) 1 if the capability specified in
117 .I arg2
118 is in the calling thread's capability bounding set,
119 or 0 if it is not.
120 (The capability constants are defined in
121 .IR <linux/capability.h> .)
122 The capability bounding set dictates
123 whether the process can receive the capability through a
124 file's permitted capability set on a subsequent call to
125 .BR execve (2).
126
127 If the capability specified in
128 .I arg2
129 is not valid, then the call fails with the error
130 .BR EINVAL .
131 .TP
132 .BR PR_CAPBSET_DROP " (since Linux 2.6.25)"
133 If the calling thread has the
134 .B CAP_SETPCAP
135 capability within its user namespace, then drop the capability specified by
136 .I arg2
137 from the calling thread's capability bounding set.
138 Any children of the calling thread will inherit the newly
139 reduced bounding set.
140
141 The call fails with the error:
142 .B EPERM
143 if the calling thread does not have the
144 .BR CAP_SETPCAP ;
145 .BR EINVAL
146 if
147 .I arg2
148 does not represent a valid capability; or
149 .BR EINVAL
150 if file capabilities are not enabled in the kernel,
151 in which case bounding sets are not supported.
152 .TP
153 .BR PR_SET_CHILD_SUBREAPER " (since Linux 3.4)"
154 .\" commit ebec18a6d3aa1e7d84aab16225e87fd25170ec2b
155 If
156 .I arg2
157 is nonzero,
158 set the "child subreaper" attribute of the calling process;
159 if
160 .I arg2
161 is zero, unset the attribute.
162
163 When a process is marked as a child subreaper,
164 all of the children that it creates, and their descendants,
165 will be marked as having a subreaper.
166 In effect, a subreaper fulfills the role of
167 .BR init (1)
168 for its descendant processes.
169 Upon termination of a process
170 that is orphaned (i.e., its immediate parent has already terminated)
171 and marked as having a subreaper,
172 the nearest still living ancestor subreaper
173 will receive a
174 .BR SIGCHLD
175 signal and will be able to
176 .BR wait (2)
177 on the process to discover its termination status.
178 .TP
179 .BR PR_GET_CHILD_SUBREAPER " (since Linux 3.4)"
180 Return the "child subreaper" setting of the caller,
181 in the location pointed to by
182 .IR "(int\ *) arg2" .
183 .TP
184 .BR PR_SET_DUMPABLE " (since Linux 2.3.20)"
185 Set the state of the "dumpable" flag,
186 which determines whether core dumps are produced for the calling process
187 upon delivery of a signal whose default behavior is to produce a core dump.
188
189 In kernels up to and including 2.6.12,
190 .I arg2
191 must be either 0
192 .RB ( SUID_DUMP_DISABLE ,
193 process is not dumpable) or 1
194 .RB ( SUID_DUMP_USER ,
195 process is dumpable).
196 Between kernels 2.6.13 and 2.6.17,
197 .\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502
198 the value 2 was also permitted,
199 which caused any binary which normally would not be dumped
200 to be dumped readable by root only;
201 for security reasons, this feature has been removed.
202 .\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2
203 .\" Subject: Fix prctl privilege escalation (CVE-2006-2451)
204 .\" From: Marcel Holtmann <marcel () holtmann ! org>
205 .\" Date: 2006-07-12 11:12:00
206 (See also the description of
207 .I /proc/sys/fs/\:suid_dumpable
208 in
209 .BR proc (5).)
210
211 Normally, this flag is set to 1.
212 However, it is reset to the current value contained in the file
213 .IR /proc/sys/fs/\:suid_dumpable
214 (which by default has the value 0),
215 in the following circumstances:
216 .\" See kernel/cred.c::commit_creds() (Linux 3.18 sources)
217 .RS
218 .IP * 3
219 The process's effective user or group ID is changed.
220 .IP *
221 The process's filesystem user or group ID is changed (see
222 .BR credentials (7)).
223 .IP *
224 The process executes
225 .RB ( execve (2))
226 a set-user-ID or set-group-ID program,
227 or a program that has capabilities (see
228 .BR capabilities (7)).
229 .\" Also certain namespace operations;
230 .RE
231 .IP
232 Processes that are not dumpable can not be attached via
233 .BR ptrace (2)
234 .BR PTRACE_ATTACH ;
235 see
236 .BR ptrace (2)
237 for further details.
238
239 If a process is not dumpable,
240 the ownership of files in the process's
241 .IR /proc/[pid]
242 directory is affected as described in
243 .BR proc (5).
244 .TP
245 .BR PR_GET_DUMPABLE " (since Linux 2.3.20)"
246 Return (as the function result) the current state of the calling
247 process's dumpable flag.
248 .\" Since Linux 2.6.13, the dumpable flag can have the value 2,
249 .\" but in 2.6.13 PR_GET_DUMPABLE simply returns 1 if the dumpable
250 .\" flags has a nonzero value. This was fixed in 2.6.14.
251 .TP
252 .BR PR_SET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
253 Set the endian-ness of the calling process to the value given
254 in \fIarg2\fP, which should be one of the following:
255 .\" Respectively 0, 1, 2
256 .BR PR_ENDIAN_BIG ,
257 .BR PR_ENDIAN_LITTLE ,
258 or
259 .B PR_ENDIAN_PPC_LITTLE
260 (PowerPC pseudo little endian).
261 .TP
262 .BR PR_GET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
263 Return the endian-ness of the calling process,
264 in the location pointed to by
265 .IR "(int\ *) arg2" .
266 .TP
267 .BR PR_SET_FP_MODE " (since Linux 4.0, only on MIPS)"
268 .\" commit 9791554b45a2acc28247f66a5fd5bbc212a6b8c8
269 On the MIPS architecture,
270 user-space code can be built using an ABI which permits linking
271 with code that has more restrictive floating-point (FP) requirements.
272 For example, user-space code may be built to target the O32 FPXX ABI
273 and linked with code built for either one of the more restrictive
274 FP32 or FP64 ABIs.
275 When more restrictive code is linked in,
276 the overall requirement for the process is to use the more
277 restrictive floating-point mode.
278
279 Because the kernel has no means of knowing in advance
280 which mode the process should be executed in,
281 and because these restrictions can
282 change over the lifetime of the process, the
283 .B PR_SET_FP_MODE
284 operation is provided to allow control of the floating-point mode
285 from user space.
286
287 .\" https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
288 The
289 .I (unsigned int) arg2
290 argument is a bit mask describing the floating-point mode used:
291 .RS
292 .TP
293 .BR PR_FP_MODE_FR
294 When this bit is
295 .I unset
296 (so called
297 .BR FR=0 " or " FR0
298 mode), the 32 floating-point registers are 32 bits wide,
299 and 64-bit registers are represented as a pair of registers
300 (even- and odd- numbered,
301 with the even-numbered register containing the lower 32 bits,
302 and the odd-numbered register containing the higher 32 bits).
303
304 When this bit is
305 .I set
306 (on supported hardware),
307 the 32 floating-point registers are 64 bits wide (so called
308 .BR FR=1 " or " FR1
309 mode).
310 Note that modern MIPS implementations (MIPS R6 and newer) support
311 .B FR=1
312 mode only.
313
314
315 Applications that use the O32 FP32 ABI can operate only when this bit is
316 .I unset
317 .RB ( FR=0 ;
318 or they can be used with FRE enabled, see below).
319 Applications that use the O32 FP64 ABI
320 (and the O32 FP64A ABI, which exists to
321 provide the ability to operate with existing FP32 code; see below)
322 can operate only when this bit is
323 .I set
324 .RB ( FR=1 ).
325 Applications that use the O32 FPXX ABI can operate with either
326 .BR FR=0
327 or
328 .BR FR=1 .
329 .TP
330 .BR PR_FP_MODE_FRE
331 Enable emulation of 32-bit floating-point mode.
332 When this mode is enabled,
333 it emulates 32-bit floating-point operations
334 by raising a reserved-instruction exception
335 on every instruction that uses 32-bit formats and
336 the kernel then handles the instruction in software.
337 (The problem lies in the discrepancy of handling odd-numbered registers
338 which are the high 32 bits of 64-bit registers with even numbers in
339 .B FR=0
340 mode and the lower 32-bit parts of odd-numbered 64-bit registers in
341 .B FR=1
342 mode.)
343 Enabling this bit is necessary when code with the O32 FP32 ABI should operate
344 with code with compatible the O32 FPXX or O32 FP64A ABIs (which require
345 .B FR=1
346 FPU mode) or when it is executed on newer hardware (MIPS R6 onwards)
347 which lacks
348 .B FR=0
349 mode support when a binary with the FP32 ABI is used.
350 .IP
351 Note that this mode makes sense only when the FPU is in 64-bit mode
352 .RB ( FR=1 ).
353 .IP
354 Note that the use of emulation inherently has a significant performance hit
355 and should be avoided if possible.
356 .RE
357 .IP
358 In the N32/N64 ABI, 64-bit floating-point mode is always used,
359 so FPU emulation is not required and the FPU always operates in
360 .B FR=1
361 mode.
362 .IP
363 This option is mainly intended for use by the dynamic linker
364 .RB ( ld.so (8)).
365 .IP
366 The arguments
367 .IR arg3 ,
368 .IR arg4 ,
369 and
370 .IR arg5
371 are ignored.
372 .TP
373 .BR PR_GET_FP_MODE " (since Linux 4.0, only on MIPS)"
374 Get the current floating-point mode (see the description of
375 .B PR_SET_FP_MODE
376 for details).
377
378 On success,
379 the call returns a bit mask which represents the current floating-point mode.
380
381 The arguments
382 .IR arg2 ,
383 .IR arg3 ,
384 .IR arg4 ,
385 and
386 .IR arg5
387 are ignored.
388 .TP
389 .BR PR_SET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
390 Set floating-point emulation control bits to \fIarg2\fP.
391 Pass
392 .B PR_FPEMU_NOPRINT
393 to silently emulate floating-point operation accesses, or
394 .B PR_FPEMU_SIGFPE
395 to not emulate floating-point operations and send
396 .B SIGFPE
397 instead.
398 .TP
399 .BR PR_GET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
400 Return floating-point emulation control bits,
401 in the location pointed to by
402 .IR "(int\ *) arg2" .
403 .TP
404 .BR PR_SET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
405 Set floating-point exception mode to \fIarg2\fP.
406 Pass \fBPR_FP_EXC_SW_ENABLE\fP to use FPEXC for FP exception enables,
407 \fBPR_FP_EXC_DIV\fP for floating-point divide by zero,
408 \fBPR_FP_EXC_OVF\fP for floating-point overflow,
409 \fBPR_FP_EXC_UND\fP for floating-point underflow,
410 \fBPR_FP_EXC_RES\fP for floating-point inexact result,
411 \fBPR_FP_EXC_INV\fP for floating-point invalid operation,
412 \fBPR_FP_EXC_DISABLED\fP for FP exceptions disabled,
413 \fBPR_FP_EXC_NONRECOV\fP for async nonrecoverable exception mode,
414 \fBPR_FP_EXC_ASYNC\fP for async recoverable exception mode,
415 \fBPR_FP_EXC_PRECISE\fP for precise exception mode.
416 .TP
417 .BR PR_GET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
418 Return floating-point exception mode,
419 in the location pointed to by
420 .IR "(int\ *) arg2" .
421 .TP
422 .BR PR_SET_KEEPCAPS " (since Linux 2.2.18)"
423 Set the state of the thread's "keep capabilities" flag,
424 which determines whether the thread's permitted
425 capability set is cleared when a change is made to the thread's user IDs
426 such that the thread's real UID, effective UID, and saved set-user-ID
427 all become nonzero when at least one of them previously had the value 0.
428 By default, the permitted capability set is cleared when such a change is made;
429 setting the "keep capabilities" flag prevents it from being cleared.
430 .I arg2
431 must be either 0 (permitted capabilities are cleared)
432 or 1 (permitted capabilities are kept).
433 (A thread's
434 .I effective
435 capability set is always cleared when such a credential change is made,
436 regardless of the setting of the "keep capabilities" flag.)
437 The "keep capabilities" value will be reset to 0 on subsequent calls to
438 .BR execve (2).
439 .TP
440 .BR PR_GET_KEEPCAPS " (since Linux 2.2.18)"
441 Return (as the function result) the current state of the calling thread's
442 "keep capabilities" flag.
443 .TP
444 .BR PR_MCE_KILL " (since Linux 2.6.32)"
445 Set the machine check memory corruption kill policy for the current thread.
446 If
447 .I arg2
448 is
449 .BR PR_MCE_KILL_CLEAR ,
450 clear the thread memory corruption kill policy and use the system-wide default.
451 (The system-wide default is defined by
452 .IR /proc/sys/vm/memory_failure_early_kill ;
453 see
454 .BR proc (5).)
455 If
456 .I arg2
457 is
458 .BR PR_MCE_KILL_SET ,
459 use a thread-specific memory corruption kill policy.
460 In this case,
461 .I arg3
462 defines whether the policy is
463 .I early kill
464 .RB ( PR_MCE_KILL_EARLY ),
465 .I late kill
466 .RB ( PR_MCE_KILL_LATE ),
467 or the system-wide default
468 .RB ( PR_MCE_KILL_DEFAULT ).
469 Early kill means that the thread receives a
470 .B SIGBUS
471 signal as soon as hardware memory corruption is detected inside
472 its address space.
473 In late kill mode, the process is killed only when it accesses a corrupted page.
474 See
475 .BR sigaction (2)
476 for more information on the
477 .BR SIGBUS
478 signal.
479 The policy is inherited by children.
480 The remaining unused
481 .BR prctl ()
482 arguments must be zero for future compatibility.
483 .TP
484 .BR PR_MCE_KILL_GET " (since Linux 2.6.32)"
485 Return the current per-process machine check kill policy.
486 All unused
487 .BR prctl ()
488 arguments must be zero.
489 .TP
490 .BR PR_SET_MM " (since Linux 3.3)"
491 .\" commit 028ee4be34a09a6d48bdf30ab991ae933a7bc036
492 Modify certain kernel memory map descriptor fields
493 of the calling process.
494 Usually these fields are set by the kernel and dynamic loader (see
495 .BR ld.so (8)
496 for more information) and a regular application should not use this feature.
497 However, there are cases, such as self-modifying programs,
498 where a program might find it useful to change its own memory map.
499 This feature is available only if the kernel is built with the
500 .BR CONFIG_CHECKPOINT_RESTORE
501 option enabled.
502 The calling process must have the
503 .BR CAP_SYS_RESOURCE
504 capability.
505 The value in
506 .I arg2
507 is one of the options below, while
508 .I arg3
509 provides a new value for the option.
510 .RS
511 .TP
512 .BR PR_SET_MM_START_CODE
513 Set the address above which the program text can run.
514 The corresponding memory area must be readable and executable,
515 but not writable or sharable (see
516 .BR mprotect (2)
517 and
518 .BR mmap (2)
519 for more information).
520 .TP
521 .BR PR_SET_MM_END_CODE
522 Set the address below which the program text can run.
523 The corresponding memory area must be readable and executable,
524 but not writable or sharable.
525 .TP
526 .BR PR_SET_MM_START_DATA
527 Set the address above which initialized and
528 uninitialized (bss) data are placed.
529 The corresponding memory area must be readable and writable,
530 but not executable or sharable.
531 .TP
532 .B PR_SET_MM_END_DATA
533 Set the address below which initialized and
534 uninitialized (bss) data are placed.
535 The corresponding memory area must be readable and writable,
536 but not executable or sharable.
537 .TP
538 .BR PR_SET_MM_START_STACK
539 Set the start address of the stack.
540 The corresponding memory area must be readable and writable.
541 .TP
542 .BR PR_SET_MM_START_BRK
543 Set the address above which the program heap can be expanded with
544 .BR brk (2)
545 call.
546 The address must be greater than the ending address of
547 the current program data segment.
548 In addition, the combined size of the resulting heap and
549 the size of the data segment can't exceed the
550 .BR RLIMIT_DATA
551 resource limit (see
552 .BR setrlimit (2)).
553 .TP
554 .BR PR_SET_MM_BRK
555 Set the current
556 .BR brk (2)
557 value.
558 The requirements for the address are the same as for the
559 .BR PR_SET_MM_START_BRK
560 option.
561 .P
562 The following options are available since Linux 3.5.
563 .\" commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7
564 .TP
565 .BR PR_SET_MM_ARG_START
566 Set the address above which the program command line is placed.
567 .TP
568 .BR PR_SET_MM_ARG_END
569 Set the address below which the program command line is placed.
570 .TP
571 .BR PR_SET_MM_ENV_START
572 Set the address above which the program environment is placed.
573 .TP
574 .BR PR_SET_MM_ENV_END
575 Set the address below which the program environment is placed.
576 .IP
577 The address passed with
578 .BR PR_SET_MM_ARG_START ,
579 .BR PR_SET_MM_ARG_END ,
580 .BR PR_SET_MM_ENV_START ,
581 and
582 .BR PR_SET_MM_ENV_END
583 should belong to a process stack area.
584 Thus, the corresponding memory area must be readable, writable, and
585 (depending on the kernel configuration) have the
586 .BR MAP_GROWSDOWN
587 attribute set (see
588 .BR mmap (2)).
589 .TP
590 .BR PR_SET_MM_AUXV
591 Set a new auxiliary vector.
592 The
593 .I arg3
594 argument should provide the address of the vector.
595 The
596 .I arg4
597 is the size of the vector.
598 .TP
599 .BR PR_SET_MM_EXE_FILE
600 .\" commit b32dfe377102ce668775f8b6b1461f7ad428f8b6
601 Supersede the
602 .IR /proc/pid/exe
603 symbolic link with a new one pointing to a new executable file
604 identified by the file descriptor provided in
605 .I arg3
606 argument.
607 The file descriptor should be obtained with a regular
608 .BR open (2)
609 call.
610 .IP
611 To change the symbolic link, one needs to unmap all existing
612 executable memory areas, including those created by the kernel itself
613 (for example the kernel usually creates at least one executable
614 memory area for the ELF
615 .IR \.text
616 section).
617 .IP
618 The second limitation is that such transitions can be done only once
619 in a process life time.
620 Any further attempts will be rejected.
621 This should help system administrators monitor unusual
622 symbolic-link transitions over all processes running on a system.
623 .RE
624 .TP
625 .BR PR_MPX_ENABLE_MANAGEMENT ", " PR_MPX_DISABLE_MANAGEMENT " (since Linux 3.19) "
626 .\" commit fe3d197f84319d3bce379a9c0dc17b1f48ad358c
627 .\" See also http://lwn.net/Articles/582712/
628 .\" See also https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
629 Enable or disable kernel management of Memory Protection eXtensions (MPX)
630 bounds tables.
631 The
632 .IR arg2 ,
633 .IR arg3 ,
634 .IR arg4 ,
635 and
636 .IR arg5
637 .\" commit e9d1b4f3c60997fe197bf0243cb4a41a44387a88
638 arguments must be zero.
639
640 MPX is a hardware-assisted mechanism for performing bounds checking on
641 pointers.
642 It consists of a set of registers storing bounds information
643 and a set of special instruction prefixes that tell the CPU on which
644 instructions it should do bounds enforcement.
645 There is a limited number of these registers and
646 when there are more pointers than registers,
647 their contents must be "spilled" into a set of tables.
648 These tables are called "bounds tables" and the MPX
649 .BR prctl ()
650 operations control
651 whether the kernel manages their allocation and freeing.
652
653 When management is enabled, the kernel will take over allocation
654 and freeing of the bounds tables.
655 It does this by trapping the #BR exceptions that result
656 at first use of missing bounds tables and
657 instead of delivering the exception to user space,
658 it allocates the table and populates the bounds directory
659 with the location of the new table.
660 For freeing, the kernel checks to see if bounds tables are
661 present for memory which is not allocated, and frees them if so.
662
663 Before enabling MPX management using
664 .BR PR_MPX_ENABLE_MANAGEMENT ,
665 the application must first have allocated a user-space buffer for
666 the bounds directory and placed the location of that directory in the
667 .I bndcfgu
668 register.
669
670 These calls will fail if the CPU or kernel does not support MPX.
671 Kernel support for MPX is enabled via the
672 .BR CONFIG_X86_INTEL_MPX
673 configuration option.
674 You can check whether the CPU supports MPX by looking for the 'mpx'
675 CPUID bit, like with the following command:
676
677 cat /proc/cpuinfo | grep ' mpx '
678
679 A thread may not switch in or out of long (64-bit) mode while MPX is
680 enabled.
681
682 All threads in a process are affected by these calls.
683
684 The child of a
685 .BR fork (2)
686 inherits the state of MPX management.
687 During
688 .BR execve (2),
689 MPX management is reset to a state as if
690 .BR PR_MPX_DISABLE_MANAGEMENT
691 had been called.
692
693 For further information on Intel MPX, see the kernel source file
694 .IR Documentation/x86/intel_mpx.txt .
695 .TP
696 .BR PR_SET_NAME " (since Linux 2.6.9)"
697 Set the name of the calling thread,
698 using the value in the location pointed to by
699 .IR "(char\ *) arg2" .
700 The name can be up to 16 bytes long,
701 .\" TASK_COMM_LEN in include/linux/sched.h
702 including the terminating null byte.
703 (If the length of the string, including the terminating null byte,
704 exceeds 16 bytes, the string is silently truncated.)
705 This is the same attribute that can be set via
706 .BR pthread_setname_np (3)
707 and retrieved using
708 .BR pthread_getname_np (3).
709 The attribute is likewise accessible via
710 .IR /proc/self/task/[tid]/comm ,
711 where
712 .I tid
713 is the name of the calling thread.
714 .TP
715 .BR PR_GET_NAME " (since Linux 2.6.11)"
716 Return the name of the calling thread,
717 in the buffer pointed to by
718 .IR "(char\ *) arg2" .
719 The buffer should allow space for up to 16 bytes;
720 the returned string will be null-terminated.
721 .TP
722 .BR PR_SET_NO_NEW_PRIVS " (since Linux 3.5)"
723 Set the calling process's
724 .I no_new_privs
725 bit to the value in
726 .IR arg2 .
727 With
728 .I no_new_privs
729 set to 1,
730 .BR execve (2)
731 promises not to grant privileges to do anything
732 that could not have been done without the
733 .BR execve (2)
734 call (for example,
735 rendering the set-user-ID and set-group-ID mode bits,
736 and file capabilities non-functional).
737 Once set, this bit cannot be unset.
738 The setting of this bit is inherited by children created by
739 .BR fork (2)
740 and
741 .BR clone (2),
742 and preserved across
743 .BR execve (2).
744
745 For more information, see the kernel source file
746 .IR Documentation/prctl/no_new_privs.txt .
747 .TP
748 .BR PR_GET_NO_NEW_PRIVS " (since Linux 3.5)"
749 Return (as the function result) the value of the
750 .I no_new_privs
751 bit for the current process.
752 A value of 0 indicates the regular
753 .BR execve (2)
754 behavior.
755 A value of 1 indicates
756 .BR execve (2)
757 will operate in the privilege-restricting mode described above.
758 .TP
759 .BR PR_SET_PDEATHSIG " (since Linux 2.1.57)"
760 Set the parent death signal
761 of the calling process to \fIarg2\fP (either a signal value
762 in the range 1..maxsig, or 0 to clear).
763 This is the signal that the calling process will get when its
764 parent dies.
765 This value is cleared for the child of a
766 .BR fork (2)
767 and (since Linux 2.4.36 / 2.6.23)
768 when executing a set-user-ID or set-group-ID binary,
769 or a binary that has associated capabilities (see
770 .BR capabilities (7)).
771 This value is preserved across
772 .BR execve (2).
773
774 .IR Warning :
775 .\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
776 the "parent" in this case is considered to be the
777 .I thread
778 that created this process.
779 In other words, the signal will be sent when that thread terminates
780 (via, for example,
781 .BR pthread_exit (3)),
782 rather than after all of the threads in the parent process terminate.
783 .TP
784 .BR PR_GET_PDEATHSIG " (since Linux 2.3.15)"
785 Return the current value of the parent process death signal,
786 in the location pointed to by
787 .IR "(int\ *) arg2" .
788 .TP
789 .BR PR_SET_PTRACER " (since Linux 3.4)"
790 .\" commit 2d514487faf188938a4ee4fb3464eeecfbdcf8eb
791 .\" commit bf06189e4d14641c0148bea16e9dd24943862215
792 This is meaningful only when the Yama LSM is enabled and in mode 1
793 ("restricted ptrace", visible via
794 .IR /proc/sys/kernel/yama/ptrace_scope ).
795 When a "ptracer process ID" is passed in \fIarg2\fP,
796 the caller is declaring that the ptracer process can
797 .BR ptrace (2)
798 the calling process as if it were a direct process ancestor.
799 Each
800 .B PR_SET_PTRACER
801 operation replaces the previous "ptracer process ID".
802 Employing
803 .B PR_SET_PTRACER
804 with
805 .I arg2
806 set to 0 clears the caller's "ptracer process ID".
807 If
808 .I arg2
809 is
810 .BR PR_SET_PTRACER_ANY ,
811 the ptrace restrictions introduced by Yama are effectively disabled for the
812 calling process.
813
814 For further information, see the kernel source file
815 .IR Documentation/security/Yama.txt .
816 .TP
817 .BR PR_SET_SECCOMP " (since Linux 2.6.23)"
818 .\" See http://thread.gmane.org/gmane.linux.kernel/542632
819 .\" [PATCH 0 of 2] seccomp updates
820 .\" andrea@cpushare.com
821 Set the secure computing (seccomp) mode for the calling thread, to limit
822 the available system calls.
823 The more recent
824 .BR seccomp (2)
825 system call provides a superset of the functionality of
826 .BR PR_SET_SECCOMP .
827
828 The seccomp mode is selected via
829 .IR arg2 .
830 (The seccomp constants are defined in
831 .IR <linux/seccomp.h> .)
832
833 With
834 .IR arg2
835 set to
836 .BR SECCOMP_MODE_STRICT ,
837 the only system calls that the thread is permitted to make are
838 .BR read (2),
839 .BR write (2),
840 .BR _exit (2)
841 (but not
842 .BR exit_group (2)),
843 and
844 .BR sigreturn (2).
845 Other system calls result in the delivery of a
846 .BR SIGKILL
847 signal.
848 Strict secure computing mode is useful for number-crunching applications
849 that may need to execute untrusted byte code,
850 perhaps obtained by reading from a pipe or socket.
851 This operation is available only
852 if the kernel is configured with
853 .B CONFIG_SECCOMP
854 enabled.
855
856 With
857 .IR arg2
858 set to
859 .BR SECCOMP_MODE_FILTER " (since Linux 3.5),"
860 the system calls allowed are defined by a pointer
861 to a Berkeley Packet Filter passed in
862 .IR arg3 .
863 This argument is a pointer to
864 .IR "struct sock_fprog" ;
865 it can be designed to filter
866 arbitrary system calls and system call arguments.
867 This mode is available only if the kernel is configured with
868 .B CONFIG_SECCOMP_FILTER
869 enabled.
870
871 If
872 .BR SECCOMP_MODE_FILTER
873 filters permit
874 .BR fork (2),
875 then the seccomp mode is inherited by children created by
876 .BR fork (2);
877 if
878 .BR execve (2)
879 is permitted, then the seccomp mode is preserved across
880 .BR execve (2).
881 If the filters permit
882 .BR prctl ()
883 calls, then additional filters can be added;
884 they are run in order until the first non-allow result is seen.
885
886 For further information, see the kernel source file
887 .IR Documentation/prctl/seccomp_filter.txt .
888 .TP
889 .BR PR_GET_SECCOMP " (since Linux 2.6.23)"
890 Return (as the function result)
891 the secure computing mode of the calling thread.
892 If the caller is not in secure computing mode, this operation returns 0;
893 if the caller is in strict secure computing mode, then the
894 .BR prctl ()
895 call will cause a
896 .B SIGKILL
897 signal to be sent to the process.
898 If the caller is in filter mode, and this system call is allowed by the
899 seccomp filters, it returns 2; otherwise, the process is killed with a
900 .BR SIGKILL
901 signal.
902 This operation is available only
903 if the kernel is configured with
904 .B CONFIG_SECCOMP
905 enabled.
906
907 Since Linux 3.8, the
908 .IR Seccomp
909 field of the
910 .IR /proc/[pid]/status
911 file provides a method of obtaining the same information,
912 without the risk that the process is killed; see
913 .BR proc (5).
914 .TP
915 .BR PR_SET_SECUREBITS " (since Linux 2.6.26)"
916 Set the "securebits" flags of the calling thread to the value supplied in
917 .IR arg2 .
918 See
919 .BR capabilities (7).
920 .TP
921 .BR PR_GET_SECUREBITS " (since Linux 2.6.26)"
922 Return (as the function result)
923 the "securebits" flags of the calling thread.
924 See
925 .BR capabilities (7).
926 .TP
927 .BR PR_SET_THP_DISABLE " (since Linux 3.15)"
928 .\" commit a0715cc22601e8830ace98366c0c2bd8da52af52
929 Set the state of the "THP disable" flag for the calling thread.
930 If
931 .I arg2
932 has a nonzero value, the flag is set, otherwise it is cleared.
933 Setting this flag provides a method
934 for disabling transparent huge pages
935 for jobs where the code cannot be modified, and using a malloc hook with
936 .BR madvise (2)
937 is not an option (i.e., statically allocated data).
938 The setting of the "THP disable" flag is inherited by a child created via
939 .BR fork (2)
940 and is preserved across
941 .BR execve (2).
942 .\"
943 .TP
944 .BR PR_TASK_PERF_EVENTS_DISABLE " (since Linux 2.6.31)"
945 Disable all performance counters attached to the calling process,
946 regardless of whether the counters were created by
947 this process or another process.
948 Performance counters created by the calling process for other
949 processes are unaffected.
950 For more information on performance counters, see the Linux kernel source file
951 .IR tools/perf/design.txt .
952 .IP
953 Originally called
954 .BR PR_TASK_PERF_COUNTERS_DISABLE ;
955 .\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
956 renamed (with same numerical value)
957 in Linux 2.6.32.
958 .\"
959 .TP
960 .BR PR_TASK_PERF_EVENTS_ENABLE " (since Linux 2.6.31)"
961 The converse of
962 .BR PR_TASK_PERF_EVENTS_DISABLE ;
963 enable performance counters attached to the calling process.
964 .IP
965 Originally called
966 .BR PR_TASK_PERF_COUNTERS_ENABLE ;
967 .\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
968 renamed
969 .\" commit cdd6c482c9ff9c55475ee7392ec8f672eddb7be6
970 in Linux 2.6.32.
971 .\"
972 .TP
973 .BR PR_GET_THP_DISABLE " (since Linux 3.15)"
974 Return (via the function result) the current setting of the "THP disable"
975 flag for the calling thread:
976 either 1, if the flag is set, or 0, if it is not.
977 .TP
978 .BR PR_GET_TID_ADDRESS " (since Linux 3.5)"
979 .\" commit 300f786b2683f8bb1ec0afb6e1851183a479c86d
980 Retrieve the
981 .I clear_child_tid
982 address set by
983 .BR set_tid_address (2)
984 and the
985 .BR clone (2)
986 .B CLONE_CHILD_CLEARTID
987 flag, in the location pointed to by
988 .IR "(int\ **)\ arg2" .
989 This feature is available only if the kernel is built with the
990 .BR CONFIG_CHECKPOINT_RESTORE
991 option enabled.
992 Note that since the
993 .BR prctl ()
994 system call does not have a compat implementation for
995 the AMD64 x32 and MIPS n32 ABIs,
996 and the kernel writes out a pointer using the kernel's pointer size,
997 this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs.
998 .TP
999 .BR PR_SET_TIMERSLACK " (since Linux 2.6.28)"
1000 .\" See https://lwn.net/Articles/369549/
1001 .\" commit 6976675d94042fbd446231d1bd8b7de71a980ada
1002 Each thread has two associated timer slack values:
1003 a "default" value, and a "current" value.
1004 This operation sets the "current" timer slack value for the calling thread.
1005 If the nanosecond value supplied in
1006 .IR arg2
1007 is greater than zero, then the "current" value is set to this value.
1008 If
1009 .I arg2
1010 is less than or equal to zero,
1011 .\" It seems that it's not possible to set the timer slack to zero;
1012 .\" The minimum value is 1? Seems a little strange.
1013 the "current" timer slack is reset to the
1014 thread's "default" timer slack value.
1015
1016 The "current" timer slack is used by the kernel to group timer expirations
1017 for the calling thread that are close to one another;
1018 as a consequence, timer expirations for the thread may be
1019 up to the specified number of nanoseconds late (but will never expire early).
1020 Grouping timer expirations can help reduce system power consumption
1021 by minimizing CPU wake-ups.
1022
1023 The timer expirations affected by timer slack are those set by
1024 .BR select (2),
1025 .BR pselect (2),
1026 .BR poll (2),
1027 .BR ppoll (2),
1028 .BR epoll_wait (2),
1029 .BR epoll_pwait (2),
1030 .BR clock_nanosleep (2),
1031 .BR nanosleep (2),
1032 and
1033 .BR futex (2)
1034 (and thus the library functions implemented via futexes, including
1035 .\" List obtained by grepping for futex usage in glibc source
1036 .BR pthread_cond_timedwait (3),
1037 .BR pthread_mutex_timedlock (3),
1038 .BR pthread_rwlock_timedrdlock (3),
1039 .BR pthread_rwlock_timedwrlock (3),
1040 and
1041 .BR sem_timedwait (3)).
1042
1043 Timer slack is not applied to threads that are scheduled under
1044 a real-time scheduling policy (see
1045 .BR sched_setscheduler (2)).
1046
1047 When a new thread is created,
1048 the two timer slack values are made the same as the "current" value
1049 of the creating thread.
1050 Thereafter, a thread can adjust its "current" timer slack value via
1051 .BR PR_SET_TIMERSLACK .
1052 The "default" value can't be changed.
1053 The timer slack values of
1054 .IR init
1055 (PID 1), the ancestor of all processes,
1056 are 50,000 nanoseconds (50 microseconds).
1057 The timer slack values are preserved across
1058 .BR execve (2).
1059
1060 Since Linux 4.6, the "current" timer slack value of any process
1061 can be examined and changed via the file
1062 .IR /proc/[pid]/timerslack_ns .
1063 See
1064 .BR proc (5).
1065 .TP
1066 .BR PR_GET_TIMERSLACK " (since Linux 2.6.28)"
1067 Return (as the function result)
1068 the "current" timer slack value of the calling thread.
1069 .TP
1070 .BR PR_SET_TIMING " (since Linux 2.6.0-test4)"
1071 Set whether to use (normal, traditional) statistical process timing or
1072 accurate timestamp-based process timing, by passing
1073 .B PR_TIMING_STATISTICAL
1074 .\" 0
1075 or
1076 .B PR_TIMING_TIMESTAMP
1077 .\" 1
1078 to \fIarg2\fP.
1079 .B PR_TIMING_TIMESTAMP
1080 is not currently implemented
1081 (attempting to set this mode will yield the error
1082 .BR EINVAL ).
1083 .\" PR_TIMING_TIMESTAMP doesn't do anything in 2.6.26-rc8,
1084 .\" and looking at the patch history, it appears
1085 .\" that it never did anything.
1086 .TP
1087 .BR PR_GET_TIMING " (since Linux 2.6.0-test4)"
1088 Return (as the function result) which process timing method is currently
1089 in use.
1090 .TP
1091 .BR PR_SET_TSC " (since Linux 2.6.26, x86 only)"
1092 Set the state of the flag determining whether the timestamp counter
1093 can be read by the process.
1094 Pass
1095 .B PR_TSC_ENABLE
1096 to
1097 .I arg2
1098 to allow it to be read, or
1099 .B PR_TSC_SIGSEGV
1100 to generate a
1101 .B SIGSEGV
1102 when the process tries to read the timestamp counter.
1103 .TP
1104 .BR PR_GET_TSC " (since Linux 2.6.26, x86 only)"
1105 Return the state of the flag determining whether the timestamp counter
1106 can be read,
1107 in the location pointed to by
1108 .IR "(int\ *) arg2" .
1109 .TP
1110 .B PR_SET_UNALIGN
1111 (Only on: ia64, since Linux 2.3.48; parisc, since Linux 2.6.15;
1112 PowerPC, since Linux 2.6.18; Alpha, since Linux 2.6.22;
1113 .\" sh: 94ea5e449ae834af058ef005d16a8ad44fcf13d6
1114 .\" tile: 2f9ac29eec71a696cb0dcc5fb82c0f8d4dac28c9
1115 sh, since Linux 2.6.34; tile, since Linux 3.12)
1116 Set unaligned access control bits to \fIarg2\fP.
1117 Pass
1118 \fBPR_UNALIGN_NOPRINT\fP to silently fix up unaligned user accesses,
1119 or \fBPR_UNALIGN_SIGBUS\fP to generate
1120 .B SIGBUS
1121 on unaligned user access.
1122 Alpha also supports an additional flag with the value
1123 of 4 and no corresponding named constant,
1124 which instructs kernel to not fix up
1125 unaligned accesses (it is analogous to providing the
1126 .BR UAC_NOFIX
1127 flag in
1128 .BR SSI_NVPAIRS
1129 operation of the
1130 .BR setsysinfo ()
1131 system call on Tru64).
1132 .TP
1133 .B PR_GET_UNALIGN
1134 (see
1135 .B PR_SET_UNALIGN
1136 for information on versions and architectures)
1137 Return unaligned access control bits, in the location pointed to by
1138 .IR "(unsigned int\ *) arg2" .
1139 .SH RETURN VALUE
1140 On success,
1141 .BR PR_GET_DUMPABLE ,
1142 .BR PR_GET_KEEPCAPS ,
1143 .BR PR_GET_NO_NEW_PRIVS ,
1144 .BR PR_GET_THP_DISABLE ,
1145 .BR PR_CAPBSET_READ ,
1146 .BR PR_GET_TIMING ,
1147 .BR PR_GET_TIMERSLACK ,
1148 .BR PR_GET_SECUREBITS ,
1149 .BR PR_MCE_KILL_GET ,
1150 .BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
1151 and (if it returns)
1152 .BR PR_GET_SECCOMP
1153 return the nonnegative values described above.
1154 All other
1155 .I option
1156 values return 0 on success.
1157 On error, \-1 is returned, and
1158 .I errno
1159 is set appropriately.
1160 .SH ERRORS
1161 .TP
1162 .B EACCES
1163 .I option
1164 is
1165 .BR PR_SET_SECCOMP
1166 and
1167 .I arg2
1168 is
1169 .BR SECCOMP_MODE_FILTER ,
1170 but the process does not have the
1171 .BR CAP_SYS_ADMIN
1172 capability or has not set the
1173 .IR no_new_privs
1174 attribute (see the discussion of
1175 .BR PR_SET_NO_NEW_PRIVS
1176 above).
1177 .TP
1178 .B EACCES
1179 .I option
1180 is
1181 .BR PR_SET_MM ,
1182 and
1183 .I arg3
1184 is
1185 .BR PR_SET_MM_EXE_FILE ,
1186 the file is not executable.
1187 .TP
1188 .B EBADF
1189 .I option
1190 is
1191 .BR PR_SET_MM ,
1192 .I arg3
1193 is
1194 .BR PR_SET_MM_EXE_FILE ,
1195 and the file descriptor passed in
1196 .I arg4
1197 is not valid.
1198 .TP
1199 .B EBUSY
1200 .I option
1201 is
1202 .BR PR_SET_MM ,
1203 .I arg3
1204 is
1205 .BR PR_SET_MM_EXE_FILE ,
1206 and this the second attempt to change the
1207 .I /proc/pid/exe
1208 symbolic link, which is prohibited.
1209 .TP
1210 .B EFAULT
1211 .I arg2
1212 is an invalid address.
1213 .TP
1214 .B EFAULT
1215 .I option
1216 is
1217 .BR PR_SET_SECCOMP ,
1218 .I arg2
1219 is
1220 .BR SECCOMP_MODE_FILTER ,
1221 the system was built with
1222 .BR CONFIG_SECCOMP_FILTER ,
1223 and
1224 .I arg3
1225 is an invalid address.
1226 .TP
1227 .B EINVAL
1228 The value of
1229 .I option
1230 is not recognized.
1231 .TP
1232 .B EINVAL
1233 .I option
1234 is
1235 .BR PR_MCE_KILL
1236 or
1237 .BR PR_MCE_KILL_GET
1238 or
1239 .BR PR_SET_MM ,
1240 and unused
1241 .BR prctl ()
1242 arguments were not specified as zero.
1243 .TP
1244 .B EINVAL
1245 .I arg2
1246 is not valid value for this
1247 .IR option .
1248 .TP
1249 .B EINVAL
1250 .I option
1251 is
1252 .BR PR_SET_SECCOMP
1253 or
1254 .BR PR_GET_SECCOMP ,
1255 and the kernel was not configured with
1256 .BR CONFIG_SECCOMP .
1257 .TP
1258 .B EINVAL
1259 .I option
1260 is
1261 .BR PR_SET_SECCOMP ,
1262 .I arg2
1263 is
1264 .BR SECCOMP_MODE_FILTER ,
1265 and the kernel was not configured with
1266 .BR CONFIG_SECCOMP_FILTER .
1267 .TP
1268 .B EINVAL
1269 .I option
1270 is
1271 .BR PR_SET_MM ,
1272 and one of the following is true
1273 .RS
1274 .IP * 3
1275 .I arg4
1276 or
1277 .I arg5
1278 is nonzero;
1279 .IP *
1280 .I arg3
1281 is greater than
1282 .B TASK_SIZE
1283 (the limit on the size of the user address space for this architecture);
1284 .IP *
1285 .I arg2
1286 is
1287 .BR PR_SET_MM_START_CODE ,
1288 .BR PR_SET_MM_END_CODE ,
1289 .BR PR_SET_MM_START_DATA ,
1290 .BR PR_SET_MM_END_DATA ,
1291 or
1292 .BR PR_SET_MM_START_STACK ,
1293 and the permissions of the corresponding memory area are not as required;
1294 .IP *
1295 .I arg2
1296 is
1297 .BR PR_SET_MM_START_BRK
1298 or
1299 .BR PR_SET_MM_BRK ,
1300 and
1301 .I arg3
1302 is less than or equal to the end of the data segment
1303 or specifies a value that would cause the
1304 .B RLIMIT_DATA
1305 resource limit to be exceeded.
1306 .RE
1307 .TP
1308 .B EINVAL
1309 .I option
1310 is
1311 .BR PR_SET_PTRACER
1312 and
1313 .I arg2
1314 is not 0,
1315 .BR PR_SET_PTRACER_ANY ,
1316 or the PID of an existing process.
1317 .TP
1318 .B EINVAL
1319 .I option
1320 is
1321 .B PR_SET_PDEATHSIG
1322 and
1323 .I arg2
1324 is not a valid signal number.
1325 .TP
1326 .B EINVAL
1327 .I option
1328 is
1329 .BR PR_SET_DUMPABLE
1330 and
1331 .I arg2
1332 is neither
1333 .B SUID_DUMP_DISABLE
1334 nor
1335 .BR SUID_DUMP_USER .
1336 .TP
1337 .B EINVAL
1338 .I option
1339 is
1340 .BR PR_SET_TIMING
1341 and
1342 .I arg2
1343 is not
1344 .BR PR_TIMING_STATISTICAL .
1345 .TP
1346 .B EINVAL
1347 .I option
1348 is
1349 .BR PR_SET_NO_NEW_PRIVS
1350 and
1351 .I arg2
1352 is not equal to 1
1353 or
1354 .IR arg3 ,
1355 .IR arg4 ,
1356 or
1357 .IR arg5
1358 is nonzero.
1359 .TP
1360 .B EINVAL
1361 .I option
1362 is
1363 .BR PR_GET_NO_NEW_PRIVS
1364 and
1365 .IR arg2 ,
1366 .IR arg3 ,
1367 .IR arg4 ,
1368 or
1369 .IR arg5
1370 is nonzero.
1371 .TP
1372 .B EINVAL
1373 .I option
1374 is
1375 .BR PR_SET_THP_DISABLE
1376 and
1377 .IR arg3 ,
1378 .IR arg4 ,
1379 or
1380 .IR arg5
1381 is nonzero.
1382 .TP
1383 .B EINVAL
1384 .I option
1385 is
1386 .BR PR_GET_THP_DISABLE
1387 and
1388 .IR arg2 ,
1389 .IR arg3 ,
1390 .IR arg4 ,
1391 or
1392 .IR arg5
1393 is nonzero.
1394 .TP
1395 .B EINVAL
1396 .I option
1397 is
1398 .B PR_CAP_AMBIENT
1399 and an unused argument
1400 .RI ( arg4 ,
1401 .IR arg5 ,
1402 or,
1403 in the case of
1404 .BR PR_CAP_AMBIENT_CLEAR_ALL ,
1405 .IR arg3 )
1406 is nonzero; or
1407 .IR arg2
1408 has an invalid value;
1409 or
1410 .IR arg2
1411 is
1412 .BR PR_CAP_AMBIENT_LOWER ,
1413 .BR PR_CAP_AMBIENT_RAISE ,
1414 or
1415 .BR PR_CAP_AMBIENT_IS_SET
1416 and
1417 .IR arg3
1418 does not specify a valid capability.
1419 .TP
1420 .B ENXIO
1421 .I option
1422 was
1423 .BR PR_MPX_ENABLE_MANAGEMENT
1424 or
1425 .BR PR_MPX_DISABLE_MANAGEMENT
1426 and the kernel or the CPU does not support MPX management.
1427 Check that the kernel and processor have MPX support.
1428 .TP
1429 .B EOPNOTSUPP
1430 .I option
1431 is
1432 .B PR_SET_FP_MODE
1433 and
1434 .I arg2
1435 has an invalid or unsupported value.
1436 .TP
1437 .B EPERM
1438 .I option
1439 is
1440 .BR PR_SET_SECUREBITS ,
1441 and the caller does not have the
1442 .B CAP_SETPCAP
1443 capability,
1444 or tried to unset a "locked" flag,
1445 or tried to set a flag whose corresponding locked flag was set
1446 (see
1447 .BR capabilities (7)).
1448 .TP
1449 .B EPERM
1450 .I option
1451 is
1452 .BR PR_SET_KEEPCAPS ,
1453 and the caller's
1454 .B SECURE_KEEP_CAPS_LOCKED
1455 flag is set
1456 (see
1457 .BR capabilities (7)).
1458 .TP
1459 .B EPERM
1460 .I option
1461 is
1462 .BR PR_CAPBSET_DROP ,
1463 and the caller does not have the
1464 .B CAP_SETPCAP
1465 capability.
1466 .TP
1467 .B EPERM
1468 .I option
1469 is
1470 .BR PR_SET_MM ,
1471 and the caller does not have the
1472 .B CAP_SYS_RESOURCE
1473 capability.
1474 .TP
1475 .B EPERM
1476 .IR option
1477 is
1478 .BR PR_CAP_AMBIENT
1479 and
1480 .IR arg2
1481 is
1482 .BR PR_CAP_AMBIENT_RAISE ,
1483 but either the capability specified in
1484 .IR arg3
1485 is not present in the process's permitted and inheritable capability sets,
1486 or the
1487 .B PR_CAP_AMBIENT_LOWER
1488 securebit has been set.
1489 .SH VERSIONS
1490 The
1491 .BR prctl ()
1492 system call was introduced in Linux 2.1.57.
1493 .\" The library interface was added in glibc 2.0.6
1494 .SH CONFORMING TO
1495 This call is Linux-specific.
1496 IRIX has a
1497 .BR prctl ()
1498 system call (also introduced in Linux 2.1.44
1499 as irix_prctl on the MIPS architecture),
1500 with prototype
1501 .sp
1502 .BI "ptrdiff_t prctl(int " option ", int " arg2 ", int " arg3 );
1503 .sp
1504 and options to get the maximum number of processes per user,
1505 get the maximum number of processors the calling process can use,
1506 find out whether a specified process is currently blocked,
1507 get or set the maximum stack size, and so on.
1508 .SH SEE ALSO
1509 .BR signal (2),
1510 .BR core (5)