Skip to content

Commit d52fc5d

Browse files
eparisJames Morris
authored andcommitted
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 <[email protected]> Reviewed-by: Serge Hallyn <[email protected]> Signed-off-by: James Morris <[email protected]>
1 parent 09c79b6 commit d52fc5d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

security/commoncap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
505505
}
506506
skip:
507507

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+
508513
/* Don't let someone trace a set[ug]id/setpcap binary with the revised
509514
* credentials unless they have the appropriate permit
510515
*/

0 commit comments

Comments
 (0)