diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d85b793c9321..0b06685787b9 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2016,6 +2016,13 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2016 | new_tsec->sid = old_tsec->exec_sid; | 2016 | new_tsec->sid = old_tsec->exec_sid; |
2017 | /* Reset exec SID on execve. */ | 2017 | /* Reset exec SID on execve. */ |
2018 | new_tsec->exec_sid = 0; | 2018 | new_tsec->exec_sid = 0; |
2019 | |||
2020 | /* | ||
2021 | * Minimize confusion: if no_new_privs and a transition is | ||
2022 | * explicitly requested, then fail the exec. | ||
2023 | */ | ||
2024 | if (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) | ||
2025 | return -EPERM; | ||
2019 | } else { | 2026 | } else { |
2020 | /* Check for a default transition on this program. */ | 2027 | /* Check for a default transition on this program. */ |
2021 | rc = security_transition_sid(old_tsec->sid, isec->sid, | 2028 | rc = security_transition_sid(old_tsec->sid, isec->sid, |
@@ -2029,7 +2036,8 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2029 | ad.selinux_audit_data = &sad; | 2036 | ad.selinux_audit_data = &sad; |
2030 | ad.u.path = bprm->file->f_path; | 2037 | ad.u.path = bprm->file->f_path; |
2031 | 2038 | ||
2032 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) | 2039 | if ((bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) || |
2040 | (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) | ||
2033 | new_tsec->sid = old_tsec->sid; | 2041 | new_tsec->sid = old_tsec->sid; |
2034 | 2042 | ||
2035 | if (new_tsec->sid == old_tsec->sid) { | 2043 | if (new_tsec->sid == old_tsec->sid) { |