dwww Home | Manual pages | Find package

PR_SET_PTRACER(2const)                                   PR_SET_PTRACER(2const)

NAME
       PR_SET_PTRACER - allow processes to ptrace(2) the calling process

LIBRARY
       Standard C library (libc, -lc)

SYNOPSIS
       #include <linux/prctl.h>  /* Definition of PR_* constants */
       #include <sys/prctl.h>

       int prctl(PR_SET_PTRACER, long pid);

DESCRIPTION
       This is meaningful only when the Yama LSM is enabled and in mode 1 ("re-
       stricted ptrace", visible via /proc/sys/kernel/yama/ptrace_scope).

       When  a  "ptracer  process ID" is passed in pid, 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 pid set to 0 clears the caller's "ptracer
       process ID".  If pid is PR_SET_PTRACER_ANY, the ptrace restrictions  in-
       troduced by Yama are effectively disabled for the calling process.

RETURN VALUE
       On  success,  0 is returned.  On error, -1 is returned, and errno is set
       to indicate the error.

ERRORS
       EINVAL pid is not 0, PR_SET_PTRACER_ANY, nor  the  PID  of  an  existing
              process.

STANDARDS
       Linux.

HISTORY
       Linux 3.4.

SEE ALSO
       prctl(2),

       For  further  information,  see the kernel source file Documentation/ad-
       min-guide/LSM/Yama.rst (or Documentation/security/Yama.txt before  Linux
       4.13).

Linux man-pages 6.9.1              2024-06-02            PR_SET_PTRACER(2const)

Generated by dwww version 1.16 on Tue Dec 16 04:14:39 CET 2025.