lkml.org 
[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v18 01/15] Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs
On Thu, Apr 12, 2012 at 9:16 PM, James Morris <jmorris@namei.org> wrote:
> On Thu, 12 Apr 2012, Will Drewry wrote:
>> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
>> index d85b793..0b06685 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)
>>               new_tsec->sid = old_tsec->exec_sid;
>>               /* Reset exec SID on execve. */
>>               new_tsec->exec_sid = 0;
>> +
>> +             /*
>> +              * Minimize confusion: if no_new_privs and a transition is
>> +              * explicitly requested, then fail the exec.
>> +              */
>> +             if (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)
>> +                     return -EPERM;
>>       } else {
>>               /* Check for a default transition on this program. */
>>               rc = security_transition_sid(old_tsec->sid, isec->sid,
>> @@ -2029,7 +2036,8 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
>>       ad.selinux_audit_data = &sad;
>>       ad.u.path = bprm->file->f_path;
>>
>> -     if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
>> +     if ((bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) ||
>> +         (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS))
>>               new_tsec->sid = old_tsec->sid;
>>
>>       if (new_tsec->sid == old_tsec->sid) {
>> --
>
> What about dynamic transitions in SELinux ?
>

What's a dynamic transition?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-04-13 06:29    [W:0.123 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site