Skip to content
Commit f84df2a6 authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

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: default avatarJann Horn <jann@thejh.net>
Fixes: 9e4a36ec

 ("userns: Fail exec for suid and sgid binaries with ids outside our user namespace.")
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 84d77d3f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment