diff options
author | Eric Paris <eparis@redhat.com> | 2012-04-17 16:26:54 -0400 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2012-04-17 22:37:56 -0400 |
commit | d52fc5dde171f030170a6cb78034d166b13c9445 (patch) | |
tree | f982d0bdab54d5ab31cdd3e69cb88a1376797d1f /security/commoncap.c | |
parent | 09c79b60960bdd4b00916219402eabfa5e479c5a (diff) |
fcaps: clear the same personality flags as suid when fcaps are used
If a process increases permissions using fcaps all of the dangerous
personality flags which are cleared for suid apps should also be cleared.
Thus programs given priviledge with fcaps will continue to have address space
randomization enabled even if the parent tried to disable it to make it
easier to attack.
Signed-off-by: Eric Paris <eparis@redhat.com>
Reviewed-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'security/commoncap.c')
-rw-r--r-- | security/commoncap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 0cf4b53480a7..0ecf4ba321cb 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -505,6 +505,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) | |||
505 | } | 505 | } |
506 | skip: | 506 | skip: |
507 | 507 | ||
508 | /* if we have fs caps, clear dangerous personality flags */ | ||
509 | if (!cap_issubset(new->cap_permitted, old->cap_permitted)) | ||
510 | bprm->per_clear |= PER_CLEAR_ON_SETID; | ||
511 | |||
512 | |||
508 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised | 513 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised |
509 | * credentials unless they have the appropriate permit | 514 | * credentials unless they have the appropriate permit |
510 | */ | 515 | */ |