diff options
Diffstat (limited to 'security/commoncap.c')
-rw-r--r-- | security/commoncap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 71a166a05975..f80d11609391 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -512,14 +512,17 @@ skip: | |||
512 | 512 | ||
513 | 513 | ||
514 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised | 514 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised |
515 | * credentials unless they have the appropriate permit | 515 | * credentials unless they have the appropriate permit. |
516 | * | ||
517 | * In addition, if NO_NEW_PRIVS, then ensure we get no new privs. | ||
516 | */ | 518 | */ |
517 | if ((new->euid != old->uid || | 519 | if ((new->euid != old->uid || |
518 | new->egid != old->gid || | 520 | new->egid != old->gid || |
519 | !cap_issubset(new->cap_permitted, old->cap_permitted)) && | 521 | !cap_issubset(new->cap_permitted, old->cap_permitted)) && |
520 | bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) { | 522 | bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) { |
521 | /* downgrade; they get no more than they had, and maybe less */ | 523 | /* downgrade; they get no more than they had, and maybe less */ |
522 | if (!capable(CAP_SETUID)) { | 524 | if (!capable(CAP_SETUID) || |
525 | (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) { | ||
523 | new->euid = new->uid; | 526 | new->euid = new->uid; |
524 | new->egid = new->gid; | 527 | new->egid = new->gid; |
525 | } | 528 | } |