Skip to content

Commit

Permalink
exec: Don't reset euid and egid when the tracee has CAP_SETUID
Browse files Browse the repository at this point in the history
Don't reset euid and egid when the tracee has CAP_SETUID in
it's user namespace.  I punted on relaxing this permission check
long ago but now that I have read this code closely it is clear
it is safe to test against CAP_SETUID in the user namespace.

Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Jan 23, 2017
1 parent 1cce1ee commit 7016942
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
!cap_issubset(new->cap_permitted, old->cap_permitted)) &&
bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) {
/* downgrade; they get no more than they had, and maybe less */
if (!capable(CAP_SETUID) ||
if (!ns_capable(new->user_ns, CAP_SETUID) ||
(bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) {
new->euid = new->uid;
new->egid = new->gid;
Expand Down

0 comments on commit 7016942

Please sign in to comment.