Yama: Introduce PR_SET_PTRACER_ANY_TRACEE

In order to provide a way to have a tracer that can bypass ancestry
restrictions, provide PR_SET_PTRACER_ANY_TRACEE. This creates a middle
ground between CAP_SYS_PTRACE (which can ptrace anything) and an
regularly privileged process. A tracer that sets
PR_SET_PTRACER_ANY_TRACEE will be able to bypass ancestry restrictions
(as if each tracee had set PR_SET_PTRACER to the tracer). Using this
feature requires CAP_SYS_PTRACE. The expectation is that such a tracer
would use CAP_SYS_PTRACE to gain PR_SET_PTRACER_ANY_TRACEE, and then
drop CAP_SYS_PTRACE.

Link: https://github.com/nelhage/reptyr/pull/119
Signed-off-by: Kees Cook <keescook@chromium.org>
2 files changed