]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
ptrace: Capture the ptracer's creds not PT_PTRACE_CAP
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 15 Nov 2016 00:48:07 +0000 (18:48 -0600)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 10 Jan 2017 17:42:57 +0000 (17:42 +0000)
commit0e3337564275664c371d37595a3d9088a7ab96b2
treea1add79edd620e306875e13bb8d0eda7142017e1
parent2396dc5d456a6d46842fa0e96e94f0c5325b9814
ptrace: Capture the ptracer's creds not PT_PTRACE_CAP

BugLink: http://bugs.launchpad.net/bugs/1654602
commit 64b875f7ac8a5d60a4e191479299e931ee949b67 upstream.

When the flag PT_PTRACE_CAP was added the PTRACE_TRACEME path was
overlooked.  This can result in incorrect behavior when an application
like strace traces an exec of a setuid executable.

Further PT_PTRACE_CAP does not have enough information for making good
security decisions as it does not report which user namespace the
capability is in.  This has already allowed one mistake through
insufficient granulariy.

I found this issue when I was testing another corner case of exec and
discovered that I could not get strace to set PT_PTRACE_CAP even when
running strace as root with a full set of caps.

This change fixes the above issue with strace allowing stracing as
root a setuid executable without disabling setuid.  More fundamentaly
this change allows what is allowable at all times, by using the correct
information in it's decision.

Fixes: 4214e42f96d4 ("v2.4.9.11 -> v2.4.9.12")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
fs/exec.c
include/linux/capability.h
include/linux/ptrace.h
include/linux/sched.h
kernel/capability.c
kernel/ptrace.c