diff --git a/security/commoncap.c b/security/commoncap.c index fe30751a6cd9cb8862fa7fcbd19a3b818264c934..30972d69f57a50182b868913c94abbc759d06f4f 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -511,6 +511,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) } skip: + /* if we have fs caps, clear dangerous personality flags */ + if (!cap_issubset(new->cap_permitted, old->cap_permitted)) + bprm->per_clear |= PER_CLEAR_ON_SETID; + + /* Don't let someone trace a set[ug]id/setpcap binary with the revised * credentials unless they have the appropriate permit */