From https://man7.org/linux/man-pages/man2/prctl.2.html the operation is documented with:
PR_SET_PTRACER (since Linux 3.4)
This is meaningful only when the Yama LSM is enabled and
in mode 1 ("restricted ptrace", visible via
/proc/sys/kernel/yama/ptrace_scope). When a "ptracer
process ID" is passed in arg2, the caller is declaring
that the ptracer process can ptrace(2) the calling process
as if it were a direct process ancestor. Each
PR_SET_PTRACER operation replaces the previous "ptracer
process ID". Employing PR_SET_PTRACER with arg2 set to 0
clears the caller's "ptracer process ID". If arg2 is
PR_SET_PTRACER_ANY, the ptrace restrictions introduced by
Yama are effectively disabled for the calling process.
For further information, see the kernel source file
Documentation/admin-guide/LSM/Yama.rst (or
Documentation/security/Yama.txt before Linux 4.13).
"ptracer process ID"
would appear to refer to the process ID of the process we wish to grant ptrace permission.
However on https://man7.org/linux/man-pages/man2/ptrace.2.html
A tracee first needs to be attached to the tracer. Attachment
and subsequent commands are per thread: in a multithreaded
process, every thread can be individually attached to a
(potentially different) tracer, or left not attached and thus not
debugged. Therefore, "tracee" always means "(one) thread", never
"a (possibly multithreaded) process". Ptrace commands are always
sent to a specific tracee using a call of the form
ptrace(PTRACE_foo, pid, ...)
where pid is the thread ID of the corresponding Linux thread.
Which would seem to suggest that despite the value being named pid
it is not the process id but rather than thread id.
Does "ptracer process ID"
mean the thread id?