1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH PR_SET_PTRACER 2const 2025-05-17 "Linux man-pages (unreleased)"
.SH NAME
PR_SET_PTRACER
\-
allow processes to ptrace(2) the calling process
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */"
.B #include <sys/prctl.h>
.P
.BI "int prctl(PR_SET_PTRACER, long " pid );
.fi
.SH DESCRIPTION
This is meaningful only when the Yama LSM is enabled and in mode 1
("restricted ptrace", visible via
.IR /proc/\:sys/\:kernel/\:yama/\:ptrace_scope ).
.P
When a "ptracer process ID" is passed in
.IR pid ,
the caller is declaring that the ptracer process can
.BR ptrace (2)
the calling process as if it were a direct process ancestor.
.P
Each
.B PR_SET_PTRACER
operation replaces the previous "ptracer process ID".
.P
Employing
.B PR_SET_PTRACER
with
.I pid
set to 0 clears the caller's "ptracer process ID".
If
.I pid
is
.BR PR_SET_PTRACER_ANY ,
the ptrace restrictions introduced by Yama are
effectively disabled for the calling process.
.SH RETURN VALUE
On success,
0 is returned.
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I pid
is not 0,
.BR PR_SET_PTRACER_ANY ,
nor the PID of an existing process.
.SH STANDARDS
Linux.
.SH HISTORY
Linux 3.4.
.\" commit 2d514487faf188938a4ee4fb3464eeecfbdcf8eb
.\" commit bf06189e4d14641c0148bea16e9dd24943862215
.SH SEE ALSO
.BR prctl (2),
.P
For further information, see the kernel source file
.I Documentation/\:admin\-guide/\:LSM/\:Yama.rst
.\" commit 90bb766440f2147486a2acc3e793d7b8348b0c22
(or
.I Documentation/\:security/\:Yama.txt
before Linux 4.13).
|