]> git.baikalelectronics.ru Git - kernel.git/commit
ptrace: Set PF_SUPERPRIV when checking capability
authorMickaël Salaün <mic@linux.microsoft.com>
Fri, 30 Oct 2020 12:38:48 +0000 (13:38 +0100)
committerKees Cook <keescook@chromium.org>
Tue, 17 Nov 2020 20:53:22 +0000 (12:53 -0800)
commitf25a1e8f805b2eefc77cc6b744366f34e8576e5c
treeded22f89c5bdde0719aa404ecebf44ef6088b551
parent52303c159aaf2219cfa60dd0f7bf7c06a1d70995
ptrace: Set PF_SUPERPRIV when checking capability

Commit 00a5e4c05288 ("ptrace: do not audit capability check when outputing
/proc/pid/stat") replaced the use of ns_capable() with
has_ns_capability{,_noaudit}() which doesn't set PF_SUPERPRIV.

Commit 3062b47b054b ("ptrace: reintroduce usage of subjective credentials in
ptrace_has_cap()") replaced has_ns_capability{,_noaudit}() with
security_capable(), which doesn't set PF_SUPERPRIV neither.

Since commit a252ac1b2ca9 ("kernel: Add noaudit variant of ns_capable()"), a
new ns_capable_noaudit() helper is available.  Let's use it!

As a result, the signature of ptrace_has_cap() is restored to its original one.

Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Eric Paris <eparis@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Serge E. Hallyn <serge@hallyn.com>
Cc: Tyler Hicks <tyhicks@linux.microsoft.com>
Cc: stable@vger.kernel.org
Fixes: 3062b47b054b ("ptrace: reintroduce usage of subjective credentials in ptrace_has_cap()")
Fixes: 00a5e4c05288 ("ptrace: do not audit capability check when outputing /proc/pid/stat")
Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Reviewed-by: Jann Horn <jannh@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20201030123849.770769-2-mic@digikod.net
kernel/ptrace.c