1 .\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl)
2 .\" and Copyright (C) 2002, 2006, 2008, 2012, 2013, 2015 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" and Copyright Guillem Jover <guillem@hadrons.org>
4 .\" and Copyright (C) 2010 Andi Kleen <andi@firstfloor.org>
5 .\" and Copyright (C) 2012 Cyrill Gorcunov <gorcunov@openvz.org>
6 .\" and Copyright (C) 2014 Dave Hansen / Intel
7 .\" and Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
8 .\" and Copyright (c) 2018 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 .\" and Copyright (c) 2020 Dave Martin <Dave.Martin@arm.com>
11 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
13 .\" Modified Thu Nov 11 04:19:42 MET 1999, aeb: added PR_GET_PDEATHSIG
14 .\" Modified 27 Jun 02, Michael Kerrisk
15 .\" Added PR_SET_DUMPABLE, PR_GET_DUMPABLE,
16 .\" PR_SET_KEEPCAPS, PR_GET_KEEPCAPS
17 .\" Modified 2006-08-30 Guillem Jover <guillem@hadrons.org>
18 .\" Updated Linux versions where the options where introduced.
19 .\" Added PR_SET_TIMING, PR_GET_TIMING, PR_SET_NAME, PR_GET_NAME,
20 .\" PR_SET_UNALIGN, PR_GET_UNALIGN, PR_SET_FPEMU, PR_GET_FPEMU,
21 .\" PR_SET_FPEXC, PR_GET_FPEXC
22 .\" 2008-04-29 Serge Hallyn, Document PR_CAPBSET_READ and PR_CAPBSET_DROP
23 .\" 2008-06-13 Erik Bosman, <ejbosman@cs.vu.nl>
24 .\" Document PR_GET_TSC and PR_SET_TSC.
25 .\" 2008-06-15 mtk, Document PR_SET_SECCOMP, PR_GET_SECCOMP
26 .\" 2009-10-03 Andi Kleen, document PR_MCE_KILL
27 .\" 2012-04 Cyrill Gorcunov, Document PR_SET_MM
28 .\" 2012-04-25 Michael Kerrisk, Document PR_TASK_PERF_EVENTS_DISABLE and
29 .\" PR_TASK_PERF_EVENTS_ENABLE
30 .\" 2012-09-20 Kees Cook, update PR_SET_SECCOMP for mode 2
31 .\" 2012-09-20 Kees Cook, document PR_SET_NO_NEW_PRIVS, PR_GET_NO_NEW_PRIVS
32 .\" 2012-10-25 Michael Kerrisk, Document PR_SET_TIMERSLACK and
34 .\" 2013-01-10 Kees Cook, document PR_SET_PTRACER
35 .\" 2012-02-04 Michael Kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER
36 .\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
39 .TH PRCTL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
41 prctl \- operations on a process or thread
44 .RI ( libc ", " \-lc )
47 .B #include <sys/prctl.h>
49 .BI "int prctl(int " option ", unsigned long " arg2 ", unsigned long " arg3 ,
50 .BI " unsigned long " arg4 ", unsigned long " arg5 );
54 manipulates various aspects of the behavior
55 of the calling thread or process.
57 Note that careless use of some
59 operations can confuse the user-space run-time environment,
60 so these operations should be used with care.
63 is called with a first argument describing what to do
64 (with values defined in \fI<linux/prctl.h>\fP), and further
65 arguments with a significance depending on the first one.
66 The first argument can be:
68 .\" prctl PR_CAP_AMBIENT
70 .BR PR_CAP_AMBIENT " (since Linux 4.3)"
71 .\" commit 58319057b7847667f0c9585b9de0e8932b0fdb08
72 Reads or changes the ambient capability set of the calling thread,
73 according to the value of
75 which must be one of the following:
79 .B PR_CAP_AMBIENT_RAISE
80 The capability specified in
82 is added to the ambient set.
83 The specified capability must already be present in
84 both the permitted and the inheritable sets of the process.
85 This operation is not permitted if the
86 .B SECBIT_NO_CAP_AMBIENT_RAISE
89 .B PR_CAP_AMBIENT_LOWER
90 The capability specified in
92 is removed from the ambient set.
94 .B PR_CAP_AMBIENT_IS_SET
97 call returns 1 if the capability in
99 is in the ambient set and 0 if it is not.
101 .BR PR_CAP_AMBIENT_CLEAR_ALL
102 All capabilities will be removed from the ambient set.
103 This operation requires setting
108 In all of the above operations,
112 must be specified as 0.
114 Higher-level interfaces layered on top of the above operations are
117 library in the form of
118 .BR cap_get_ambient (3),
119 .BR cap_set_ambient (3),
121 .BR cap_reset_ambient (3).
122 .\" prctl PR_CAPBSET_READ
124 .BR PR_CAPBSET_READ " (since Linux 2.6.25)"
125 Return (as the function result) 1 if the capability specified in
127 is in the calling thread's capability bounding set,
129 (The capability constants are defined in
130 .IR <linux/capability.h> .)
131 The capability bounding set dictates
132 whether the process can receive the capability through a
133 file's permitted capability set on a subsequent call to
136 If the capability specified in
138 is not valid, then the call fails with the error
141 A higher-level interface layered on top of this operation is provided in the
143 library in the form of
144 .BR cap_get_bound (3).
145 .\" prctl PR_CAPBSET_DROP
147 .BR PR_CAPBSET_DROP " (since Linux 2.6.25)"
148 If the calling thread has the
150 capability within its user namespace, then drop the capability specified by
152 from the calling thread's capability bounding set.
153 Any children of the calling thread will inherit the newly
154 reduced bounding set.
156 The call fails with the error:
158 if the calling thread does not have the
163 does not represent a valid capability; or
165 if file capabilities are not enabled in the kernel,
166 in which case bounding sets are not supported.
168 A higher-level interface layered on top of this operation is provided in the
170 library in the form of
171 .BR cap_drop_bound (3).
172 .\" prctl PR_SET_CHILD_SUBREAPER
174 .BR PR_SET_CHILD_SUBREAPER " (since Linux 3.4)"
175 .\" commit ebec18a6d3aa1e7d84aab16225e87fd25170ec2b
179 set the "child subreaper" attribute of the calling process;
182 is zero, unset the attribute.
184 A subreaper fulfills the role of
186 for its descendant processes.
187 When a process becomes orphaned
188 (i.e., its immediate parent terminates),
189 then that process will be reparented to
190 the nearest still living ancestor subreaper.
191 Subsequently, calls to
193 in the orphaned process will now return the PID of the subreaper process,
194 and when the orphan terminates, it is the subreaper process that
197 signal and will be able to
199 on the process to discover its termination status.
201 The setting of the "child subreaper" attribute
202 is not inherited by children created by
206 The setting is preserved across
209 Establishing a subreaper process is useful in session management frameworks
210 where a hierarchical group of processes is managed by a subreaper process
211 that needs to be informed when one of the processes\(emfor example,
212 a double-forked daemon\(emterminates
213 (perhaps so that it can restart that process).
218 employ a subreaper process for similar reasons.
219 .\" prctl PR_GET_CHILD_SUBREAPER
221 .BR PR_GET_CHILD_SUBREAPER " (since Linux 3.4)"
222 Return the "child subreaper" setting of the caller,
223 in the location pointed to by
224 .IR "(int\ *) arg2" .
225 .\" prctl PR_SET_DUMPABLE
227 .BR PR_SET_DUMPABLE " (since Linux 2.3.20)"
228 Set the state of the "dumpable" attribute,
229 which determines whether core dumps are produced for the calling process
230 upon delivery of a signal whose default behavior is to produce a core dump.
232 In kernels up to and including 2.6.12,
235 .RB ( SUID_DUMP_DISABLE ,
236 process is not dumpable) or 1
237 .RB ( SUID_DUMP_USER ,
238 process is dumpable).
239 Between kernels 2.6.13 and 2.6.17,
240 .\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502
241 the value 2 was also permitted,
242 which caused any binary which normally would not be dumped
243 to be dumped readable by root only;
244 for security reasons, this feature has been removed.
245 .\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2
246 .\" Subject: Fix prctl privilege escalation (CVE-2006-2451)
247 .\" From: Marcel Holtmann <marcel () holtmann ! org>
248 .\" Date: 2006-07-12 11:12:00
249 (See also the description of
250 .I /proc/sys/fs/\:suid_dumpable
254 Normally, the "dumpable" attribute is set to 1.
255 However, it is reset to the current value contained in the file
256 .IR /proc/sys/fs/\:suid_dumpable
257 (which by default has the value 0),
258 in the following circumstances:
259 .\" See kernel/cred.c::commit_creds() (Linux 3.18 sources)
262 The process's effective user or group ID is changed.
264 The process's filesystem user or group ID is changed (see
265 .BR credentials (7)).
269 a set-user-ID or set-group-ID program, resulting in a change
270 of either the effective user ID or the effective group ID.
274 a program that has file capabilities (see
275 .BR capabilities (7)),
276 .\" See kernel/cred.c::commit_creds()
277 but only if the permitted capabilities
278 gained exceed those already permitted for the process.
279 .\" Also certain namespace operations;
282 Processes that are not dumpable can not be attached via
289 If a process is not dumpable,
290 the ownership of files in the process's
292 directory is affected as described in
294 .\" prctl PR_GET_DUMPABLE
296 .BR PR_GET_DUMPABLE " (since Linux 2.3.20)"
297 Return (as the function result) the current state of the calling
298 process's dumpable attribute.
299 .\" Since Linux 2.6.13, the dumpable flag can have the value 2,
300 .\" but in 2.6.13 PR_GET_DUMPABLE simply returns 1 if the dumpable
301 .\" flags has a nonzero value. This was fixed in 2.6.14.
302 .\" prctl PR_SET_ENDIAN
304 .BR PR_SET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
305 Set the endian-ness of the calling process to the value given
306 in \fIarg2\fP, which should be one of the following:
307 .\" Respectively 0, 1, 2
309 .BR PR_ENDIAN_LITTLE ,
311 .B PR_ENDIAN_PPC_LITTLE
312 (PowerPC pseudo little endian).
313 .\" prctl PR_GET_ENDIAN
315 .BR PR_GET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
316 Return the endian-ness of the calling process,
317 in the location pointed to by
318 .IR "(int\ *) arg2" .
319 .\" prctl PR_SET_FP_MODE
321 .BR PR_SET_FP_MODE " (since Linux 4.0, only on MIPS)"
322 .\" commit 9791554b45a2acc28247f66a5fd5bbc212a6b8c8
323 On the MIPS architecture,
324 user-space code can be built using an ABI which permits linking
325 with code that has more restrictive floating-point (FP) requirements.
326 For example, user-space code may be built to target the O32 FPXX ABI
327 and linked with code built for either one of the more restrictive
329 When more restrictive code is linked in,
330 the overall requirement for the process is to use the more
331 restrictive floating-point mode.
333 Because the kernel has no means of knowing in advance
334 which mode the process should be executed in,
335 and because these restrictions can
336 change over the lifetime of the process, the
338 operation is provided to allow control of the floating-point mode
341 .\" https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
343 .I (unsigned int) arg2
344 argument is a bit mask describing the floating-point mode used:
352 mode), the 32 floating-point registers are 32 bits wide,
353 and 64-bit registers are represented as a pair of registers
354 (even- and odd- numbered,
355 with the even-numbered register containing the lower 32 bits,
356 and the odd-numbered register containing the higher 32 bits).
360 (on supported hardware),
361 the 32 floating-point registers are 64 bits wide (so called
364 Note that modern MIPS implementations (MIPS R6 and newer) support
368 Applications that use the O32 FP32 ABI can operate only when this bit is
371 or they can be used with FRE enabled, see below).
372 Applications that use the O32 FP64 ABI
373 (and the O32 FP64A ABI, which exists to
374 provide the ability to operate with existing FP32 code; see below)
375 can operate only when this bit is
378 Applications that use the O32 FPXX ABI can operate with either
384 Enable emulation of 32-bit floating-point mode.
385 When this mode is enabled,
386 it emulates 32-bit floating-point operations
387 by raising a reserved-instruction exception
388 on every instruction that uses 32-bit formats and
389 the kernel then handles the instruction in software.
390 (The problem lies in the discrepancy of handling odd-numbered registers
391 which are the high 32 bits of 64-bit registers with even numbers in
393 mode and the lower 32-bit parts of odd-numbered 64-bit registers in
396 Enabling this bit is necessary when code with the O32 FP32 ABI should operate
397 with code with compatible the O32 FPXX or O32 FP64A ABIs (which require
399 FPU mode) or when it is executed on newer hardware (MIPS R6 onwards)
402 mode support when a binary with the FP32 ABI is used.
404 Note that this mode makes sense only when the FPU is in 64-bit mode
407 Note that the use of emulation inherently has a significant performance hit
408 and should be avoided if possible.
411 In the N32/N64 ABI, 64-bit floating-point mode is always used,
412 so FPU emulation is not required and the FPU always operates in
416 This option is mainly intended for use by the dynamic linker
425 .\" prctl PR_GET_FP_MODE
427 .BR PR_GET_FP_MODE " (since Linux 4.0, only on MIPS)"
428 Return (as the function result)
429 the current floating-point mode (see the description of
434 the call returns a bit mask which represents the current floating-point mode.
443 .\" prctl PR_SET_FPEMU
445 .BR PR_SET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
446 Set floating-point emulation control bits to \fIarg2\fP.
449 to silently emulate floating-point operation accesses, or
451 to not emulate floating-point operations and send
454 .\" prctl PR_GET_FPEMU
456 .BR PR_GET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
457 Return floating-point emulation control bits,
458 in the location pointed to by
459 .IR "(int\ *) arg2" .
460 .\" prctl PR_SET_FPEXC
462 .BR PR_SET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
463 Set floating-point exception mode to \fIarg2\fP.
464 Pass \fBPR_FP_EXC_SW_ENABLE\fP to use FPEXC for FP exception enables,
465 \fBPR_FP_EXC_DIV\fP for floating-point divide by zero,
466 \fBPR_FP_EXC_OVF\fP for floating-point overflow,
467 \fBPR_FP_EXC_UND\fP for floating-point underflow,
468 \fBPR_FP_EXC_RES\fP for floating-point inexact result,
469 \fBPR_FP_EXC_INV\fP for floating-point invalid operation,
470 \fBPR_FP_EXC_DISABLED\fP for FP exceptions disabled,
471 \fBPR_FP_EXC_NONRECOV\fP for async nonrecoverable exception mode,
472 \fBPR_FP_EXC_ASYNC\fP for async recoverable exception mode,
473 \fBPR_FP_EXC_PRECISE\fP for precise exception mode.
474 .\" prctl PR_GET_FPEXC
476 .BR PR_GET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
477 Return floating-point exception mode,
478 in the location pointed to by
479 .IR "(int\ *) arg2" .
480 .\" prctl PR_SET_IO_FLUSHER
482 .BR PR_SET_IO_FLUSHER " (since Linux 5.6)"
483 If a user process is involved in the block layer or filesystem I/O path,
484 and can allocate memory while processing I/O requests it must set
486 This will put the process in the IO_FLUSHER state,
487 which allows it special treatment to make progress when allocating memory.
488 If \fIarg2\fP is 0, the process will clear the IO_FLUSHER state, and
489 the default behavior will be used.
491 The calling process must have the
501 The IO_FLUSHER state is inherited by a child process created via
503 and is preserved across
506 Examples of IO_FLUSHER applications are FUSE daemons, SCSI device
507 emulation daemons, and daemons that perform error handling like multipath
508 path recovery applications.
509 .\" prctl PR_GET_IO_FLUSHER
511 .B PR_GET_IO_FLUSHER (Since Linux 5.6)
512 Return (as the function result) the IO_FLUSHER state of the caller.
513 A value of 1 indicates that the caller is in the IO_FLUSHER state;
514 0 indicates that the caller is not in the IO_FLUSHER state.
516 The calling process must have the
526 .\" prctl PR_SET_KEEPCAPS
528 .BR PR_SET_KEEPCAPS " (since Linux 2.2.18)"
529 Set the state of the calling thread's "keep capabilities" flag.
530 The effect of this flag is described in
531 .BR capabilities (7).
533 must be either 0 (clear the flag)
535 The "keep capabilities" value will be reset to 0 on subsequent calls to
537 .\" prctl PR_GET_KEEPCAPS
539 .BR PR_GET_KEEPCAPS " (since Linux 2.2.18)"
540 Return (as the function result) the current state of the calling thread's
541 "keep capabilities" flag.
544 for a description of this flag.
545 .\" prctl PR_MCE_KILL
547 .BR PR_MCE_KILL " (since Linux 2.6.32)"
548 Set the machine check memory corruption kill policy for the calling thread.
552 .BR PR_MCE_KILL_CLEAR ,
553 clear the thread memory corruption kill policy and use the system-wide default.
554 (The system-wide default is defined by
555 .IR /proc/sys/vm/memory_failure_early_kill ;
561 .BR PR_MCE_KILL_SET ,
562 use a thread-specific memory corruption kill policy.
565 defines whether the policy is
567 .RB ( PR_MCE_KILL_EARLY ),
569 .RB ( PR_MCE_KILL_LATE ),
570 or the system-wide default
571 .RB ( PR_MCE_KILL_DEFAULT ).
572 Early kill means that the thread receives a
574 signal as soon as hardware memory corruption is detected inside
576 In late kill mode, the process is killed only when it accesses a corrupted page.
579 for more information on the
582 The policy is inherited by children.
585 arguments must be zero for future compatibility.
586 .\" prctl PR_MCE_KILL_GET
588 .BR PR_MCE_KILL_GET " (since Linux 2.6.32)"
589 Return (as the function result)
590 the current per-process machine check kill policy.
593 arguments must be zero.
596 .BR PR_SET_MM " (since Linux 3.3)"
597 .\" commit 028ee4be34a09a6d48bdf30ab991ae933a7bc036
598 Modify certain kernel memory map descriptor fields
599 of the calling process.
600 Usually these fields are set by the kernel and dynamic loader (see
602 for more information) and a regular application should not use this feature.
603 However, there are cases, such as self-modifying programs,
604 where a program might find it useful to change its own memory map.
606 The calling process must have the
611 is one of the options below, while
613 provides a new value for the option.
618 arguments must be zero if unused.
621 .\" commit 52b3694157e3aa6df871e283115652ec6f2d31e0
622 this feature is available only if the kernel is built with the
623 .BR CONFIG_CHECKPOINT_RESTORE
627 .BR PR_SET_MM_START_CODE
628 Set the address above which the program text can run.
629 The corresponding memory area must be readable and executable,
630 but not writable or shareable (see
634 for more information).
636 .BR PR_SET_MM_END_CODE
637 Set the address below which the program text can run.
638 The corresponding memory area must be readable and executable,
639 but not writable or shareable.
641 .BR PR_SET_MM_START_DATA
642 Set the address above which initialized and
643 uninitialized (bss) data are placed.
644 The corresponding memory area must be readable and writable,
645 but not executable or shareable.
647 .B PR_SET_MM_END_DATA
648 Set the address below which initialized and
649 uninitialized (bss) data are placed.
650 The corresponding memory area must be readable and writable,
651 but not executable or shareable.
653 .BR PR_SET_MM_START_STACK
654 Set the start address of the stack.
655 The corresponding memory area must be readable and writable.
657 .BR PR_SET_MM_START_BRK
658 Set the address above which the program heap can be expanded with
661 The address must be greater than the ending address of
662 the current program data segment.
663 In addition, the combined size of the resulting heap and
664 the size of the data segment can't exceed the
673 The requirements for the address are the same as for the
674 .BR PR_SET_MM_START_BRK
677 The following options are available since Linux 3.5.
678 .\" commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7
680 .BR PR_SET_MM_ARG_START
681 Set the address above which the program command line is placed.
683 .BR PR_SET_MM_ARG_END
684 Set the address below which the program command line is placed.
686 .BR PR_SET_MM_ENV_START
687 Set the address above which the program environment is placed.
689 .BR PR_SET_MM_ENV_END
690 Set the address below which the program environment is placed.
692 The address passed with
693 .BR PR_SET_MM_ARG_START ,
694 .BR PR_SET_MM_ARG_END ,
695 .BR PR_SET_MM_ENV_START ,
697 .BR PR_SET_MM_ENV_END
698 should belong to a process stack area.
699 Thus, the corresponding memory area must be readable, writable, and
700 (depending on the kernel configuration) have the
706 Set a new auxiliary vector.
709 argument should provide the address of the vector.
712 is the size of the vector.
714 .BR PR_SET_MM_EXE_FILE
715 .\" commit b32dfe377102ce668775f8b6b1461f7ad428f8b6
718 symbolic link with a new one pointing to a new executable file
719 identified by the file descriptor provided in
722 The file descriptor should be obtained with a regular
726 To change the symbolic link, one needs to unmap all existing
727 executable memory areas, including those created by the kernel itself
728 (for example the kernel usually creates at least one executable
729 memory area for the ELF
733 In Linux 4.9 and earlier, the
734 .\" commit 3fb4afd9a504c2386b8435028d43283216bf588e
735 .BR PR_SET_MM_EXE_FILE
736 operation can be performed only once in a process's lifetime;
737 attempting to perform the operation a second time results in the error
739 This restriction was enforced for security reasons that were subsequently
741 and the restriction was removed in Linux 4.10 because some
742 user-space applications needed to perform this operation more than once.
744 The following options are available since Linux 3.18.
745 .\" commit f606b77f1a9e362451aca8f81d8f36a3a112139e
748 Provides one-shot access to all the addresses by passing in a
749 .I struct prctl_mm_map
750 (as defined in \fI<linux/prctl.h>\fP).
753 argument should provide the size of the struct.
755 This feature is available only if the kernel is built with the
756 .BR CONFIG_CHECKPOINT_RESTORE
759 .BR PR_SET_MM_MAP_SIZE
760 Returns the size of the
761 .I struct prctl_mm_map
763 This allows user space to find a compatible struct.
766 argument should be a pointer to an unsigned int.
768 This feature is available only if the kernel is built with the
769 .BR CONFIG_CHECKPOINT_RESTORE
772 .\" prctl PR_MPX_ENABLE_MANAGEMENT
774 .BR PR_MPX_ENABLE_MANAGEMENT ", " PR_MPX_DISABLE_MANAGEMENT " (since Linux 3.19, removed in Linux 5.4; only on x86)"
775 .\" commit fe3d197f84319d3bce379a9c0dc17b1f48ad358c
776 .\" See also http://lwn.net/Articles/582712/
777 .\" See also https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
778 Enable or disable kernel management of Memory Protection eXtensions (MPX)
786 .\" commit e9d1b4f3c60997fe197bf0243cb4a41a44387a88
787 arguments must be zero.
789 MPX is a hardware-assisted mechanism for performing bounds checking on
791 It consists of a set of registers storing bounds information
792 and a set of special instruction prefixes that tell the CPU on which
793 instructions it should do bounds enforcement.
794 There is a limited number of these registers and
795 when there are more pointers than registers,
796 their contents must be "spilled" into a set of tables.
797 These tables are called "bounds tables" and the MPX
800 whether the kernel manages their allocation and freeing.
802 When management is enabled, the kernel will take over allocation
803 and freeing of the bounds tables.
804 It does this by trapping the #BR exceptions that result
805 at first use of missing bounds tables and
806 instead of delivering the exception to user space,
807 it allocates the table and populates the bounds directory
808 with the location of the new table.
809 For freeing, the kernel checks to see if bounds tables are
810 present for memory which is not allocated, and frees them if so.
812 Before enabling MPX management using
813 .BR PR_MPX_ENABLE_MANAGEMENT ,
814 the application must first have allocated a user-space buffer for
815 the bounds directory and placed the location of that directory in the
819 These calls fail if the CPU or kernel does not support MPX.
820 Kernel support for MPX is enabled via the
821 .BR CONFIG_X86_INTEL_MPX
822 configuration option.
823 You can check whether the CPU supports MPX by looking for the
825 CPUID bit, like with the following command:
829 cat /proc/cpuinfo | grep \(aq mpx \(aq
833 A thread may not switch in or out of long (64-bit) mode while MPX is
836 All threads in a process are affected by these calls.
840 inherits the state of MPX management.
843 MPX management is reset to a state as if
844 .BR PR_MPX_DISABLE_MANAGEMENT
847 For further information on Intel MPX, see the kernel source file
848 .IR Documentation/x86/intel_mpx.txt .
850 .\" commit f240652b6032b48ad7fa35c5e701cc4c8d697c0b
851 .\" See also https://lkml.kernel.org/r/20190705175321.DB42F0AD@viggo.jf.intel.com
852 Due to a lack of toolchain support,
853 .BR PR_MPX_ENABLE_MANAGEMENT " and " PR_MPX_DISABLE_MANAGEMENT
854 are not supported in Linux 5.4 and later.
855 .\" prctl PR_SET_NAME
857 .BR PR_SET_NAME " (since Linux 2.6.9)"
858 Set the name of the calling thread,
859 using the value in the location pointed to by
860 .IR "(char\ *) arg2" .
861 The name can be up to 16 bytes long,
862 .\" TASK_COMM_LEN in include/linux/sched.h
863 including the terminating null byte.
864 (If the length of the string, including the terminating null byte,
865 exceeds 16 bytes, the string is silently truncated.)
866 This is the same attribute that can be set via
867 .BR pthread_setname_np (3)
869 .BR pthread_getname_np (3).
870 The attribute is likewise accessible via
871 .IR /proc/self/task/[tid]/comm
876 is the thread ID of the calling thread, as returned by
878 .\" prctl PR_GET_NAME
880 .BR PR_GET_NAME " (since Linux 2.6.11)"
881 Return the name of the calling thread,
882 in the buffer pointed to by
883 .IR "(char\ *) arg2" .
884 The buffer should allow space for up to 16 bytes;
885 the returned string will be null-terminated.
886 .\" prctl PR_SET_NO_NEW_PRIVS
888 .BR PR_SET_NO_NEW_PRIVS " (since Linux 3.5)"
889 Set the calling thread's
891 attribute to the value in
897 promises not to grant privileges to do anything
898 that could not have been done without the
901 rendering the set-user-ID and set-group-ID mode bits,
902 and file capabilities non-functional).
905 attribute cannot be unset.
906 The setting of this attribute is inherited by children created by
914 the value of a thread's
916 attribute can be viewed via the
919 .IR /proc/[pid]/status
922 For more information, see the kernel source file
923 .IR Documentation/userspace\-api/no_new_privs.rst
924 .\" commit 40fde647ccb0ae8c11d256d271e24d385eed595b
926 .IR Documentation/prctl/no_new_privs.txt
930 .\" prctl PR_GET_NO_NEW_PRIVS
932 .BR PR_GET_NO_NEW_PRIVS " (since Linux 3.5)"
933 Return (as the function result) the value of the
935 attribute for the calling thread.
936 A value of 0 indicates the regular
939 A value of 1 indicates
941 will operate in the privilege-restricting mode described above.
942 .\" prctl PR_PAC_RESET_KEYS
943 .\" commit ba830885656414101b2f8ca88786524d4bb5e8c1
945 .BR PR_PAC_RESET_KEYS " (since Linux 5.0, only on arm64)"
946 Securely reset the thread's pointer authentication keys
947 to fresh random values generated by the kernel.
949 The set of keys to be reset is specified by
951 which must be a logical OR of zero or more of the following:
955 instruction authentication key A
958 instruction authentication key B
961 data authentication key A
964 data authentication key B
967 generic authentication \(lqA\(rq key.
969 (Yes folks, there really is no generic B key.)
972 As a special case, if
974 is zero, then all the keys are reset.
975 Since new keys could be added in future,
976 this is the recommended way to completely wipe the existing keys
977 when establishing a clean execution context.
978 Note that there is no need to use
979 .BR PR_PAC_RESET_KEYS
980 in preparation for calling
984 resets all the pointer authentication keys.
986 The remaining arguments
987 .IR arg3 ", " arg4 ", and " arg5
990 If the arguments are invalid,
993 contains set bits that are unrecognized
994 or that correspond to a key not available on this platform,
995 then the call fails with error
999 Because the compiler or run-time environment
1000 may be using some or all of the keys,
1002 .B PR_PAC_RESET_KEYS
1003 may crash the calling process.
1004 The conditions for using it safely are complex and system-dependent.
1005 Don't use it unless you know what you are doing.
1007 For more information, see the kernel source file
1008 .I Documentation/arm64/pointer\-authentication.rst
1009 .\"commit b693d0b372afb39432e1c49ad7b3454855bc6bed
1011 .I Documentation/arm64/pointer\-authentication.txt
1013 .\" prctl PR_SET_PDEATHSIG
1015 .BR PR_SET_PDEATHSIG " (since Linux 2.1.57)"
1016 Set the parent-death signal
1017 of the calling process to \fIarg2\fP (either a signal value
1021 This is the signal that the calling process will get when its
1025 .\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
1026 the "parent" in this case is considered to be the
1028 that created this process.
1029 In other words, the signal will be sent when that thread terminates
1031 .BR pthread_exit (3)),
1032 rather than after all of the threads in the parent process terminate.
1034 The parent-death signal is sent upon subsequent termination of the parent
1035 thread and also upon termination of each subreaper process
1036 (see the description of
1037 .B PR_SET_CHILD_SUBREAPER
1038 above) to which the caller is subsequently reparented.
1039 If the parent thread and all ancestor subreapers have already terminated
1041 .BR PR_SET_PDEATHSIG
1042 operation, then no parent-death signal is sent to the caller.
1044 The parent-death signal is process-directed (see
1046 and, if the child installs a handler using the
1053 argument of the handler contains the PID of the terminating parent process.
1055 The parent-death signal setting is cleared for the child of a
1058 (since Linux 2.4.36 / 2.6.23)
1059 .\" commit d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f
1060 cleared when executing a set-user-ID or set-group-ID binary,
1061 or a binary that has associated capabilities (see
1062 .BR capabilities (7));
1063 otherwise, this value is preserved across
1065 The parent-death signal setting is also cleared upon changes to
1066 any of the following thread credentials:
1067 .\" FIXME capability changes can also trigger this; see
1068 .\" kernel/cred.c::commit_creds in the Linux 5.6 source.
1069 effective user ID, effective group ID, filesystem user ID,
1070 or filesystem group ID.
1071 .\" prctl PR_GET_PDEATHSIG
1073 .BR PR_GET_PDEATHSIG " (since Linux 2.3.15)"
1074 Return the current value of the parent process death signal,
1075 in the location pointed to by
1076 .IR "(int\ *) arg2" .
1077 .\" prctl PR_SET_PTRACER
1079 .BR PR_SET_PTRACER " (since Linux 3.4)"
1080 .\" commit 2d514487faf188938a4ee4fb3464eeecfbdcf8eb
1081 .\" commit bf06189e4d14641c0148bea16e9dd24943862215
1082 This is meaningful only when the Yama LSM is enabled and in mode 1
1083 ("restricted ptrace", visible via
1084 .IR /proc/sys/kernel/yama/ptrace_scope ).
1085 When a "ptracer process ID" is passed in \fIarg2\fP,
1086 the caller is declaring that the ptracer process can
1088 the calling process as if it were a direct process ancestor.
1091 operation replaces the previous "ptracer process ID".
1096 set to 0 clears the caller's "ptracer process ID".
1100 .BR PR_SET_PTRACER_ANY ,
1101 the ptrace restrictions introduced by Yama are effectively disabled for the
1104 For further information, see the kernel source file
1105 .IR Documentation/admin\-guide/LSM/Yama.rst
1106 .\" commit 90bb766440f2147486a2acc3e793d7b8348b0c22
1108 .IR Documentation/security/Yama.txt
1110 .\" prctl PR_SET_SECCOMP
1112 .BR PR_SET_SECCOMP " (since Linux 2.6.23)"
1113 .\" See http://thread.gmane.org/gmane.linux.kernel/542632
1114 .\" [PATCH 0 of 2] seccomp updates
1115 .\" andrea@cpushare.com
1116 Set the secure computing (seccomp) mode for the calling thread, to limit
1117 the available system calls.
1120 system call provides a superset of the functionality of
1121 .BR PR_SET_SECCOMP ,
1122 and is the preferred interface for new applications.
1124 The seccomp mode is selected via
1126 (The seccomp constants are defined in
1127 .IR <linux/seccomp.h> .)
1128 The following values can be specified:
1131 .BR SECCOMP_MODE_STRICT " (since Linux 2.6.23)"
1132 See the description of
1133 .B SECCOMP_SET_MODE_STRICT
1137 This operation is available only
1138 if the kernel is configured with
1142 .BR SECCOMP_MODE_FILTER " (since Linux 3.5)"
1143 The allowed system calls are defined by a pointer
1144 to a Berkeley Packet Filter passed in
1146 This argument is a pointer to
1147 .IR "struct sock_fprog" ;
1148 it can be designed to filter
1149 arbitrary system calls and system call arguments.
1150 See the description of
1151 .B SECCOMP_SET_MODE_FILTER
1155 This operation is available only
1156 if the kernel is configured with
1157 .B CONFIG_SECCOMP_FILTER
1161 For further details on seccomp filtering, see
1163 .\" prctl PR_GET_SECCOMP
1165 .BR PR_GET_SECCOMP " (since Linux 2.6.23)"
1166 Return (as the function result)
1167 the secure computing mode of the calling thread.
1168 If the caller is not in secure computing mode, this operation returns 0;
1169 if the caller is in strict secure computing mode, then the
1173 signal to be sent to the process.
1174 If the caller is in filter mode, and this system call is allowed by the
1175 seccomp filters, it returns 2; otherwise, the process is killed with a
1179 This operation is available only
1180 if the kernel is configured with
1184 Since Linux 3.8, the
1187 .IR /proc/[pid]/status
1188 file provides a method of obtaining the same information,
1189 without the risk that the process is killed; see
1191 .\" prctl PR_SET_SECUREBITS
1193 .BR PR_SET_SECUREBITS " (since Linux 2.6.26)"
1194 Set the "securebits" flags of the calling thread to the value supplied in
1197 .BR capabilities (7).
1198 .\" prctl PR_GET_SECUREBITS
1200 .BR PR_GET_SECUREBITS " (since Linux 2.6.26)"
1201 Return (as the function result)
1202 the "securebits" flags of the calling thread.
1204 .BR capabilities (7).
1205 .\" prctl PR_GET_SPECULATION_CTRL
1207 .BR PR_GET_SPECULATION_CTRL " (since Linux 4.17)"
1208 Return (as the function result)
1209 the state of the speculation misfeature specified in
1211 Currently, the only permitted value for this argument is
1212 .BR PR_SPEC_STORE_BYPASS
1213 (otherwise the call fails with the error
1216 The return value uses bits 0-3 with the following meaning:
1220 Mitigation can be controlled per thread by
1221 .BR PR_SET_SPECULATION_CTRL .
1224 The speculation feature is enabled, mitigation is disabled.
1227 The speculation feature is disabled, mitigation is enabled.
1229 .BR PR_SPEC_FORCE_DISABLE
1232 but cannot be undone.
1234 .BR PR_SPEC_DISABLE_NOEXEC " (since Linux 5.1)"
1236 .BR PR_SPEC_DISABLE ,
1237 but the state will be cleared on
1242 then the CPU is not affected by the speculation misfeature.
1246 is set, then per-thread control of the mitigation is available.
1249 for the speculation misfeature will fail.
1256 arguments must be specified as 0; otherwise the call fails with the error
1258 .\" prctl PR_SET_SPECULATION_CTRL
1260 .BR PR_SET_SPECULATION_CTRL " (since Linux 4.17)"
1261 .\" commit b617cfc858161140d69cc0b5cc211996b557a1c7
1262 .\" commit 356e4bfff2c5489e016fdb925adbf12a1e3950ee
1263 Sets the state of the speculation misfeature specified in
1265 The speculation-misfeature settings are per-thread attributes.
1272 .B PR_SPEC_STORE_BYPASS
1273 Set the state of the speculative store bypass misfeature.
1274 .\" commit 9137bb27e60e554dab694eafa4cca241fa3a694f
1276 .BR PR_SPEC_INDIRECT_BRANCH " (since Linux 4.20)"
1277 Set the state of the indirect branch speculation misfeature.
1282 does not have one of the above values,
1283 then the call fails with the error
1288 argument is used to hand in the control value,
1289 which is one of the following:
1293 The speculation feature is enabled, mitigation is disabled.
1296 The speculation feature is disabled, mitigation is enabled.
1298 .BR PR_SPEC_FORCE_DISABLE
1300 .BR PR_SPEC_DISABLE ,
1301 but cannot be undone.
1305 .BR PR_SPEC_ENABLE )
1306 with the same value for
1308 will fail with the error
1310 .\" commit 71368af9027f18fe5d1c6f372cfdff7e4bde8b48
1312 .BR PR_SPEC_DISABLE_NOEXEC " (since Linux 5.1)"
1314 .BR PR_SPEC_DISABLE ,
1315 but the state will be cleared on
1317 Currently only supported for
1320 .B PR_SPEC_STORE_BYPASS.
1323 Any unsupported value in
1325 will result in the call failing with the error
1332 arguments must be specified as 0; otherwise the call fails with the error
1335 The speculation feature can also be controlled by the
1336 .B spec_store_bypass_disable
1338 This parameter may enforce a read-only policy which will result in the
1340 call failing with the error
1342 For further details, see the kernel source file
1343 .IR Documentation/admin\-guide/kernel\-parameters.txt .
1344 .\" prctl PR_SVE_SET_VL
1345 .\" commit 2d2123bc7c7f843aa9db87720de159a049839862
1346 .\" linux-5.6/Documentation/arm64/sve.rst
1348 .BR PR_SVE_SET_VL " (since Linux 4.15, only on arm64)"
1349 Configure the thread's SVE vector length,
1353 .IR arg3 ", " arg4 ", and " arg5
1359 .B PR_SVE_VL_LEN_MASK
1360 must be set to the desired vector length in bytes.
1361 This is interpreted as an upper bound:
1362 the kernel will select the greatest available vector length
1363 that does not exceed the value specified.
1364 In particular, specifying
1367 .I <asm/sigcontext.h>)
1369 .B PR_SVE_VL_LEN_MASK
1370 bits requests the maximum supported vector length.
1372 In addition, the other bits of
1374 must be set to one of the following combinations of flags:
1378 Perform the change immediately.
1382 the vector length will be reset to the value configured in
1383 .IR /proc/sys/abi/sve_default_vector_length .
1385 .B PR_SVE_VL_INHERIT
1386 Perform the change immediately.
1389 calls will preserve the new vector length.
1391 .B PR_SVE_SET_VL_ONEXEC
1392 Defer the change, so that it is performed at the next
1397 calls will reset the vector length to the value configured in
1398 .IR /proc/sys/abi/sve_default_vector_length .
1400 .B "PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT"
1401 Defer the change, so that it is performed at the next
1406 calls will preserve the new vector length.
1410 any previously pending deferred change is canceled.
1412 The call fails with error
1414 if SVE is not supported on the platform, if
1416 is unrecognized or invalid, or the value in the bits of
1419 .B PR_SVE_VL_LEN_MASK
1420 is outside the range
1421 .BR SVE_VL_MIN .. SVE_VL_MAX
1422 or is not a multiple of 16.
1425 a nonnegative value is returned that describes the
1429 .B PR_SVE_SET_VL_ONEXEC
1432 then the configuration described by the return value
1433 will take effect at the next
1435 Otherwise, the configuration is already in effect when the
1438 In either case, the value is encoded in the same way as the return value of
1440 Note that there is no explicit flag in the return value
1442 .BR PR_SVE_SET_VL_ONEXEC .
1444 The configuration (including any pending deferred change)
1450 For more information, see the kernel source file
1451 .I Documentation/arm64/sve.rst
1452 .\"commit b693d0b372afb39432e1c49ad7b3454855bc6bed
1454 .I Documentation/arm64/sve.txt
1458 Because the compiler or run-time environment
1459 may be using SVE, using this call without the
1460 .B PR_SVE_SET_VL_ONEXEC
1461 flag may crash the calling process.
1462 The conditions for using it safely are complex and system-dependent.
1463 Don't use it unless you really know what you are doing.
1464 .\" prctl PR_SVE_GET_VL
1466 .BR PR_SVE_GET_VL " (since Linux 4.15, only on arm64)"
1467 Get the thread's current SVE vector length configuration.
1470 .IR arg2 ", " arg3 ", " arg4 ", and " arg5
1473 Provided that the kernel and platform support SVE,
1474 this operation always succeeds,
1475 returning a nonnegative value that describes the
1478 The bits corresponding to
1479 .B PR_SVE_VL_LEN_MASK
1480 contain the currently configured vector length in bytes.
1481 The bit corresponding to
1482 .B PR_SVE_VL_INHERIT
1483 indicates whether the vector length will be inherited
1487 Note that there is no way to determine whether there is
1488 a pending vector length change that has not yet taken effect.
1490 For more information, see the kernel source file
1491 .I Documentation/arm64/sve.rst
1492 .\"commit b693d0b372afb39432e1c49ad7b3454855bc6bed
1494 .I Documentation/arm64/sve.txt
1497 .\" prctl PR_SET_SYSCALL_USER_DISPATCH
1498 .\" commit 1446e1df9eb183fdf81c3f0715402f1d7595d4
1499 .BR PR_SET_SYSCALL_USER_DISPATCH " (since Linux 5.11, x86 only)"
1500 Configure the Syscall User Dispatch mechanism
1501 for the calling thread.
1502 This mechanism allows an application
1503 to selectively intercept system calls
1504 so that they can be handled within the application itself.
1505 Interception takes the form of a thread-directed
1507 signal that is delivered to the thread
1508 when it makes a system call.
1510 the system call is not executed by the kernel.
1512 To enable this mechanism,
1515 .BR PR_SYS_DISPATCH_ON .
1516 Once enabled, further system calls will be selectively intercepted,
1517 depending on a control variable provided by user space.
1522 respectively identify the
1526 of a single contiguous memory region in the process address space
1527 from where system calls are always allowed to be executed,
1528 regardless of the control variable.
1529 (Typically, this area would include the area of memory
1530 containing the C library.)
1533 points to a char-sized variable
1534 that is a fast switch to allow/block system call execution
1535 without the overhead of doing another system call
1536 to re-configure Syscall User Dispatch.
1537 This control variable can either be set to
1538 .B SYSCALL_DISPATCH_FILTER_BLOCK
1539 to block system calls from executing
1541 .B SYSCALL_DISPATCH_FILTER_ALLOW
1542 to temporarily allow them to be executed.
1543 This value is checked by the kernel
1544 on every system call entry,
1545 and any unexpected value will raise
1549 killing the application.
1551 When a system call is intercepted,
1552 the kernel sends a thread-directed
1554 signal to the triggering thread.
1555 Various fields will be set in the
1559 associated with the signal:
1567 will show the address of the system call instruction.
1572 will indicate which system call was attempted.
1576 .BR SYS_USER_DISPATCH .
1582 The program counter will be as though the system call happened
1583 (i.e., the program counter will not point to the system call instruction).
1585 When the signal handler returns to the kernel,
1586 the system call completes immediately
1587 and returns to the calling thread,
1588 without actually being executed.
1590 (i.e., when emulating the system call on user space.),
1591 the signal handler should set the system call return value
1593 by modifying the register context stored in the
1595 argument of the signal handler.
1601 for more information.
1606 .BR PR_SYS_DISPATCH_OFF ,
1607 Syscall User Dispatch is disabled for that thread.
1608 the remaining arguments must be set to 0.
1610 The setting is not preserved across
1616 For more information,
1617 see the kernel source file
1618 .IR Documentation/admin-guide/syscall-user-dispatch.rst
1619 .\" prctl PR_SET_TAGGED_ADDR_CTRL
1620 .\" commit 63f0c60379650d82250f22e4cf4137ef3dc4f43d
1622 .BR PR_SET_TAGGED_ADDR_CTRL " (since Linux 5.4, only on arm64)"
1623 Controls support for passing tagged user-space addresses to the kernel
1624 (i.e., addresses where bits 56\(em63 are not all zero).
1626 The level of support is selected by
1628 which can be one of the following:
1632 Addresses that are passed
1633 for the purpose of being dereferenced by the kernel
1636 .B PR_TAGGED_ADDR_ENABLE
1637 Addresses that are passed
1638 for the purpose of being dereferenced by the kernel
1639 may be tagged, with the exceptions summarized below.
1642 The remaining arguments
1643 .IR arg3 ", " arg4 ", and " arg5
1645 .\" Enforcement added in
1646 .\" commit 3e91ec89f527b9870fe42dcbdb74fd389d123a95
1648 On success, the mode specified in
1650 is set for the calling thread and the return value is 0.
1651 If the arguments are invalid,
1652 the mode specified in
1655 or if this feature is unsupported by the kernel
1657 .IR /proc/sys/abi/tagged_addr_disabled ,
1658 the call fails with the error
1662 .BR prctl ( PR_SET_TAGGED_ADDR_CTRL ,
1666 then all addresses passed to the kernel must be untagged.
1668 Irrespective of which mode is set,
1669 addresses passed to certain interfaces
1670 must always be untagged:
1682 (Prior to Linux 5.6 these accepted tagged addresses,
1683 but the behaviour may not be what you expect.
1686 \(oqpolymorphic\(cq interfaces
1687 that accept pointers to arbitrary types cast to a
1689 or other generic type, specifically
1694 (only certain specific
1696 options allow tagged addresses).
1699 This list of exclusions may shrink
1700 when moving from one kernel version to a later kernel version.
1701 While the kernel may make some guarantees
1702 for backwards compatibility reasons,
1703 for the purposes of new software
1704 the effect of passing tagged addresses to these interfaces
1707 The mode set by this call is inherited across
1711 The mode is reset by
1714 (i.e., tagged addresses not permitted in the user/kernel ABI).
1716 For more information, see the kernel source file
1717 .IR Documentation/arm64/tagged\-address\-abi.rst .
1720 This call is primarily intended for use by the run-time environment.
1722 .B PR_SET_TAGGED_ADDR_CTRL
1723 call elsewhere may crash the calling process.
1724 The conditions for using it safely are complex and system-dependent.
1725 Don't use it unless you know what you are doing.
1726 .\" prctl PR_GET_TAGGED_ADDR_CTRL
1727 .\" commit 63f0c60379650d82250f22e4cf4137ef3dc4f43d
1729 .BR PR_GET_TAGGED_ADDR_CTRL " (since Linux 5.4, only on arm64)"
1730 Returns the current tagged address mode
1731 for the calling thread.
1734 .IR arg2 ", " arg3 ", " arg4 ", and " arg5
1737 If the arguments are invalid
1738 or this feature is disabled or unsupported by the kernel,
1742 .BR prctl ( PR_GET_TAGGED_ADDR_CTRL ,
1746 then this feature is definitely either unsupported,
1748 .IR /proc/sys/abi/tagged_addr_disabled .
1750 all addresses passed to the kernel must be untagged.
1752 Otherwise, the call returns a nonnegative value
1753 describing the current tagged address mode,
1754 encoded in the same way as the
1757 .BR PR_SET_TAGGED_ADDR_CTRL .
1759 For more information, see the kernel source file
1760 .IR Documentation/arm64/tagged\-address\-abi.rst .
1762 .\" prctl PR_TASK_PERF_EVENTS_DISABLE
1764 .BR PR_TASK_PERF_EVENTS_DISABLE " (since Linux 2.6.31)"
1765 Disable all performance counters attached to the calling process,
1766 regardless of whether the counters were created by
1767 this process or another process.
1768 Performance counters created by the calling process for other
1769 processes are unaffected.
1770 For more information on performance counters, see the Linux kernel source file
1771 .IR tools/perf/design.txt .
1774 .BR PR_TASK_PERF_COUNTERS_DISABLE ;
1775 .\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
1776 renamed (retaining the same numerical value)
1779 .\" prctl PR_TASK_PERF_EVENTS_ENABLE
1781 .BR PR_TASK_PERF_EVENTS_ENABLE " (since Linux 2.6.31)"
1783 .BR PR_TASK_PERF_EVENTS_DISABLE ;
1784 enable performance counters attached to the calling process.
1787 .BR PR_TASK_PERF_COUNTERS_ENABLE ;
1788 .\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
1790 .\" commit cdd6c482c9ff9c55475ee7392ec8f672eddb7be6
1793 .\" prctl PR_SET_THP_DISABLE
1795 .BR PR_SET_THP_DISABLE " (since Linux 3.15)"
1796 .\" commit a0715cc22601e8830ace98366c0c2bd8da52af52
1797 Set the state of the "THP disable" flag for the calling thread.
1800 has a nonzero value, the flag is set, otherwise it is cleared.
1801 Setting this flag provides a method
1802 for disabling transparent huge pages
1803 for jobs where the code cannot be modified, and using a malloc hook with
1805 is not an option (i.e., statically allocated data).
1806 The setting of the "THP disable" flag is inherited by a child created via
1808 and is preserved across
1810 .\" prctl PR_GET_THP_DISABLE
1812 .BR PR_GET_THP_DISABLE " (since Linux 3.15)"
1813 Return (as the function result) the current setting of the "THP disable"
1814 flag for the calling thread:
1815 either 1, if the flag is set, or 0, if it is not.
1816 .\" prctl PR_GET_TID_ADDRESS
1818 .BR PR_GET_TID_ADDRESS " (since Linux 3.5)"
1819 .\" commit 300f786b2683f8bb1ec0afb6e1851183a479c86d
1823 .BR set_tid_address (2)
1826 .B CLONE_CHILD_CLEARTID
1827 flag, in the location pointed to by
1828 .IR "(int\ **)\ arg2" .
1829 This feature is available only if the kernel is built with the
1830 .BR CONFIG_CHECKPOINT_RESTORE
1834 system call does not have a compat implementation for
1835 the AMD64 x32 and MIPS n32 ABIs,
1836 and the kernel writes out a pointer using the kernel's pointer size,
1837 this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs.
1838 .\" prctl PR_SET_TIMERSLACK
1840 .BR PR_SET_TIMERSLACK " (since Linux 2.6.28)"
1841 .\" See https://lwn.net/Articles/369549/
1842 .\" commit 6976675d94042fbd446231d1bd8b7de71a980ada
1843 Each thread has two associated timer slack values:
1844 a "default" value, and a "current" value.
1845 This operation sets the "current" timer slack value for the calling thread.
1847 is an unsigned long value, then maximum "current" value is ULONG_MAX and
1848 the minimum "current" value is 1.
1849 If the nanosecond value supplied in
1851 is greater than zero, then the "current" value is set to this value.
1855 the "current" timer slack is reset to the
1856 thread's "default" timer slack value.
1858 The "current" timer slack is used by the kernel to group timer expirations
1859 for the calling thread that are close to one another;
1860 as a consequence, timer expirations for the thread may be
1861 up to the specified number of nanoseconds late (but will never expire early).
1862 Grouping timer expirations can help reduce system power consumption
1863 by minimizing CPU wake-ups.
1865 The timer expirations affected by timer slack are those set by
1871 .BR epoll_pwait (2),
1872 .BR clock_nanosleep (2),
1876 (and thus the library functions implemented via futexes, including
1877 .\" List obtained by grepping for futex usage in glibc source
1878 .BR pthread_cond_timedwait (3),
1879 .BR pthread_mutex_timedlock (3),
1880 .BR pthread_rwlock_timedrdlock (3),
1881 .BR pthread_rwlock_timedwrlock (3),
1883 .BR sem_timedwait (3)).
1885 Timer slack is not applied to threads that are scheduled under
1886 a real-time scheduling policy (see
1887 .BR sched_setscheduler (2)).
1889 When a new thread is created,
1890 the two timer slack values are made the same as the "current" value
1891 of the creating thread.
1892 Thereafter, a thread can adjust its "current" timer slack value via
1893 .BR PR_SET_TIMERSLACK .
1894 The "default" value can't be changed.
1895 The timer slack values of
1897 (PID 1), the ancestor of all processes,
1898 are 50,000 nanoseconds (50 microseconds).
1899 The timer slack value is inherited by a child created via
1901 and is preserved across
1904 Since Linux 4.6, the "current" timer slack value of any process
1905 can be examined and changed via the file
1906 .IR /proc/[pid]/timerslack_ns .
1909 .\" prctl PR_GET_TIMERSLACK
1911 .BR PR_GET_TIMERSLACK " (since Linux 2.6.28)"
1912 Return (as the function result)
1913 the "current" timer slack value of the calling thread.
1914 .\" prctl PR_SET_TIMING
1916 .BR PR_SET_TIMING " (since Linux 2.6.0)"
1917 .\" Precisely: Linux 2.6.0-test4
1918 Set whether to use (normal, traditional) statistical process timing or
1919 accurate timestamp-based process timing, by passing
1920 .B PR_TIMING_STATISTICAL
1923 .B PR_TIMING_TIMESTAMP
1926 .B PR_TIMING_TIMESTAMP
1927 is not currently implemented
1928 (attempting to set this mode will yield the error
1930 .\" PR_TIMING_TIMESTAMP doesn't do anything in 2.6.26-rc8,
1931 .\" and looking at the patch history, it appears
1932 .\" that it never did anything.
1933 .\" prctl PR_GET_TIMING
1935 .BR PR_GET_TIMING " (since Linux 2.6.0)"
1936 .\" Precisely: Linux 2.6.0-test4
1937 Return (as the function result) which process timing method is currently
1939 .\" prctl PR_SET_TSC
1941 .BR PR_SET_TSC " (since Linux 2.6.26, x86 only)"
1942 Set the state of the flag determining whether the timestamp counter
1943 can be read by the process.
1948 to allow it to be read, or
1952 when the process tries to read the timestamp counter.
1953 .\" prctl PR_GET_TSC
1955 .BR PR_GET_TSC " (since Linux 2.6.26, x86 only)"
1956 Return the state of the flag determining whether the timestamp counter
1958 in the location pointed to by
1959 .IR "(int\ *) arg2" .
1960 .\" prctl PR_SET_UNALIGN
1963 (Only on: ia64, since Linux 2.3.48; parisc, since Linux 2.6.15;
1964 PowerPC, since Linux 2.6.18; Alpha, since Linux 2.6.22;
1965 .\" sh: 94ea5e449ae834af058ef005d16a8ad44fcf13d6
1966 .\" tile: 2f9ac29eec71a696cb0dcc5fb82c0f8d4dac28c9
1967 sh, since Linux 2.6.34; tile, since Linux 3.12)
1968 Set unaligned access control bits to \fIarg2\fP.
1970 \fBPR_UNALIGN_NOPRINT\fP to silently fix up unaligned user accesses,
1971 or \fBPR_UNALIGN_SIGBUS\fP to generate
1973 on unaligned user access.
1974 Alpha also supports an additional flag with the value
1975 of 4 and no corresponding named constant,
1976 which instructs kernel to not fix up
1977 unaligned accesses (it is analogous to providing the
1983 system call on Tru64).
1984 .\" prctl PR_GET_UNALIGN
1989 for information on versions and architectures.)
1990 Return unaligned access control bits, in the location pointed to by
1991 .IR "(unsigned int\ *) arg2" .
1994 .BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
1995 .BR PR_CAPBSET_READ ,
1996 .BR PR_GET_DUMPABLE ,
1997 .BR PR_GET_FP_MODE ,
1998 .BR PR_GET_IO_FLUSHER ,
1999 .BR PR_GET_KEEPCAPS ,
2000 .BR PR_MCE_KILL_GET ,
2001 .BR PR_GET_NO_NEW_PRIVS ,
2002 .BR PR_GET_SECUREBITS ,
2003 .BR PR_GET_SPECULATION_CTRL ,
2006 .BR PR_GET_TAGGED_ADDR_CTRL ,
2007 .BR PR_GET_THP_DISABLE ,
2009 .BR PR_GET_TIMERSLACK ,
2012 return the nonnegative values described above.
2015 values return 0 on success.
2016 On error, \-1 is returned, and
2018 is set to indicate the error.
2028 .BR SECCOMP_MODE_FILTER ,
2029 but the process does not have the
2031 capability or has not set the
2033 attribute (see the discussion of
2034 .BR PR_SET_NO_NEW_PRIVS
2044 .BR PR_SET_MM_EXE_FILE ,
2045 the file is not executable.
2053 .BR PR_SET_MM_EXE_FILE ,
2054 and the file descriptor passed in
2064 .BR PR_SET_MM_EXE_FILE ,
2065 and this the second attempt to change the
2067 symbolic link, which is prohibited.
2071 is an invalid address.
2076 .BR PR_SET_SECCOMP ,
2079 .BR SECCOMP_MODE_FILTER ,
2080 the system was built with
2081 .BR CONFIG_SECCOMP_FILTER ,
2084 is an invalid address.
2089 .B PR_SET_SYSCALL_USER_DISPATCH
2092 has an invalid address.
2098 or not supported on this system.
2110 arguments were not specified as zero.
2114 is not valid value for this
2122 .BR PR_GET_SECCOMP ,
2123 and the kernel was not configured with
2124 .BR CONFIG_SECCOMP .
2129 .BR PR_SET_SECCOMP ,
2132 .BR SECCOMP_MODE_FILTER ,
2133 and the kernel was not configured with
2134 .BR CONFIG_SECCOMP_FILTER .
2140 and one of the following is true
2151 (the limit on the size of the user address space for this architecture);
2155 .BR PR_SET_MM_START_CODE ,
2156 .BR PR_SET_MM_END_CODE ,
2157 .BR PR_SET_MM_START_DATA ,
2158 .BR PR_SET_MM_END_DATA ,
2160 .BR PR_SET_MM_START_STACK ,
2161 and the permissions of the corresponding memory area are not as required;
2165 .BR PR_SET_MM_START_BRK
2170 is less than or equal to the end of the data segment
2171 or specifies a value that would cause the
2173 resource limit to be exceeded.
2183 .BR PR_SET_PTRACER_ANY ,
2184 or the PID of an existing process.
2192 is not a valid signal number.
2201 .B SUID_DUMP_DISABLE
2203 .BR SUID_DUMP_USER .
2212 .BR PR_TIMING_STATISTICAL .
2217 .BR PR_SET_NO_NEW_PRIVS
2231 .BR PR_GET_NO_NEW_PRIVS
2243 .BR PR_SET_THP_DISABLE
2254 .BR PR_GET_THP_DISABLE
2267 and an unused argument
2272 .BR PR_CAP_AMBIENT_CLEAR_ALL ,
2276 has an invalid value;
2280 .BR PR_CAP_AMBIENT_LOWER ,
2281 .BR PR_CAP_AMBIENT_RAISE ,
2283 .BR PR_CAP_AMBIENT_IS_SET
2286 does not specify a valid capability.
2291 .BR PR_GET_SPECULATION_CTRL
2293 .BR PR_SET_SPECULATION_CTRL
2294 and unused arguments to
2300 .B PR_PAC_RESET_KEYS
2301 and the arguments are invalid or unsupported.
2302 See the description of
2303 .B PR_PAC_RESET_KEYS
2310 and the arguments are invalid or unsupported,
2311 or SVE is not available on this platform.
2312 See the description of
2320 and SVE is not available on this platform.
2325 .B PR_SET_SYSCALL_USER_DISPATCH
2326 and one of the following is true:
2331 .B PR_SYS_DISPATCH_OFF
2332 and the remaining arguments are not 0;
2336 .B PR_SYS_DISPATCH_ON
2337 and the memory range specified is outside the
2338 address space of the process.
2347 .BR PR_SET_TAGGED_ADDR_CTRL
2348 and the arguments are invalid or unsupported.
2349 See the description of
2350 .B PR_SET_TAGGED_ADDR_CTRL
2356 .BR PR_GET_TAGGED_ADDR_CTRL
2357 and the arguments are invalid or unsupported.
2358 See the description of
2359 .B PR_GET_TAGGED_ADDR_CTRL
2365 .BR PR_SET_SPECULATION_CTRL
2366 the kernel or CPU does not support the requested speculation misfeature.
2371 .BR PR_MPX_ENABLE_MANAGEMENT
2373 .BR PR_MPX_DISABLE_MANAGEMENT
2374 and the kernel or the CPU does not support MPX management.
2375 Check that the kernel and processor have MPX support.
2380 .BR PR_SET_SPECULATION_CTRL
2381 implies that the control of the selected speculation misfeature is not possible.
2383 .BR PR_GET_SPECULATION_CTRL
2384 for the bit fields to determine which option is available.
2392 has an invalid or unsupported value.
2397 .BR PR_SET_SECUREBITS ,
2398 and the caller does not have the
2401 or tried to unset a "locked" flag,
2402 or tried to set a flag whose corresponding locked flag was set
2404 .BR capabilities (7)).
2409 .BR PR_SET_SPECULATION_CTRL
2410 wherein the speculation was disabled with
2411 .B PR_SPEC_FORCE_DISABLE
2412 and caller tried to enable it again.
2417 .BR PR_SET_KEEPCAPS ,
2419 .B SECBIT_KEEP_CAPS_LOCKED
2422 .BR capabilities (7)).
2427 .BR PR_CAPBSET_DROP ,
2428 and the caller does not have the
2436 and the caller does not have the
2447 .BR PR_CAP_AMBIENT_RAISE ,
2448 but either the capability specified in
2450 is not present in the process's permitted and inheritable capability sets,
2452 .B PR_CAP_AMBIENT_LOWER
2453 securebit has been set.
2458 .BR PR_SET_SPECULATION_CTRL
2462 .BR PR_SPEC_ENABLE ,
2463 .BR PR_SPEC_DISABLE ,
2464 .BR PR_SPEC_FORCE_DISABLE ,
2466 .BR PR_SPEC_DISABLE_NOEXEC .
2470 system call was introduced in Linux 2.1.57.
2471 .\" The library interface was added in glibc 2.0.6
2473 This call is Linux-specific.
2476 system call (also introduced in Linux 2.1.44
2477 as irix_prctl on the MIPS architecture),
2482 .BI "ptrdiff_t prctl(int " option ", int " arg2 ", int " arg3 );
2486 and options to get the maximum number of processes per user,
2487 get the maximum number of processors the calling process can use,
2488 find out whether a specified process is currently blocked,
2489 get or set the maximum stack size, and so on.