Blame man2/prctl.2

Packit 7cfc04
.\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl)
Packit 7cfc04
.\" and Copyright (C) 2002, 2006, 2008, 2012, 2013 Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\" and Copyright Guillem Jover <guillem@hadrons.org>
Packit 7cfc04
.\" and Copyright (C) 2014 Dave Hansen / Intel
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified Thu Nov 11 04:19:42 MET 1999, aeb: added PR_GET_PDEATHSIG
Packit 7cfc04
.\" Modified 27 Jun 02, Michael Kerrisk
Packit 7cfc04
.\" 	Added PR_SET_DUMPABLE, PR_GET_DUMPABLE,
Packit 7cfc04
.\"	PR_SET_KEEPCAPS, PR_GET_KEEPCAPS
Packit 7cfc04
.\" Modified 2006-08-30 Guillem Jover <guillem@hadrons.org>
Packit 7cfc04
.\"	Updated Linux versions where the options where introduced.
Packit 7cfc04
.\"	Added PR_SET_TIMING, PR_GET_TIMING, PR_SET_NAME, PR_GET_NAME,
Packit 7cfc04
.\"	PR_SET_UNALIGN, PR_GET_UNALIGN, PR_SET_FPEMU, PR_GET_FPEMU,
Packit 7cfc04
.\"	PR_SET_FPEXC, PR_GET_FPEXC
Packit 7cfc04
.\" 2008-04-29 Serge Hallyn, Document PR_CAPBSET_READ and PR_CAPBSET_DROP
Packit 7cfc04
.\" 2008-06-13 Erik Bosman, <ejbosman@cs.vu.nl>
Packit 7cfc04
.\"     Document PR_GET_TSC and PR_SET_TSC.
Packit 7cfc04
.\" 2008-06-15 mtk, Document PR_SET_SECCOMP, PR_GET_SECCOMP
Packit 7cfc04
.\" 2009-10-03 Andi Kleen, document PR_MCE_KILL
Packit 7cfc04
.\" 2012-04 Cyrill Gorcunov, Document PR_SET_MM
Packit 7cfc04
.\" 2012-04-25 Michael Kerrisk, Document PR_TASK_PERF_EVENTS_DISABLE and
Packit 7cfc04
.\"				PR_TASK_PERF_EVENTS_ENABLE
Packit 7cfc04
.\" 2012-09-20 Kees Cook, update PR_SET_SECCOMP for mode 2
Packit 7cfc04
.\" 2012-09-20 Kees Cook, document PR_SET_NO_NEW_PRIVS, PR_GET_NO_NEW_PRIVS
Packit 7cfc04
.\" 2012-10-25 Michael Kerrisk, Document PR_SET_TIMERSLACK and
Packit 7cfc04
.\"                             PR_GET_TIMERSLACK
Packit 7cfc04
.\" 2013-01-10 Kees Cook, document PR_SET_PTRACER
Packit 7cfc04
.\" 2012-02-04 Michael Kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER
Packit 7cfc04
.\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
Packit 7cfc04
.\"
Packit 7cfc04
.\"
Packit 7cfc04
.TH PRCTL 2 2018-02-02 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
prctl \- operations on a process
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <sys/prctl.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int prctl(int " option ", unsigned long " arg2 ", unsigned long " arg3 ,
Packit 7cfc04
.BI "          unsigned long " arg4 ", unsigned long " arg5 );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
is called with a first argument describing what to do
Packit 7cfc04
(with values defined in \fI<linux/prctl.h>\fP), and further
Packit 7cfc04
arguments with a significance depending on the first one.
Packit 7cfc04
The first argument can be:
Packit 7cfc04
.\"
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_CAP_AMBIENT " (since Linux 4.3)"
Packit 7cfc04
.\" commit 58319057b7847667f0c9585b9de0e8932b0fdb08
Packit 7cfc04
Reads or changes the ambient capability set of the calling thread,
Packit 7cfc04
according to the value of
Packit 7cfc04
.IR arg2 ,
Packit 7cfc04
which must be one of the following:
Packit 7cfc04
.RS
Packit 7cfc04
.\"
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_CAP_AMBIENT_RAISE
Packit 7cfc04
The capability specified in
Packit 7cfc04
.I arg3
Packit 7cfc04
is added to the ambient set.
Packit 7cfc04
The specified capability must already be present in
Packit 7cfc04
both the permitted and the inheritable sets of the process.
Packit 7cfc04
This operation is not permitted if the
Packit 7cfc04
.B SECBIT_NO_CAP_AMBIENT_RAISE
Packit 7cfc04
securebit is set.
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_CAP_AMBIENT_LOWER
Packit 7cfc04
The capability specified in
Packit 7cfc04
.I arg3
Packit 7cfc04
is removed from the ambient set.
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_CAP_AMBIENT_IS_SET
Packit 7cfc04
The
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
call returns 1 if the capability in
Packit 7cfc04
.I arg3
Packit 7cfc04
is in the ambient set and 0 if it is not.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_CAP_AMBIENT_CLEAR_ALL
Packit 7cfc04
All capabilities will be removed from the ambient set.
Packit 7cfc04
This operation requires setting
Packit 7cfc04
.I arg3
Packit 7cfc04
to zero.
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
In all of the above operations,
Packit 7cfc04
.I arg4
Packit 7cfc04
and
Packit 7cfc04
.I arg5
Packit 7cfc04
must be specified as 0.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_CAPBSET_READ " (since Linux 2.6.25)"
Packit 7cfc04
Return (as the function result) 1 if the capability specified in
Packit 7cfc04
.I arg2
Packit 7cfc04
is in the calling thread's capability bounding set,
Packit 7cfc04
or 0 if it is not.
Packit 7cfc04
(The capability constants are defined in
Packit 7cfc04
.IR <linux/capability.h> .)
Packit 7cfc04
The capability bounding set dictates
Packit 7cfc04
whether the process can receive the capability through a
Packit 7cfc04
file's permitted capability set on a subsequent call to
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.IP
Packit 7cfc04
If the capability specified in
Packit 7cfc04
.I arg2
Packit 7cfc04
is not valid, then the call fails with the error
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_CAPBSET_DROP " (since Linux 2.6.25)"
Packit 7cfc04
If the calling thread has the
Packit 7cfc04
.B CAP_SETPCAP
Packit 7cfc04
capability within its user namespace, then drop the capability specified by
Packit 7cfc04
.I arg2
Packit 7cfc04
from the calling thread's capability bounding set.
Packit 7cfc04
Any children of the calling thread will inherit the newly
Packit 7cfc04
reduced bounding set.
Packit 7cfc04
.IP
Packit 7cfc04
The call fails with the error:
Packit 7cfc04
.B EPERM
Packit 7cfc04
if the calling thread does not have the
Packit 7cfc04
.BR CAP_SETPCAP ;
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
if
Packit 7cfc04
.I arg2
Packit 7cfc04
does not represent a valid capability; or
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
if file capabilities are not enabled in the kernel,
Packit 7cfc04
in which case bounding sets are not supported.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_CHILD_SUBREAPER " (since Linux 3.4)"
Packit 7cfc04
.\" commit ebec18a6d3aa1e7d84aab16225e87fd25170ec2b
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
is nonzero,
Packit 7cfc04
set the "child subreaper" attribute of the calling process;
Packit 7cfc04
if
Packit 7cfc04
.I arg2
Packit 7cfc04
is zero, unset the attribute.
Packit 7cfc04
.IP
Packit 7cfc04
A subreaper fulfills the role of
Packit 7cfc04
.BR init (1)
Packit 7cfc04
for its descendant processes.
Packit 7cfc04
When a process becomes orphaned
Packit 7cfc04
(i.e., its immediate parent terminates)
Packit 7cfc04
then that process will be reparented to
Packit 7cfc04
the nearest still living ancestor subreaper.
Packit 7cfc04
Subsequently, calls to
Packit 7cfc04
.BR getppid ()
Packit 7cfc04
in the orphaned process will now return the PID of the subreaper process,
Packit 7cfc04
and when the orphan terminates, it is the subreaper process that
Packit 7cfc04
will receive a
Packit 7cfc04
.BR SIGCHLD
Packit 7cfc04
signal and will be able to
Packit 7cfc04
.BR wait (2)
Packit 7cfc04
on the process to discover its termination status.
Packit 7cfc04
.IP
Packit 7cfc04
The setting of this bit is not inherited by children created by
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
and
Packit 7cfc04
.BR clone (2).
Packit 7cfc04
The setting is preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.IP
Packit 7cfc04
Establishing a subreaper process is useful in session management frameworks
Packit 7cfc04
where a hierarchical group of processes is managed by a subreaper process
Packit 7cfc04
that needs to be informed when one of the processes\(emfor example,
Packit 7cfc04
a double-forked daemon\(emterminates
Packit 7cfc04
(perhaps so that it can restart that process).
Packit 7cfc04
Some
Packit 7cfc04
.BR init (1)
Packit 7cfc04
frameworks (e.g.,
Packit 7cfc04
.BR systemd (1))
Packit 7cfc04
employ a subreaper process for similar reasons.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_CHILD_SUBREAPER " (since Linux 3.4)"
Packit 7cfc04
Return the "child subreaper" setting of the caller,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_DUMPABLE " (since Linux 2.3.20)"
Packit 7cfc04
Set the state of the "dumpable" flag,
Packit 7cfc04
which determines whether core dumps are produced for the calling process
Packit 7cfc04
upon delivery of a signal whose default behavior is to produce a core dump.
Packit 7cfc04
.IP
Packit 7cfc04
In kernels up to and including 2.6.12,
Packit 7cfc04
.I arg2
Packit 7cfc04
must be either 0
Packit 7cfc04
.RB ( SUID_DUMP_DISABLE ,
Packit 7cfc04
process is not dumpable) or 1
Packit 7cfc04
.RB ( SUID_DUMP_USER ,
Packit 7cfc04
process is dumpable).
Packit 7cfc04
Between kernels 2.6.13 and 2.6.17,
Packit 7cfc04
.\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502
Packit 7cfc04
the value 2 was also permitted,
Packit 7cfc04
which caused any binary which normally would not be dumped
Packit 7cfc04
to be dumped readable by root only;
Packit 7cfc04
for security reasons, this feature has been removed.
Packit 7cfc04
.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2
Packit 7cfc04
.\" Subject:    Fix prctl privilege escalation (CVE-2006-2451)
Packit 7cfc04
.\" From:       Marcel Holtmann <marcel () holtmann ! org>
Packit 7cfc04
.\" Date:       2006-07-12 11:12:00
Packit 7cfc04
(See also the description of
Packit 7cfc04
.I /proc/sys/fs/\:suid_dumpable
Packit 7cfc04
in
Packit 7cfc04
.BR proc (5).)
Packit 7cfc04
.IP
Packit 7cfc04
Normally, this flag is set to 1.
Packit 7cfc04
However, it is reset to the current value contained in the file
Packit 7cfc04
.IR /proc/sys/fs/\:suid_dumpable
Packit 7cfc04
(which by default has the value 0),
Packit 7cfc04
in the following circumstances:
Packit 7cfc04
.\" See kernel/cred.c::commit_creds() (Linux 3.18 sources)
Packit 7cfc04
.RS
Packit 7cfc04
.IP * 3
Packit 7cfc04
The process's effective user or group ID is changed.
Packit 7cfc04
.IP *
Packit 7cfc04
The process's filesystem user or group ID is changed (see
Packit 7cfc04
.BR credentials (7)).
Packit 7cfc04
.IP *
Packit 7cfc04
The process executes
Packit 7cfc04
.RB ( execve (2))
Packit 7cfc04
a set-user-ID or set-group-ID program, resulting in a change
Packit 7cfc04
of either the effective user ID or the effective group ID.
Packit 7cfc04
.IP *
Packit 7cfc04
The process executes
Packit 7cfc04
.RB ( execve (2))
Packit 7cfc04
a program that has file capabilities (see
Packit 7cfc04
.BR capabilities (7)),
Packit 7cfc04
.\" See kernel/cred.c::commit_creds()
Packit 7cfc04
but only if the permitted capabilities
Packit 7cfc04
gained exceed those already permitted for the process.
Packit 7cfc04
.\" Also certain namespace operations;
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
Processes that are not dumpable can not be attached via
Packit 7cfc04
.BR ptrace (2)
Packit 7cfc04
.BR PTRACE_ATTACH ;
Packit 7cfc04
see
Packit 7cfc04
.BR ptrace (2)
Packit 7cfc04
for further details.
Packit 7cfc04
.IP
Packit 7cfc04
If a process is not dumpable,
Packit 7cfc04
the ownership of files in the process's
Packit 7cfc04
.IR /proc/[pid]
Packit 7cfc04
directory is affected as described in
Packit 7cfc04
.BR proc (5).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_DUMPABLE " (since Linux 2.3.20)"
Packit 7cfc04
Return (as the function result) the current state of the calling
Packit 7cfc04
process's dumpable flag.
Packit 7cfc04
.\" Since Linux 2.6.13, the dumpable flag can have the value 2,
Packit 7cfc04
.\" but in 2.6.13 PR_GET_DUMPABLE simply returns 1 if the dumpable
Packit 7cfc04
.\" flags has a nonzero value.  This was fixed in 2.6.14.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
Packit 7cfc04
Set the endian-ness of the calling process to the value given
Packit 7cfc04
in \fIarg2\fP, which should be one of the following:
Packit 7cfc04
.\" Respectively 0, 1, 2
Packit 7cfc04
.BR PR_ENDIAN_BIG ,
Packit 7cfc04
.BR PR_ENDIAN_LITTLE ,
Packit 7cfc04
or
Packit 7cfc04
.B PR_ENDIAN_PPC_LITTLE
Packit 7cfc04
(PowerPC pseudo little endian).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_ENDIAN " (since Linux 2.6.18, PowerPC only)"
Packit 7cfc04
Return the endian-ness of the calling process,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_FP_MODE " (since Linux 4.0, only on MIPS)"
Packit 7cfc04
.\" commit 9791554b45a2acc28247f66a5fd5bbc212a6b8c8
Packit 7cfc04
On the MIPS architecture,
Packit 7cfc04
user-space code can be built using an ABI which permits linking
Packit 7cfc04
with code that has more restrictive floating-point (FP) requirements.
Packit 7cfc04
For example, user-space code may be built to target the O32 FPXX ABI
Packit 7cfc04
and linked with code built for either one of the more restrictive
Packit 7cfc04
FP32 or FP64 ABIs.
Packit 7cfc04
When more restrictive code is linked in,
Packit 7cfc04
the overall requirement for the process is to use the more
Packit 7cfc04
restrictive floating-point mode.
Packit 7cfc04
.IP
Packit 7cfc04
Because the kernel has no means of knowing in advance
Packit 7cfc04
which mode the process should be executed in,
Packit 7cfc04
and because these restrictions can
Packit 7cfc04
change over the lifetime of the process, the
Packit 7cfc04
.B PR_SET_FP_MODE
Packit 7cfc04
operation is provided to allow control of the floating-point mode
Packit 7cfc04
from user space.
Packit 7cfc04
.IP
Packit 7cfc04
.\" https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
Packit 7cfc04
The
Packit 7cfc04
.I (unsigned int) arg2
Packit 7cfc04
argument is a bit mask describing the floating-point mode used:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_FP_MODE_FR
Packit 7cfc04
When this bit is
Packit 7cfc04
.I unset
Packit 7cfc04
(so called
Packit 7cfc04
.BR FR=0 " or " FR0
Packit 7cfc04
mode), the 32 floating-point registers are 32 bits wide,
Packit 7cfc04
and 64-bit registers are represented as a pair of registers
Packit 7cfc04
(even- and odd- numbered,
Packit 7cfc04
with the even-numbered register containing the lower 32 bits,
Packit 7cfc04
and the odd-numbered register containing the higher 32 bits).
Packit 7cfc04
.IP
Packit 7cfc04
When this bit is
Packit 7cfc04
.I set
Packit 7cfc04
(on supported hardware),
Packit 7cfc04
the 32 floating-point registers are 64 bits wide (so called
Packit 7cfc04
.BR FR=1 " or " FR1
Packit 7cfc04
mode).
Packit 7cfc04
Note that modern MIPS implementations (MIPS R6 and newer) support
Packit 7cfc04
.B FR=1
Packit 7cfc04
mode only.
Packit 7cfc04
.IP
Packit 7cfc04
.IP
Packit 7cfc04
Applications that use the O32 FP32 ABI can operate only when this bit is
Packit 7cfc04
.I unset
Packit 7cfc04
.RB ( FR=0 ;
Packit 7cfc04
or they can be used with FRE enabled, see below).
Packit 7cfc04
Applications that use the O32 FP64 ABI
Packit 7cfc04
(and the O32 FP64A ABI, which exists to
Packit 7cfc04
provide the ability to operate with existing FP32 code; see below)
Packit 7cfc04
can operate only when this bit is
Packit 7cfc04
.I set
Packit 7cfc04
.RB ( FR=1 ).
Packit 7cfc04
Applications that use the O32 FPXX ABI can operate with either
Packit 7cfc04
.BR FR=0
Packit 7cfc04
or
Packit 7cfc04
.BR FR=1 .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_FP_MODE_FRE
Packit 7cfc04
Enable emulation of 32-bit floating-point mode.
Packit 7cfc04
When this mode is enabled,
Packit 7cfc04
it emulates 32-bit floating-point operations
Packit 7cfc04
by raising a reserved-instruction exception
Packit 7cfc04
on every instruction that uses 32-bit formats and
Packit 7cfc04
the kernel then handles the instruction in software.
Packit 7cfc04
(The problem lies in the discrepancy of handling odd-numbered registers
Packit 7cfc04
which are the high 32 bits of 64-bit registers with even numbers in
Packit 7cfc04
.B FR=0
Packit 7cfc04
mode and the lower 32-bit parts of odd-numbered 64-bit registers in
Packit 7cfc04
.B FR=1
Packit 7cfc04
mode.)
Packit 7cfc04
Enabling this bit is necessary when code with the O32 FP32 ABI should operate
Packit 7cfc04
with code with compatible the O32 FPXX or O32 FP64A ABIs (which require
Packit 7cfc04
.B FR=1
Packit 7cfc04
FPU mode) or when it is executed on newer hardware (MIPS R6 onwards)
Packit 7cfc04
which lacks
Packit 7cfc04
.B FR=0
Packit 7cfc04
mode support when a binary with the FP32 ABI is used.
Packit 7cfc04
.IP
Packit 7cfc04
Note that this mode makes sense only when the FPU is in 64-bit mode
Packit 7cfc04
.RB ( FR=1 ).
Packit 7cfc04
.IP
Packit 7cfc04
Note that the use of emulation inherently has a significant performance hit
Packit 7cfc04
and should be avoided if possible.
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
In the N32/N64 ABI, 64-bit floating-point mode is always used,
Packit 7cfc04
so FPU emulation is not required and the FPU always operates in
Packit 7cfc04
.B FR=1
Packit 7cfc04
mode.
Packit 7cfc04
.IP
Packit 7cfc04
This option is mainly intended for use by the dynamic linker
Packit 7cfc04
.RB ( ld.so (8)).
Packit 7cfc04
.IP
Packit 7cfc04
The arguments
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
and
Packit 7cfc04
.IR arg5
Packit 7cfc04
are ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_FP_MODE " (since Linux 4.0, only on MIPS)"
Packit 7cfc04
Get the current floating-point mode (see the description of
Packit 7cfc04
.B PR_SET_FP_MODE
Packit 7cfc04
for details).
Packit 7cfc04
.IP
Packit 7cfc04
On success,
Packit 7cfc04
the call returns a bit mask which represents the current floating-point mode.
Packit 7cfc04
.IP
Packit 7cfc04
The arguments
Packit 7cfc04
.IR arg2 ,
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
and
Packit 7cfc04
.IR arg5
Packit 7cfc04
are ignored.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
Packit 7cfc04
Set floating-point emulation control bits to \fIarg2\fP.
Packit 7cfc04
Pass
Packit 7cfc04
.B PR_FPEMU_NOPRINT
Packit 7cfc04
to silently emulate floating-point operation accesses, or
Packit 7cfc04
.B PR_FPEMU_SIGFPE
Packit 7cfc04
to not emulate floating-point operations and send
Packit 7cfc04
.B SIGFPE
Packit 7cfc04
instead.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_FPEMU " (since Linux 2.4.18, 2.5.9, only on ia64)"
Packit 7cfc04
Return floating-point emulation control bits,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
Packit 7cfc04
Set floating-point exception mode to \fIarg2\fP.
Packit 7cfc04
Pass \fBPR_FP_EXC_SW_ENABLE\fP to use FPEXC for FP exception enables,
Packit 7cfc04
\fBPR_FP_EXC_DIV\fP for floating-point divide by zero,
Packit 7cfc04
\fBPR_FP_EXC_OVF\fP for floating-point overflow,
Packit 7cfc04
\fBPR_FP_EXC_UND\fP for floating-point underflow,
Packit 7cfc04
\fBPR_FP_EXC_RES\fP for floating-point inexact result,
Packit 7cfc04
\fBPR_FP_EXC_INV\fP for floating-point invalid operation,
Packit 7cfc04
\fBPR_FP_EXC_DISABLED\fP for FP exceptions disabled,
Packit 7cfc04
\fBPR_FP_EXC_NONRECOV\fP for async nonrecoverable exception mode,
Packit 7cfc04
\fBPR_FP_EXC_ASYNC\fP for async recoverable exception mode,
Packit 7cfc04
\fBPR_FP_EXC_PRECISE\fP for precise exception mode.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_FPEXC " (since Linux 2.4.21, 2.5.32, only on PowerPC)"
Packit 7cfc04
Return floating-point exception mode,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_KEEPCAPS " (since Linux 2.2.18)"
Packit 7cfc04
Set the state of the calling thread's "keep capabilities" flag.
Packit 7cfc04
The effect if this flag is described in
Packit 7cfc04
.BR capabilities (7).
Packit 7cfc04
.I arg2
Packit 7cfc04
must be either 0 (clear the flag)
Packit 7cfc04
or 1 (set the flag).
Packit 7cfc04
The "keep capabilities" value will be reset to 0 on subsequent calls to
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_KEEPCAPS " (since Linux 2.2.18)"
Packit 7cfc04
Return (as the function result) the current state of the calling thread's
Packit 7cfc04
"keep capabilities" flag.
Packit 7cfc04
See
Packit 7cfc04
.BR capabilities (7)
Packit 7cfc04
for a description of this flag.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_MCE_KILL " (since Linux 2.6.32)"
Packit 7cfc04
Set the machine check memory corruption kill policy for the calling thread.
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_MCE_KILL_CLEAR ,
Packit 7cfc04
clear the thread memory corruption kill policy and use the system-wide default.
Packit 7cfc04
(The system-wide default is defined by
Packit 7cfc04
.IR /proc/sys/vm/memory_failure_early_kill ;
Packit 7cfc04
see
Packit 7cfc04
.BR proc (5).)
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_MCE_KILL_SET ,
Packit 7cfc04
use a thread-specific memory corruption kill policy.
Packit 7cfc04
In this case,
Packit 7cfc04
.I arg3
Packit 7cfc04
defines whether the policy is
Packit 7cfc04
.I early kill
Packit 7cfc04
.RB ( PR_MCE_KILL_EARLY ),
Packit 7cfc04
.I late kill
Packit 7cfc04
.RB ( PR_MCE_KILL_LATE ),
Packit 7cfc04
or the system-wide default
Packit 7cfc04
.RB ( PR_MCE_KILL_DEFAULT ).
Packit 7cfc04
Early kill means that the thread receives a
Packit 7cfc04
.B SIGBUS
Packit 7cfc04
signal as soon as hardware memory corruption is detected inside
Packit 7cfc04
its address space.
Packit 7cfc04
In late kill mode, the process is killed only when it accesses a corrupted page.
Packit 7cfc04
See
Packit 7cfc04
.BR sigaction (2)
Packit 7cfc04
for more information on the
Packit 7cfc04
.BR SIGBUS
Packit 7cfc04
signal.
Packit 7cfc04
The policy is inherited by children.
Packit 7cfc04
The remaining unused
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
arguments must be zero for future compatibility.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_MCE_KILL_GET " (since Linux 2.6.32)"
Packit 7cfc04
Return the current per-process machine check kill policy.
Packit 7cfc04
All unused
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
arguments must be zero.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM " (since Linux 3.3)"
Packit 7cfc04
.\" commit 028ee4be34a09a6d48bdf30ab991ae933a7bc036
Packit 7cfc04
Modify certain kernel memory map descriptor fields
Packit 7cfc04
of the calling process.
Packit 7cfc04
Usually these fields are set by the kernel and dynamic loader (see
Packit 7cfc04
.BR ld.so (8)
Packit 7cfc04
for more information) and a regular application should not use this feature.
Packit 7cfc04
However, there are cases, such as self-modifying programs,
Packit 7cfc04
where a program might find it useful to change its own memory map.
Packit 7cfc04
.IP
Packit 7cfc04
The calling process must have the
Packit 7cfc04
.BR CAP_SYS_RESOURCE
Packit 7cfc04
capability.
Packit 7cfc04
The value in
Packit 7cfc04
.I arg2
Packit 7cfc04
is one of the options below, while
Packit 7cfc04
.I arg3
Packit 7cfc04
provides a new value for the option.
Packit 7cfc04
The
Packit 7cfc04
.I arg4
Packit 7cfc04
and
Packit 7cfc04
.I arg5
Packit 7cfc04
arguments must be zero if unused.
Packit 7cfc04
.IP
Packit 7cfc04
.\" commit 52b3694157e3aa6df871e283115652ec6f2d31e0
Packit 7cfc04
Since Linux 3.10,
Packit 7cfc04
this feature is available all the time.
Packit 7cfc04
Before Linux 3.10,
Packit 7cfc04
this feature is available only if the kernel is built with the
Packit 7cfc04
.BR CONFIG_CHECKPOINT_RESTORE
Packit 7cfc04
option enabled.
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_START_CODE
Packit 7cfc04
Set the address above which the program text can run.
Packit 7cfc04
The corresponding memory area must be readable and executable,
Packit 7cfc04
but not writable or shareable (see
Packit 7cfc04
.BR mprotect (2)
Packit 7cfc04
and
Packit 7cfc04
.BR mmap (2)
Packit 7cfc04
for more information).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_END_CODE
Packit 7cfc04
Set the address below which the program text can run.
Packit 7cfc04
The corresponding memory area must be readable and executable,
Packit 7cfc04
but not writable or shareable.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_START_DATA
Packit 7cfc04
Set the address above which initialized and
Packit 7cfc04
uninitialized (bss) data are placed.
Packit 7cfc04
The corresponding memory area must be readable and writable,
Packit 7cfc04
but not executable or shareable.
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_SET_MM_END_DATA
Packit 7cfc04
Set the address below which initialized and
Packit 7cfc04
uninitialized (bss) data are placed.
Packit 7cfc04
The corresponding memory area must be readable and writable,
Packit 7cfc04
but not executable or shareable.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_START_STACK
Packit 7cfc04
Set the start address of the stack.
Packit 7cfc04
The corresponding memory area must be readable and writable.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_START_BRK
Packit 7cfc04
Set the address above which the program heap can be expanded with
Packit 7cfc04
.BR brk (2)
Packit 7cfc04
call.
Packit 7cfc04
The address must be greater than the ending address of
Packit 7cfc04
the current program data segment.
Packit 7cfc04
In addition, the combined size of the resulting heap and
Packit 7cfc04
the size of the data segment can't exceed the
Packit 7cfc04
.BR RLIMIT_DATA
Packit 7cfc04
resource limit (see
Packit 7cfc04
.BR setrlimit (2)).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_BRK
Packit 7cfc04
Set the current
Packit 7cfc04
.BR brk (2)
Packit 7cfc04
value.
Packit 7cfc04
The requirements for the address are the same as for the
Packit 7cfc04
.BR PR_SET_MM_START_BRK
Packit 7cfc04
option.
Packit 7cfc04
.PP
Packit 7cfc04
The following options are available since Linux 3.5.
Packit 7cfc04
.\" commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_ARG_START
Packit 7cfc04
Set the address above which the program command line is placed.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_ARG_END
Packit 7cfc04
Set the address below which the program command line is placed.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_ENV_START
Packit 7cfc04
Set the address above which the program environment is placed.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_ENV_END
Packit 7cfc04
Set the address below which the program environment is placed.
Packit 7cfc04
.IP
Packit 7cfc04
The address passed with
Packit 7cfc04
.BR PR_SET_MM_ARG_START ,
Packit 7cfc04
.BR PR_SET_MM_ARG_END ,
Packit 7cfc04
.BR PR_SET_MM_ENV_START ,
Packit 7cfc04
and
Packit 7cfc04
.BR PR_SET_MM_ENV_END
Packit 7cfc04
should belong to a process stack area.
Packit 7cfc04
Thus, the corresponding memory area must be readable, writable, and
Packit 7cfc04
(depending on the kernel configuration) have the
Packit 7cfc04
.BR MAP_GROWSDOWN
Packit 7cfc04
attribute set (see
Packit 7cfc04
.BR mmap (2)).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_AUXV
Packit 7cfc04
Set a new auxiliary vector.
Packit 7cfc04
The
Packit 7cfc04
.I arg3
Packit 7cfc04
argument should provide the address of the vector.
Packit 7cfc04
The
Packit 7cfc04
.I arg4
Packit 7cfc04
is the size of the vector.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_EXE_FILE
Packit 7cfc04
.\" commit b32dfe377102ce668775f8b6b1461f7ad428f8b6
Packit 7cfc04
Supersede the
Packit 7cfc04
.IR /proc/pid/exe
Packit 7cfc04
symbolic link with a new one pointing to a new executable file
Packit 7cfc04
identified by the file descriptor provided in
Packit 7cfc04
.I arg3
Packit 7cfc04
argument.
Packit 7cfc04
The file descriptor should be obtained with a regular
Packit 7cfc04
.BR open (2)
Packit 7cfc04
call.
Packit 7cfc04
.IP
Packit 7cfc04
To change the symbolic link, one needs to unmap all existing
Packit 7cfc04
executable memory areas, including those created by the kernel itself
Packit 7cfc04
(for example the kernel usually creates at least one executable
Packit 7cfc04
memory area for the ELF
Packit 7cfc04
.IR \.text
Packit 7cfc04
section).
Packit 7cfc04
.IP
Packit 7cfc04
The second limitation is that such transitions can be done only once
Packit 7cfc04
in a process life time.
Packit 7cfc04
Any further attempts will be rejected.
Packit 7cfc04
This should help system administrators monitor unusual
Packit 7cfc04
symbolic-link transitions over all processes running on a system.
Packit 7cfc04
.PP
Packit 7cfc04
The following options are available since Linux 3.18.
Packit 7cfc04
.\" commit f606b77f1a9e362451aca8f81d8f36a3a112139e
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_MAP
Packit 7cfc04
Provides one-shot access to all the addresses by passing in a
Packit 7cfc04
.I struct prctl_mm_map
Packit 7cfc04
(as defined in \fI<linux/prctl.h>\fP).
Packit 7cfc04
The
Packit 7cfc04
.I arg4
Packit 7cfc04
argument should provide the size of the struct.
Packit 7cfc04
.IP
Packit 7cfc04
This feature is available only if the kernel is built with the
Packit 7cfc04
.BR CONFIG_CHECKPOINT_RESTORE
Packit 7cfc04
option enabled.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_MM_MAP_SIZE
Packit 7cfc04
Returns the size of the
Packit 7cfc04
.I struct prctl_mm_map
Packit 7cfc04
the kernel expects.
Packit 7cfc04
This allows user space to find a compatible struct.
Packit 7cfc04
The
Packit 7cfc04
.I arg4
Packit 7cfc04
argument should be a pointer to an unsigned int.
Packit 7cfc04
.IP
Packit 7cfc04
This feature is available only if the kernel is built with the
Packit 7cfc04
.BR CONFIG_CHECKPOINT_RESTORE
Packit 7cfc04
option enabled.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_MPX_ENABLE_MANAGEMENT ", " PR_MPX_DISABLE_MANAGEMENT " (since Linux 3.19) "
Packit 7cfc04
.\" commit fe3d197f84319d3bce379a9c0dc17b1f48ad358c
Packit 7cfc04
.\" See also http://lwn.net/Articles/582712/
Packit 7cfc04
.\" See also https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
Packit 7cfc04
Enable or disable kernel management of Memory Protection eXtensions (MPX)
Packit 7cfc04
bounds tables.
Packit 7cfc04
The
Packit 7cfc04
.IR arg2 ,
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
and
Packit 7cfc04
.IR arg5
Packit 7cfc04
.\" commit e9d1b4f3c60997fe197bf0243cb4a41a44387a88
Packit 7cfc04
arguments must be zero.
Packit 7cfc04
.IP
Packit 7cfc04
MPX is a hardware-assisted mechanism for performing bounds checking on
Packit 7cfc04
pointers.
Packit 7cfc04
It consists of a set of registers storing bounds information
Packit 7cfc04
and a set of special instruction prefixes that tell the CPU on which
Packit 7cfc04
instructions it should do bounds enforcement.
Packit 7cfc04
There is a limited number of these registers and
Packit 7cfc04
when there are more pointers than registers,
Packit 7cfc04
their contents must be "spilled" into a set of tables.
Packit 7cfc04
These tables are called "bounds tables" and the MPX
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
operations control
Packit 7cfc04
whether the kernel manages their allocation and freeing.
Packit 7cfc04
.IP
Packit 7cfc04
When management is enabled, the kernel will take over allocation
Packit 7cfc04
and freeing of the bounds tables.
Packit 7cfc04
It does this by trapping the #BR exceptions that result
Packit 7cfc04
at first use of missing bounds tables and
Packit 7cfc04
instead of delivering the exception to user space,
Packit 7cfc04
it allocates the table and populates the bounds directory
Packit 7cfc04
with the location of the new table.
Packit 7cfc04
For freeing, the kernel checks to see if bounds tables are
Packit 7cfc04
present for memory which is not allocated, and frees them if so.
Packit 7cfc04
.IP
Packit 7cfc04
Before enabling MPX management using
Packit 7cfc04
.BR PR_MPX_ENABLE_MANAGEMENT ,
Packit 7cfc04
the application must first have allocated a user-space buffer for
Packit 7cfc04
the bounds directory and placed the location of that directory in the
Packit 7cfc04
.I bndcfgu
Packit 7cfc04
register.
Packit 7cfc04
.IP
Packit 7cfc04
These calls fail if the CPU or kernel does not support MPX.
Packit 7cfc04
Kernel support for MPX is enabled via the
Packit 7cfc04
.BR CONFIG_X86_INTEL_MPX
Packit 7cfc04
configuration option.
Packit 7cfc04
You can check whether the CPU supports MPX by looking for the 'mpx'
Packit 7cfc04
CPUID bit, like with the following command:
Packit 7cfc04
.IP
Packit 7cfc04
	cat /proc/cpuinfo | grep ' mpx '
Packit 7cfc04
.IP
Packit 7cfc04
A thread may not switch in or out of long (64-bit) mode while MPX is
Packit 7cfc04
enabled.
Packit 7cfc04
.IP
Packit 7cfc04
All threads in a process are affected by these calls.
Packit 7cfc04
.IP
Packit 7cfc04
The child of a
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
inherits the state of MPX management.
Packit 7cfc04
During
Packit 7cfc04
.BR execve (2),
Packit 7cfc04
MPX management is reset to a state as if
Packit 7cfc04
.BR PR_MPX_DISABLE_MANAGEMENT
Packit 7cfc04
had been called.
Packit 7cfc04
.IP
Packit 7cfc04
For further information on Intel MPX, see the kernel source file
Packit 7cfc04
.IR Documentation/x86/intel_mpx.txt .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_NAME " (since Linux 2.6.9)"
Packit 7cfc04
Set the name of the calling thread,
Packit 7cfc04
using the value in the location pointed to by
Packit 7cfc04
.IR "(char\ *) arg2" .
Packit 7cfc04
The name can be up to 16 bytes long,
Packit 7cfc04
.\" TASK_COMM_LEN in include/linux/sched.h
Packit 7cfc04
including the terminating null byte.
Packit 7cfc04
(If the length of the string, including the terminating null byte,
Packit 7cfc04
exceeds 16 bytes, the string is silently truncated.)
Packit 7cfc04
This is the same attribute that can be set via
Packit 7cfc04
.BR pthread_setname_np (3)
Packit 7cfc04
and retrieved using
Packit 7cfc04
.BR pthread_getname_np (3).
Packit 7cfc04
The attribute is likewise accessible via
Packit 7cfc04
.IR /proc/self/task/[tid]/comm ,
Packit 7cfc04
where
Packit 7cfc04
.I tid
Packit 7cfc04
is the name of the calling thread.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_NAME " (since Linux 2.6.11)"
Packit 7cfc04
Return the name of the calling thread,
Packit 7cfc04
in the buffer pointed to by
Packit 7cfc04
.IR "(char\ *) arg2" .
Packit 7cfc04
The buffer should allow space for up to 16 bytes;
Packit 7cfc04
the returned string will be null-terminated.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_NO_NEW_PRIVS " (since Linux 3.5)"
Packit 7cfc04
Set the calling thread's
Packit 7cfc04
.I no_new_privs
Packit 7cfc04
bit to the value in
Packit 7cfc04
.IR arg2 .
Packit 7cfc04
With
Packit 7cfc04
.I no_new_privs
Packit 7cfc04
set to 1,
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
promises not to grant privileges to do anything
Packit 7cfc04
that could not have been done without the
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
call (for example,
Packit 7cfc04
rendering the set-user-ID and set-group-ID mode bits,
Packit 7cfc04
and file capabilities non-functional).
Packit 7cfc04
Once set, this bit cannot be unset.
Packit 7cfc04
The setting of this bit is inherited by children created by
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
and
Packit 7cfc04
.BR clone (2),
Packit 7cfc04
and preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.IP
Packit 7cfc04
Since Linux 4.10,
Packit 7cfc04
the value of a thread's
Packit 7cfc04
.I no_new_privs
Packit 7cfc04
bit can be viewed via the
Packit 7cfc04
.I NoNewPrivs
Packit 7cfc04
field in the
Packit 7cfc04
.IR /proc/[pid]/status
Packit 7cfc04
file.
Packit 7cfc04
.IP
Packit 7cfc04
For more information, see the kernel source file
Packit 7cfc04
.IR Documentation/userspace\-api/no_new_privs.rst
Packit 7cfc04
.\" commit 40fde647ccb0ae8c11d256d271e24d385eed595b
Packit 7cfc04
(or
Packit 7cfc04
.IR Documentation/prctl/no_new_privs.txt
Packit 7cfc04
before Linux 4.13).
Packit 7cfc04
See also
Packit 7cfc04
.BR seccomp (2).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_NO_NEW_PRIVS " (since Linux 3.5)"
Packit 7cfc04
Return (as the function result) the value of the
Packit 7cfc04
.I no_new_privs
Packit 7cfc04
bit for the calling thread.
Packit 7cfc04
A value of 0 indicates the regular
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
behavior.
Packit 7cfc04
A value of 1 indicates
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
will operate in the privilege-restricting mode described above.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_PDEATHSIG " (since Linux 2.1.57)"
Packit 7cfc04
Set the parent death signal
Packit 7cfc04
of the calling process to \fIarg2\fP (either a signal value
Packit 7cfc04
in the range 1..maxsig, or 0 to clear).
Packit 7cfc04
This is the signal that the calling process will get when its
Packit 7cfc04
parent dies.
Packit 7cfc04
This value is cleared for the child of a
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
and (since Linux 2.4.36 / 2.6.23)
Packit 7cfc04
when executing a set-user-ID or set-group-ID binary,
Packit 7cfc04
or a binary that has associated capabilities (see
Packit 7cfc04
.BR capabilities (7)).
Packit 7cfc04
This value is preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.IP
Packit 7cfc04
.IR Warning :
Packit 7cfc04
.\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
Packit 7cfc04
the "parent" in this case is considered to be the
Packit 7cfc04
.I thread
Packit 7cfc04
that created this process.
Packit 7cfc04
In other words, the signal will be sent when that thread terminates
Packit 7cfc04
(via, for example,
Packit 7cfc04
.BR pthread_exit (3)),
Packit 7cfc04
rather than after all of the threads in the parent process terminate.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_PDEATHSIG " (since Linux 2.3.15)"
Packit 7cfc04
Return the current value of the parent process death signal,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_PTRACER " (since Linux 3.4)"
Packit 7cfc04
.\" commit 2d514487faf188938a4ee4fb3464eeecfbdcf8eb
Packit 7cfc04
.\" commit bf06189e4d14641c0148bea16e9dd24943862215
Packit 7cfc04
This is meaningful only when the Yama LSM is enabled and in mode 1
Packit 7cfc04
("restricted ptrace", visible via
Packit 7cfc04
.IR /proc/sys/kernel/yama/ptrace_scope ).
Packit 7cfc04
When a "ptracer process ID" is passed in \fIarg2\fP,
Packit 7cfc04
the caller is declaring that the ptracer process can
Packit 7cfc04
.BR ptrace (2)
Packit 7cfc04
the calling process as if it were a direct process ancestor.
Packit 7cfc04
Each
Packit 7cfc04
.B PR_SET_PTRACER
Packit 7cfc04
operation replaces the previous "ptracer process ID".
Packit 7cfc04
Employing
Packit 7cfc04
.B PR_SET_PTRACER
Packit 7cfc04
with
Packit 7cfc04
.I arg2
Packit 7cfc04
set to 0 clears the caller's "ptracer process ID".
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_PTRACER_ANY ,
Packit 7cfc04
the ptrace restrictions introduced by Yama are effectively disabled for the
Packit 7cfc04
calling process.
Packit 7cfc04
.IP
Packit 7cfc04
For further information, see the kernel source file
Packit 7cfc04
.IR Documentation/admin\-guide/LSM/Yama.rst
Packit 7cfc04
.\" commit 90bb766440f2147486a2acc3e793d7b8348b0c22
Packit 7cfc04
(or
Packit 7cfc04
.IR Documentation/security/Yama.txt
Packit 7cfc04
before Linux 4.13).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_SECCOMP " (since Linux 2.6.23)"
Packit 7cfc04
.\" See http://thread.gmane.org/gmane.linux.kernel/542632
Packit 7cfc04
.\" [PATCH 0 of 2] seccomp updates
Packit 7cfc04
.\" andrea@cpushare.com
Packit 7cfc04
Set the secure computing (seccomp) mode for the calling thread, to limit
Packit 7cfc04
the available system calls.
Packit 7cfc04
The more recent
Packit 7cfc04
.BR seccomp (2)
Packit 7cfc04
system call provides a superset of the functionality of
Packit 7cfc04
.BR PR_SET_SECCOMP .
Packit 7cfc04
.IP
Packit 7cfc04
The seccomp mode is selected via
Packit 7cfc04
.IR arg2 .
Packit 7cfc04
(The seccomp constants are defined in
Packit 7cfc04
.IR <linux/seccomp.h> .)
Packit 7cfc04
.IP
Packit 7cfc04
With
Packit 7cfc04
.IR arg2
Packit 7cfc04
set to
Packit 7cfc04
.BR SECCOMP_MODE_STRICT ,
Packit 7cfc04
the only system calls that the thread is permitted to make are
Packit 7cfc04
.BR read (2),
Packit 7cfc04
.BR write (2),
Packit 7cfc04
.BR _exit (2)
Packit 7cfc04
(but not
Packit 7cfc04
.BR exit_group (2)),
Packit 7cfc04
and
Packit 7cfc04
.BR sigreturn (2).
Packit 7cfc04
Other system calls result in the delivery of a
Packit 7cfc04
.BR SIGKILL
Packit 7cfc04
signal.
Packit 7cfc04
Strict secure computing mode is useful for number-crunching applications
Packit 7cfc04
that may need to execute untrusted byte code,
Packit 7cfc04
perhaps obtained by reading from a pipe or socket.
Packit 7cfc04
This operation is available only
Packit 7cfc04
if the kernel is configured with
Packit 7cfc04
.B CONFIG_SECCOMP
Packit 7cfc04
enabled.
Packit 7cfc04
.IP
Packit 7cfc04
With
Packit 7cfc04
.IR arg2
Packit 7cfc04
set to
Packit 7cfc04
.BR SECCOMP_MODE_FILTER " (since Linux 3.5),"
Packit 7cfc04
the system calls allowed are defined by a pointer
Packit 7cfc04
to a Berkeley Packet Filter passed in
Packit 7cfc04
.IR arg3 .
Packit 7cfc04
This argument is a pointer to
Packit 7cfc04
.IR "struct sock_fprog" ;
Packit 7cfc04
it can be designed to filter
Packit 7cfc04
arbitrary system calls and system call arguments.
Packit 7cfc04
This mode is available only if the kernel is configured with
Packit 7cfc04
.B CONFIG_SECCOMP_FILTER
Packit 7cfc04
enabled.
Packit 7cfc04
.IP
Packit 7cfc04
If
Packit 7cfc04
.BR SECCOMP_MODE_FILTER
Packit 7cfc04
filters permit
Packit 7cfc04
.BR fork (2),
Packit 7cfc04
then the seccomp mode is inherited by children created by
Packit 7cfc04
.BR fork (2);
Packit 7cfc04
if
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
is permitted, then the seccomp mode is preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
If the filters permit
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
calls, then additional filters can be added;
Packit 7cfc04
they are run in order until the first non-allow result is seen.
Packit 7cfc04
.IP
Packit 7cfc04
For further information, see the kernel source file
Packit 7cfc04
.IR Documentation/userspace\-api/seccomp_filter.rst
Packit 7cfc04
.\" commit c061f33f35be0ccc80f4b8e0aea5dfd2ed7e01a3
Packit 7cfc04
(or
Packit 7cfc04
.IR Documentation/prctl/seccomp_filter.txt
Packit 7cfc04
before Linux 4.13).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_SECCOMP " (since Linux 2.6.23)"
Packit 7cfc04
Return (as the function result)
Packit 7cfc04
the secure computing mode of the calling thread.
Packit 7cfc04
If the caller is not in secure computing mode, this operation returns 0;
Packit 7cfc04
if the caller is in strict secure computing mode, then the
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
call will cause a
Packit 7cfc04
.B SIGKILL
Packit 7cfc04
signal to be sent to the process.
Packit 7cfc04
If the caller is in filter mode, and this system call is allowed by the
Packit 7cfc04
seccomp filters, it returns 2; otherwise, the process is killed with a
Packit 7cfc04
.BR SIGKILL
Packit 7cfc04
signal.
Packit 7cfc04
This operation is available only
Packit 7cfc04
if the kernel is configured with
Packit 7cfc04
.B CONFIG_SECCOMP
Packit 7cfc04
enabled.
Packit 7cfc04
.IP
Packit 7cfc04
Since Linux 3.8, the
Packit 7cfc04
.IR Seccomp
Packit 7cfc04
field of the
Packit 7cfc04
.IR /proc/[pid]/status
Packit 7cfc04
file provides a method of obtaining the same information,
Packit 7cfc04
without the risk that the process is killed; see
Packit 7cfc04
.BR proc (5).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_SECUREBITS " (since Linux 2.6.26)"
Packit 7cfc04
Set the "securebits" flags of the calling thread to the value supplied in
Packit 7cfc04
.IR arg2 .
Packit 7cfc04
See
Packit 7cfc04
.BR capabilities (7).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_SECUREBITS " (since Linux 2.6.26)"
Packit 7cfc04
Return (as the function result)
Packit 7cfc04
the "securebits" flags of the calling thread.
Packit 7cfc04
See
Packit 7cfc04
.BR capabilities (7).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_THP_DISABLE " (since Linux 3.15)"
Packit 7cfc04
.\" commit a0715cc22601e8830ace98366c0c2bd8da52af52
Packit 7cfc04
Set the state of the "THP disable" flag for the calling thread.
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
has a nonzero value, the flag is set, otherwise it is cleared.
Packit 7cfc04
Setting this flag provides a method
Packit 7cfc04
for disabling transparent huge pages
Packit 7cfc04
for jobs where the code cannot be modified, and using a malloc hook with
Packit 7cfc04
.BR madvise (2)
Packit 7cfc04
is not an option (i.e., statically allocated data).
Packit 7cfc04
The setting of the "THP disable" flag is inherited by a child created via
Packit 7cfc04
.BR fork (2)
Packit 7cfc04
and is preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.\"
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_TASK_PERF_EVENTS_DISABLE " (since Linux 2.6.31)"
Packit 7cfc04
Disable all performance counters attached to the calling process,
Packit 7cfc04
regardless of whether the counters were created by
Packit 7cfc04
this process or another process.
Packit 7cfc04
Performance counters created by the calling process for other
Packit 7cfc04
processes are unaffected.
Packit 7cfc04
For more information on performance counters, see the Linux kernel source file
Packit 7cfc04
.IR tools/perf/design.txt .
Packit 7cfc04
.IP
Packit 7cfc04
Originally called
Packit 7cfc04
.BR PR_TASK_PERF_COUNTERS_DISABLE ;
Packit 7cfc04
.\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
Packit 7cfc04
renamed (retaining the same numerical value)
Packit 7cfc04
in Linux 2.6.32.
Packit 7cfc04
.\"
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_TASK_PERF_EVENTS_ENABLE " (since Linux 2.6.31)"
Packit 7cfc04
The converse of
Packit 7cfc04
.BR PR_TASK_PERF_EVENTS_DISABLE ;
Packit 7cfc04
enable performance counters attached to the calling process.
Packit 7cfc04
.IP
Packit 7cfc04
Originally called
Packit 7cfc04
.BR PR_TASK_PERF_COUNTERS_ENABLE ;
Packit 7cfc04
.\" commit 1d1c7ddbfab358445a542715551301b7fc363e28
Packit 7cfc04
renamed
Packit 7cfc04
.\" commit cdd6c482c9ff9c55475ee7392ec8f672eddb7be6
Packit 7cfc04
in Linux 2.6.32.
Packit 7cfc04
.\"
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_THP_DISABLE " (since Linux 3.15)"
Packit 7cfc04
Return (via the function result) the current setting of the "THP disable"
Packit 7cfc04
flag for the calling thread:
Packit 7cfc04
either 1, if the flag is set, or 0, if it is not.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_TID_ADDRESS " (since Linux 3.5)"
Packit 7cfc04
.\" commit 300f786b2683f8bb1ec0afb6e1851183a479c86d
Packit 7cfc04
Retrieve the
Packit 7cfc04
.I clear_child_tid
Packit 7cfc04
address set by
Packit 7cfc04
.BR set_tid_address (2)
Packit 7cfc04
and the
Packit 7cfc04
.BR clone (2)
Packit 7cfc04
.B CLONE_CHILD_CLEARTID
Packit 7cfc04
flag, in the location pointed to by
Packit 7cfc04
.IR "(int\ **)\ arg2" .
Packit 7cfc04
This feature is available only if the kernel is built with the
Packit 7cfc04
.BR CONFIG_CHECKPOINT_RESTORE
Packit 7cfc04
option enabled.
Packit 7cfc04
Note that since the
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
system call does not have a compat implementation for
Packit 7cfc04
the AMD64 x32 and MIPS n32 ABIs,
Packit 7cfc04
and the kernel writes out a pointer using the kernel's pointer size,
Packit 7cfc04
this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_TIMERSLACK " (since Linux 2.6.28)"
Packit 7cfc04
.\" See https://lwn.net/Articles/369549/
Packit 7cfc04
.\" commit 6976675d94042fbd446231d1bd8b7de71a980ada
Packit 7cfc04
Each thread has two associated timer slack values:
Packit 7cfc04
a "default" value, and a "current" value.
Packit 7cfc04
This operation sets the "current" timer slack value for the calling thread.
Packit 7cfc04
If the nanosecond value supplied in
Packit 7cfc04
.IR arg2
Packit 7cfc04
is greater than zero, then the "current" value is set to this value.
Packit 7cfc04
If
Packit 7cfc04
.I arg2
Packit 7cfc04
is less than or equal to zero,
Packit 7cfc04
.\" It seems that it's not possible to set the timer slack to zero;
Packit 7cfc04
.\" The minimum value is 1? Seems a little strange.
Packit 7cfc04
the "current" timer slack is reset to the
Packit 7cfc04
thread's "default" timer slack value.
Packit 7cfc04
.IP
Packit 7cfc04
The "current" timer slack is used by the kernel to group timer expirations
Packit 7cfc04
for the calling thread that are close to one another;
Packit 7cfc04
as a consequence, timer expirations for the thread may be
Packit 7cfc04
up to the specified number of nanoseconds late (but will never expire early).
Packit 7cfc04
Grouping timer expirations can help reduce system power consumption
Packit 7cfc04
by minimizing CPU wake-ups.
Packit 7cfc04
.IP
Packit 7cfc04
The timer expirations affected by timer slack are those set by
Packit 7cfc04
.BR select (2),
Packit 7cfc04
.BR pselect (2),
Packit 7cfc04
.BR poll (2),
Packit 7cfc04
.BR ppoll (2),
Packit 7cfc04
.BR epoll_wait (2),
Packit 7cfc04
.BR epoll_pwait (2),
Packit 7cfc04
.BR clock_nanosleep (2),
Packit 7cfc04
.BR nanosleep (2),
Packit 7cfc04
and
Packit 7cfc04
.BR futex (2)
Packit 7cfc04
(and thus the library functions implemented via futexes, including
Packit 7cfc04
.\" List obtained by grepping for futex usage in glibc source
Packit 7cfc04
.BR pthread_cond_timedwait (3),
Packit 7cfc04
.BR pthread_mutex_timedlock (3),
Packit 7cfc04
.BR pthread_rwlock_timedrdlock (3),
Packit 7cfc04
.BR pthread_rwlock_timedwrlock (3),
Packit 7cfc04
and
Packit 7cfc04
.BR sem_timedwait (3)).
Packit 7cfc04
.IP
Packit 7cfc04
Timer slack is not applied to threads that are scheduled under
Packit 7cfc04
a real-time scheduling policy (see
Packit 7cfc04
.BR sched_setscheduler (2)).
Packit 7cfc04
.IP
Packit 7cfc04
When a new thread is created,
Packit 7cfc04
the two timer slack values are made the same as the "current" value
Packit 7cfc04
of the creating thread.
Packit 7cfc04
Thereafter, a thread can adjust its "current" timer slack value via
Packit 7cfc04
.BR PR_SET_TIMERSLACK .
Packit 7cfc04
The "default" value can't be changed.
Packit 7cfc04
The timer slack values of
Packit 7cfc04
.IR init
Packit 7cfc04
(PID 1), the ancestor of all processes,
Packit 7cfc04
are 50,000 nanoseconds (50 microseconds).
Packit 7cfc04
The timer slack values are preserved across
Packit 7cfc04
.BR execve (2).
Packit 7cfc04
.IP
Packit 7cfc04
Since Linux 4.6, the "current" timer slack value of any process
Packit 7cfc04
can be examined and changed via the file
Packit 7cfc04
.IR /proc/[pid]/timerslack_ns .
Packit 7cfc04
See
Packit 7cfc04
.BR proc (5).
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_TIMERSLACK " (since Linux 2.6.28)"
Packit 7cfc04
Return (as the function result)
Packit 7cfc04
the "current" timer slack value of the calling thread.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_TIMING " (since Linux 2.6.0-test4)"
Packit 7cfc04
Set whether to use (normal, traditional) statistical process timing or
Packit 7cfc04
accurate timestamp-based process timing, by passing
Packit 7cfc04
.B PR_TIMING_STATISTICAL
Packit 7cfc04
.\" 0
Packit 7cfc04
or
Packit 7cfc04
.B PR_TIMING_TIMESTAMP
Packit 7cfc04
.\" 1
Packit 7cfc04
to \fIarg2\fP.
Packit 7cfc04
.B PR_TIMING_TIMESTAMP
Packit 7cfc04
is not currently implemented
Packit 7cfc04
(attempting to set this mode will yield the error
Packit 7cfc04
.BR EINVAL ).
Packit 7cfc04
.\" PR_TIMING_TIMESTAMP doesn't do anything in 2.6.26-rc8,
Packit 7cfc04
.\" and looking at the patch history, it appears
Packit 7cfc04
.\" that it never did anything.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_TIMING " (since Linux 2.6.0-test4)"
Packit 7cfc04
Return (as the function result) which process timing method is currently
Packit 7cfc04
in use.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_SET_TSC " (since Linux 2.6.26, x86 only)"
Packit 7cfc04
Set the state of the flag determining whether the timestamp counter
Packit 7cfc04
can be read by the process.
Packit 7cfc04
Pass
Packit 7cfc04
.B PR_TSC_ENABLE
Packit 7cfc04
to
Packit 7cfc04
.I arg2
Packit 7cfc04
to allow it to be read, or
Packit 7cfc04
.B PR_TSC_SIGSEGV
Packit 7cfc04
to generate a
Packit 7cfc04
.B SIGSEGV
Packit 7cfc04
when the process tries to read the timestamp counter.
Packit 7cfc04
.TP
Packit 7cfc04
.BR PR_GET_TSC " (since Linux 2.6.26, x86 only)"
Packit 7cfc04
Return the state of the flag determining whether the timestamp counter
Packit 7cfc04
can be read,
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR "(int\ *) arg2" .
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_SET_UNALIGN
Packit 7cfc04
(Only on: ia64, since Linux 2.3.48; parisc, since Linux 2.6.15;
Packit 7cfc04
PowerPC, since Linux 2.6.18; Alpha, since Linux 2.6.22;
Packit 7cfc04
.\" sh: 94ea5e449ae834af058ef005d16a8ad44fcf13d6
Packit 7cfc04
.\" tile: 2f9ac29eec71a696cb0dcc5fb82c0f8d4dac28c9
Packit 7cfc04
sh, since Linux 2.6.34; tile, since Linux 3.12)
Packit 7cfc04
Set unaligned access control bits to \fIarg2\fP.
Packit 7cfc04
Pass
Packit 7cfc04
\fBPR_UNALIGN_NOPRINT\fP to silently fix up unaligned user accesses,
Packit 7cfc04
or \fBPR_UNALIGN_SIGBUS\fP to generate
Packit 7cfc04
.B SIGBUS
Packit 7cfc04
on unaligned user access.
Packit 7cfc04
Alpha also supports an additional flag with the value
Packit 7cfc04
of 4 and no corresponding named constant,
Packit 7cfc04
which instructs kernel to not fix up
Packit 7cfc04
unaligned accesses (it is analogous to providing the
Packit 7cfc04
.BR UAC_NOFIX
Packit 7cfc04
flag in
Packit 7cfc04
.BR SSI_NVPAIRS
Packit 7cfc04
operation of the
Packit 7cfc04
.BR setsysinfo ()
Packit 7cfc04
system call on Tru64).
Packit 7cfc04
.TP
Packit 7cfc04
.B PR_GET_UNALIGN
Packit 7cfc04
(see
Packit 7cfc04
.B PR_SET_UNALIGN
Packit 7cfc04
for information on versions and architectures)
Packit 7cfc04
Return unaligned access control bits, in the location pointed to by
Packit 7cfc04
.IR "(unsigned int\ *) arg2" .
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success,
Packit 7cfc04
.BR PR_GET_DUMPABLE ,
Packit 7cfc04
.BR PR_GET_KEEPCAPS ,
Packit 7cfc04
.BR PR_GET_NO_NEW_PRIVS ,
Packit 7cfc04
.BR PR_GET_THP_DISABLE ,
Packit 7cfc04
.BR PR_CAPBSET_READ ,
Packit 7cfc04
.BR PR_GET_TIMING ,
Packit 7cfc04
.BR PR_GET_TIMERSLACK ,
Packit 7cfc04
.BR PR_GET_SECUREBITS ,
Packit 7cfc04
.BR PR_MCE_KILL_GET ,
Packit 7cfc04
.BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
Packit 7cfc04
and (if it returns)
Packit 7cfc04
.BR PR_GET_SECCOMP
Packit 7cfc04
return the nonnegative values described above.
Packit 7cfc04
All other
Packit 7cfc04
.I option
Packit 7cfc04
values return 0 on success.
Packit 7cfc04
On error, \-1 is returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set appropriately.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EACCES
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_SECCOMP
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR SECCOMP_MODE_FILTER ,
Packit 7cfc04
but the process does not have the
Packit 7cfc04
.BR CAP_SYS_ADMIN
Packit 7cfc04
capability or has not set the
Packit 7cfc04
.IR no_new_privs
Packit 7cfc04
attribute (see the discussion of
Packit 7cfc04
.BR PR_SET_NO_NEW_PRIVS
Packit 7cfc04
above).
Packit 7cfc04
.TP
Packit 7cfc04
.B EACCES
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
and
Packit 7cfc04
.I arg3
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM_EXE_FILE ,
Packit 7cfc04
the file is not executable.
Packit 7cfc04
.TP
Packit 7cfc04
.B EBADF
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
.I arg3
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM_EXE_FILE ,
Packit 7cfc04
and the file descriptor passed in
Packit 7cfc04
.I arg4
Packit 7cfc04
is not valid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EBUSY
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
.I arg3
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM_EXE_FILE ,
Packit 7cfc04
and this the second attempt to change the
Packit 7cfc04
.I /proc/pid/exe
Packit 7cfc04
symbolic link, which is prohibited.
Packit 7cfc04
.TP
Packit 7cfc04
.B EFAULT
Packit 7cfc04
.I arg2
Packit 7cfc04
is an invalid address.
Packit 7cfc04
.TP
Packit 7cfc04
.B EFAULT
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_SECCOMP ,
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR SECCOMP_MODE_FILTER ,
Packit 7cfc04
the system was built with
Packit 7cfc04
.BR CONFIG_SECCOMP_FILTER ,
Packit 7cfc04
and
Packit 7cfc04
.I arg3
Packit 7cfc04
is an invalid address.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
The value of
Packit 7cfc04
.I option
Packit 7cfc04
is not recognized.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_MCE_KILL
Packit 7cfc04
or
Packit 7cfc04
.BR PR_MCE_KILL_GET
Packit 7cfc04
or
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
and unused
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
arguments were not specified as zero.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I arg2
Packit 7cfc04
is not valid value for this
Packit 7cfc04
.IR option .
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_SECCOMP
Packit 7cfc04
or
Packit 7cfc04
.BR PR_GET_SECCOMP ,
Packit 7cfc04
and the kernel was not configured with
Packit 7cfc04
.BR CONFIG_SECCOMP .
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_SECCOMP ,
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR SECCOMP_MODE_FILTER ,
Packit 7cfc04
and the kernel was not configured with
Packit 7cfc04
.BR CONFIG_SECCOMP_FILTER .
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
and one of the following is true
Packit 7cfc04
.RS
Packit 7cfc04
.IP * 3
Packit 7cfc04
.I arg4
Packit 7cfc04
or
Packit 7cfc04
.I arg5
Packit 7cfc04
is nonzero;
Packit 7cfc04
.IP *
Packit 7cfc04
.I arg3
Packit 7cfc04
is greater than
Packit 7cfc04
.B TASK_SIZE
Packit 7cfc04
(the limit on the size of the user address space for this architecture);
Packit 7cfc04
.IP *
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM_START_CODE ,
Packit 7cfc04
.BR PR_SET_MM_END_CODE ,
Packit 7cfc04
.BR PR_SET_MM_START_DATA ,
Packit 7cfc04
.BR PR_SET_MM_END_DATA ,
Packit 7cfc04
or
Packit 7cfc04
.BR PR_SET_MM_START_STACK ,
Packit 7cfc04
and the permissions of the corresponding memory area are not as required;
Packit 7cfc04
.IP *
Packit 7cfc04
.I arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM_START_BRK
Packit 7cfc04
or
Packit 7cfc04
.BR PR_SET_MM_BRK ,
Packit 7cfc04
and
Packit 7cfc04
.I arg3
Packit 7cfc04
is less than or equal to the end of the data segment
Packit 7cfc04
or specifies a value that would cause the
Packit 7cfc04
.B RLIMIT_DATA
Packit 7cfc04
resource limit to be exceeded.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_PTRACER
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is not 0,
Packit 7cfc04
.BR PR_SET_PTRACER_ANY ,
Packit 7cfc04
or the PID of an existing process.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.B PR_SET_PDEATHSIG
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is not a valid signal number.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_DUMPABLE
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is neither
Packit 7cfc04
.B SUID_DUMP_DISABLE
Packit 7cfc04
nor
Packit 7cfc04
.BR SUID_DUMP_USER .
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_TIMING
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is not
Packit 7cfc04
.BR PR_TIMING_STATISTICAL .
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_NO_NEW_PRIVS
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
is not equal to 1
Packit 7cfc04
or
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
or
Packit 7cfc04
.IR arg5
Packit 7cfc04
is nonzero.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_GET_NO_NEW_PRIVS
Packit 7cfc04
and
Packit 7cfc04
.IR arg2 ,
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
or
Packit 7cfc04
.IR arg5
Packit 7cfc04
is nonzero.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_THP_DISABLE
Packit 7cfc04
and
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
or
Packit 7cfc04
.IR arg5
Packit 7cfc04
is nonzero.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_GET_THP_DISABLE
Packit 7cfc04
and
Packit 7cfc04
.IR arg2 ,
Packit 7cfc04
.IR arg3 ,
Packit 7cfc04
.IR arg4 ,
Packit 7cfc04
or
Packit 7cfc04
.IR arg5
Packit 7cfc04
is nonzero.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.B PR_CAP_AMBIENT
Packit 7cfc04
and an unused argument
Packit 7cfc04
.RI ( arg4 ,
Packit 7cfc04
.IR arg5 ,
Packit 7cfc04
or,
Packit 7cfc04
in the case of
Packit 7cfc04
.BR PR_CAP_AMBIENT_CLEAR_ALL ,
Packit 7cfc04
.IR arg3 )
Packit 7cfc04
is nonzero; or
Packit 7cfc04
.IR arg2
Packit 7cfc04
has an invalid value;
Packit 7cfc04
or
Packit 7cfc04
.IR arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_CAP_AMBIENT_LOWER ,
Packit 7cfc04
.BR PR_CAP_AMBIENT_RAISE ,
Packit 7cfc04
or
Packit 7cfc04
.BR PR_CAP_AMBIENT_IS_SET
Packit 7cfc04
and
Packit 7cfc04
.IR arg3
Packit 7cfc04
does not specify a valid capability.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENXIO
Packit 7cfc04
.I option
Packit 7cfc04
was
Packit 7cfc04
.BR PR_MPX_ENABLE_MANAGEMENT
Packit 7cfc04
or
Packit 7cfc04
.BR PR_MPX_DISABLE_MANAGEMENT
Packit 7cfc04
and the kernel or the CPU does not support MPX management.
Packit 7cfc04
Check that the kernel and processor have MPX support.
Packit 7cfc04
.TP
Packit 7cfc04
.B EOPNOTSUPP
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.B PR_SET_FP_MODE
Packit 7cfc04
and
Packit 7cfc04
.I arg2
Packit 7cfc04
has an invalid or unsupported value.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_SECUREBITS ,
Packit 7cfc04
and the caller does not have the
Packit 7cfc04
.B CAP_SETPCAP
Packit 7cfc04
capability,
Packit 7cfc04
or tried to unset a "locked" flag,
Packit 7cfc04
or tried to set a flag whose corresponding locked flag was set
Packit 7cfc04
(see
Packit 7cfc04
.BR capabilities (7)).
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_KEEPCAPS ,
Packit 7cfc04
and the caller's
Packit 7cfc04
.B SECBIT_KEEP_CAPS_LOCKED
Packit 7cfc04
flag is set
Packit 7cfc04
(see
Packit 7cfc04
.BR capabilities (7)).
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_CAPBSET_DROP ,
Packit 7cfc04
and the caller does not have the
Packit 7cfc04
.B CAP_SETPCAP
Packit 7cfc04
capability.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
.I option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_SET_MM ,
Packit 7cfc04
and the caller does not have the
Packit 7cfc04
.B CAP_SYS_RESOURCE
Packit 7cfc04
capability.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
.IR option
Packit 7cfc04
is
Packit 7cfc04
.BR PR_CAP_AMBIENT
Packit 7cfc04
and
Packit 7cfc04
.IR arg2
Packit 7cfc04
is
Packit 7cfc04
.BR PR_CAP_AMBIENT_RAISE ,
Packit 7cfc04
but either the capability specified in
Packit 7cfc04
.IR arg3
Packit 7cfc04
is not present in the process's permitted and inheritable capability sets,
Packit 7cfc04
or the
Packit 7cfc04
.B PR_CAP_AMBIENT_LOWER
Packit 7cfc04
securebit has been set.
Packit 7cfc04
.SH VERSIONS
Packit 7cfc04
The
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
system call was introduced in Linux 2.1.57.
Packit 7cfc04
.\" The library interface was added in glibc 2.0.6
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
This call is Linux-specific.
Packit 7cfc04
IRIX has a
Packit 7cfc04
.BR prctl ()
Packit 7cfc04
system call (also introduced in Linux 2.1.44
Packit 7cfc04
as irix_prctl on the MIPS architecture),
Packit 7cfc04
with prototype
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
.BI "ptrdiff_t prctl(int " option ", int " arg2 ", int " arg3 );
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
and options to get the maximum number of processes per user,
Packit 7cfc04
get the maximum number of processors the calling process can use,
Packit 7cfc04
find out whether a specified process is currently blocked,
Packit 7cfc04
get or set the maximum stack size, and so on.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR signal (2),
Packit 7cfc04
.BR core (5)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.