|
Message-ID: <alpine.LRH.2.02.1204131414580.22039@tundra.namei.org> Date: Fri, 13 Apr 2012 14:16:20 +1000 (EST) From: James Morris <jmorris@...ei.org> To: Will Drewry <wad@...omium.org> cc: linux-kernel@...r.kernel.org, linux-man@...r.kernel.org, linux-security-module@...r.kernel.org, linux-arch@...r.kernel.org, linux-doc@...r.kernel.org, kernel-hardening@...ts.openwall.com, netdev@...r.kernel.org, x86@...nel.org, arnd@...db.de, "David S. Miller" <davem@...emloft.net>, hpa@...or.com, mingo@...hat.com, Oleg Nesterov <oleg@...hat.com>, peterz@...radead.org, rdunlap@...otime.net, mcgrathr@...omium.org, tglx@...utronix.de, luto@....edu, Eric Paris <eparis@...hat.com>, Serge Hallyn <serge.hallyn@...onical.com>, djm@...drot.org, scarybeasts@...il.com, indan@....nu, pmoore@...hat.com, Andrew Morton <akpm@...ux-foundation.org>, Jonathan Corbet <corbet@....net>, eric.dumazet@...il.com, markus@...omium.org, coreyb@...ux.vnet.ibm.com, Kees Cook <keescook@...omium.org>, Andy Lutomirski <luto@...capital.net>, Stephen Smalley <sds@...ho.nsa.gov> Subject: Re: [PATCH v18 01/15] Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs 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 ? - James -- James Morris <jmorris@...ei.org>
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.