]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/exec.c
exec: Ensure mm->user_ns contains the execed files
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 17 Nov 2016 04:06:51 +0000 (22:06 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 22 Nov 2016 19:21:00 +0000 (13:21 -0600)
commitf84df2a6f268de584a201e8911384a2d244876e3
tree09976911531fe57cff9299cd8687ae6d1c9b14ed
parent84d77d3f06e7e8dea057d10e8ec77ad71f721be3
exec: Ensure mm->user_ns contains the execed files

When the user namespace support was merged the need to prevent
ptrace from revealing the contents of an unreadable executable
was overlooked.

Correct this oversight by ensuring that the executed file
or files are in mm->user_ns, by adjusting mm->user_ns.

Use the new function privileged_wrt_inode_uidgid to see if
the executable is a member of the user namespace, and as such
if having CAP_SYS_PTRACE in the user namespace should allow
tracing the executable.  If not update mm->user_ns to
the parent user namespace until an appropriate parent is found.

Cc: stable@vger.kernel.org
Reported-by: Jann Horn <jann@thejh.net>
Fixes: 9e4a36ece652 ("userns: Fail exec for suid and sgid binaries with ids outside our user namespace.")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/exec.c
include/linux/capability.h
kernel/capability.c