pub fn set_ptracer(pid: i32) -> Result<(), CoreError>Expand description
Restrict which processes may ptrace this one (PR_SET_PTRACER).
pid = 0 denies all tracing — the strongest setting and the one the
daemon uses (A17-02). This is an additional per-process restriction that
works even where YAMA is not compiled (CONFIG_SECURITY_YAMA unset): a
child cannot ptrace/pidfd_getfd/process_vm_readv the daemon.
Platform caveat (verified on the audit target, an Android 5.10 kernel):
PR_SET_PTRACER is implemented under CONFIG_CHECKPOINT_RESTORE, which
Android kernels build without — the prctl then returns EINVAL for every
argument. Callers must treat EINVAL as “unsupported, proceed with
PR_SET_DUMPABLE=0 + self-seccomp as the actual protection” and only fail
hard on unexpected errors. See the daemon’s hub hook for the tolerant
wrapper.
§Errors
EINVAL: unsupported on this kernel (noCONFIG_CHECKPOINT_RESTORE).