Debian Codegraph @

upstream/debian-unstable/man2/PR_SET_PTRACER.2const

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