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