]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/prctl.2
pldd.1, bpf.2, chdir.2, clone.2, fanotify_init.2, fanotify_mark.2, intro.2, ipc.2...
[thirdparty/man-pages.git] / man2 / prctl.2
index 2d9752fd8b9c66cbfe3985cacef6a289024de3d7..fdbea1baa126c29df978968f89dcefafed0fa787 100644 (file)
@@ -51,7 +51,7 @@
 .\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
 .\"
 .\"
-.TH PRCTL 2 2018-02-02 "Linux" "Linux Programmer's Manual"
+.TH PRCTL 2 2019-08-02 "Linux" "Linux Programmer's Manual"
 .SH NAME
 prctl \- operations on a process
 .SH SYNOPSIS
@@ -112,6 +112,15 @@ In all of the above operations,
 and
 .I arg5
 must be specified as 0.
+.IP
+Higher-level interfaces layered on top of the above operations are
+provided in the
+.BR libcap (3)
+library in the form of
+.BR cap_get_ambient (3),
+.BR cap_set_ambient (3),
+and
+.BR cap_reset_ambient (3).
 .TP
 .BR PR_CAPBSET_READ " (since Linux 2.6.25)"
 Return (as the function result) 1 if the capability specified in
@@ -188,7 +197,8 @@ signal and will be able to
 .BR wait (2)
 on the process to discover its termination status.
 .IP
-The setting of this bit is not inherited by children created by
+The setting of the "child subreaper" attribute
+is not inherited by children created by
 .BR fork (2)
 and
 .BR clone (2).
@@ -458,7 +468,7 @@ in the location pointed to by
 .TP
 .BR PR_SET_KEEPCAPS " (since Linux 2.2.18)"
 Set the state of the calling thread's "keep capabilities" flag.
-The effect if this flag is described in
+The effect of this flag is described in
 .BR capabilities (7).
 .I arg2
 must be either 0 (clear the flag)
@@ -748,7 +758,11 @@ configuration option.
 You can check whether the CPU supports MPX by looking for the 'mpx'
 CPUID bit, like with the following command:
 .IP
-       cat /proc/cpuinfo | grep ' mpx '
+.in +4n
+.EX
+cat /proc/cpuinfo | grep ' mpx '
+.EE
+.in
 .IP
 A thread may not switch in or out of long (64-bit) mode while MPX is
 enabled.
@@ -796,7 +810,7 @@ the returned string will be null-terminated.
 .BR PR_SET_NO_NEW_PRIVS " (since Linux 3.5)"
 Set the calling thread's
 .I no_new_privs
-bit to the value in
+attribute to the value in
 .IR arg2 .
 With
 .I no_new_privs
@@ -808,8 +822,10 @@ that could not have been done without the
 call (for example,
 rendering the set-user-ID and set-group-ID mode bits,
 and file capabilities non-functional).
-Once set, this bit cannot be unset.
-The setting of this bit is inherited by children created by
+Once set, this the
+.I no_new_privs
+attribute cannot be unset.
+The setting of this attribute is inherited by children created by
 .BR fork (2)
 and
 .BR clone (2),
@@ -819,7 +835,7 @@ and preserved across
 Since Linux 4.10,
 the value of a thread's
 .I no_new_privs
-bit can be viewed via the
+attribute can be viewed via the
 .I NoNewPrivs
 field in the
 .IR /proc/[pid]/status
@@ -837,7 +853,7 @@ See also
 .BR PR_GET_NO_NEW_PRIVS " (since Linux 3.5)"
 Return (as the function result) the value of the
 .I no_new_privs
-bit for the calling thread.
+attribute for the calling thread.
 A value of 0 indicates the regular
 .BR execve (2)
 behavior.
@@ -846,19 +862,11 @@ A value of 1 indicates
 will operate in the privilege-restricting mode described above.
 .TP
 .BR PR_SET_PDEATHSIG " (since Linux 2.1.57)"
-Set the parent death signal
+Set the parent-death signal
 of the calling process to \fIarg2\fP (either a signal value
 in the range 1..maxsig, or 0 to clear).
 This is the signal that the calling process will get when its
 parent dies.
-This value is cleared for the child of a
-.BR fork (2)
-and (since Linux 2.4.36 / 2.6.23)
-when executing a set-user-ID or set-group-ID binary,
-or a binary that has associated capabilities (see
-.BR capabilities (7)).
-This value is preserved across
-.BR execve (2).
 .IP
 .IR Warning :
 .\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
@@ -869,6 +877,38 @@ In other words, the signal will be sent when that thread terminates
 (via, for example,
 .BR pthread_exit (3)),
 rather than after all of the threads in the parent process terminate.
+.IP
+The parent-death signal is sent upon subsequent termination of the parent
+thread and also upon termination of each subreaper process
+(see the description of
+.B PR_SET_CHILD_SUBREAPER
+above) to which the caller is subsequently reparented.
+If the parent thread and all ancestor subreapers have already terminated
+by the time of the
+.BR PR_SET_PDEATHSIG
+operation, then no parent-death signal is sent to the caller.
+.IP
+The parent-death signal is process-directed (see
+.BR signal (7))
+and, if the child installs a handler using the
+.BR sigaction (2)
+.B SA_SIGINFO
+flag, the
+.I si_pid
+field of the
+.I siginfo_t
+argument of the handler contains the PID of the terminating parent process.
+.IP
+The parent-death signal setting is cleared for the child of a
+.BR fork (2).
+It is also
+(since Linux 2.4.36 / 2.6.23)
+.\" commit d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f
+cleared when executing a set-user-ID or set-group-ID binary,
+or a binary that has associated capabilities (see
+.BR capabilities (7));
+otherwise, this value is preserved across
+.BR execve (2).
 .TP
 .BR PR_GET_PDEATHSIG " (since Linux 2.3.15)"
 Return the current value of the parent process death signal,
@@ -1199,14 +1239,15 @@ this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs.
 Each thread has two associated timer slack values:
 a "default" value, and a "current" value.
 This operation sets the "current" timer slack value for the calling thread.
+.I arg2
+is an unsigned long value, then maximum "current" value is ULONG_MAX and
+the minimum "current" value is 1.
 If the nanosecond value supplied in
 .IR arg2
 is greater than zero, then the "current" value is set to this value.
 If
 .I arg2
-is less than or equal to zero,
-.\" It seems that it's not possible to set the timer slack to zero;
-.\" The minimum value is 1? Seems a little strange.
+is equal to zero,
 the "current" timer slack is reset to the
 thread's "default" timer slack value.
 .IP
@@ -1251,7 +1292,9 @@ The timer slack values of
 .IR init
 (PID 1), the ancestor of all processes,
 are 50,000 nanoseconds (50 microseconds).
-The timer slack values are preserved across
+The timer slack value is inherited by a child created via
+.BR fork(2),
+and is preserved across
 .BR execve (2).
 .IP
 Since Linux 4.6, the "current" timer slack value of any process
@@ -1264,7 +1307,8 @@ See
 Return (as the function result)
 the "current" timer slack value of the calling thread.
 .TP
-.BR PR_SET_TIMING " (since Linux 2.6.0-test4)"
+.BR PR_SET_TIMING " (since Linux 2.6.0)"
+.\" Precisely: Linux 2.6.0-test4
 Set whether to use (normal, traditional) statistical process timing or
 accurate timestamp-based process timing, by passing
 .B PR_TIMING_STATISTICAL
@@ -1281,7 +1325,8 @@ is not currently implemented
 .\" and looking at the patch history, it appears
 .\" that it never did anything.
 .TP
-.BR PR_GET_TIMING " (since Linux 2.6.0-test4)"
+.BR PR_GET_TIMING " (since Linux 2.6.0)"
+.\" Precisely: Linux 2.6.0-test4
 Return (as the function result) which process timing method is currently
 in use.
 .TP