aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-11-17 02:38:35 -0500
committerEric W. Biederman <ebiederm@xmission.com>2017-01-23 18:03:07 -0500
commit70169420f555210147f3cab74bb0f6debd488bdb (patch)
tree364f9a2a9d576c91178ba0b5d3c1d671da7301ba
parent1cce1eea0aff51201753fcaca421df825b0813b6 (diff)
exec: Don't reset euid and egid when the tracee has CAP_SETUID
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" <ebiederm@xmission.com>
-rw-r--r--security/commoncap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index 8df676fbd393..feb6044f701d 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -550,7 +550,7 @@ skip:
550 !cap_issubset(new->cap_permitted, old->cap_permitted)) && 550 !cap_issubset(new->cap_permitted, old->cap_permitted)) &&
551 bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) { 551 bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) {
552 /* downgrade; they get no more than they had, and maybe less */ 552 /* downgrade; they get no more than they had, and maybe less */
553 if (!capable(CAP_SETUID) || 553 if (!ns_capable(new->user_ns, CAP_SETUID) ||
554 (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) { 554 (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) {
555 new->euid = new->uid; 555 new->euid = new->uid;
556 new->egid = new->gid; 556 new->egid = new->gid;