All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] selinux: prevent setting a security label on MNT_NOSUID applications
@ 2014-05-14 15:58 Paul Moore
  2014-05-14 16:16 ` Andy Lutomirski
  2014-05-14 16:28 ` Stephen Smalley
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Moore @ 2014-05-14 15:58 UTC (permalink / raw)
  To: selinux; +Cc: sds, luto

We presently prevent processes from explicitly setting an arbitrary
security label on new processes when NO_NEW_PRIVS is enabled; in an
attempt for more consistency, this patch extends this to prevent
setting an arbitrary label when the new application lives on a
filesystem mounted with MNT_NOSUID.

Signed-off-by: Paul Moore <pmoore@redhat.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Stephen Smalley <sds@tycho.nsa.gov>
---
 security/selinux/hooks.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 57b0b49..6fafe86 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2106,11 +2106,13 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
 		new_tsec->exec_sid = 0;
 
 		/*
-		 * Minimize confusion: if no_new_privs and a transition is
-		 * explicitly requested, then fail the exec.
+		 * Minimize confusion: if no_new_privs or nosuid and a
+		 * transition is explicitly requested, then fail the exec.
 		 */
 		if (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)
 			return -EPERM;
+		if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
+			return -EACCES;
 	} else {
 		/* Check for a default transition on this program. */
 		rc = security_transition_sid(old_tsec->sid, isec->sid,

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-05-15 15:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 15:58 [RFC PATCH] selinux: prevent setting a security label on MNT_NOSUID applications Paul Moore
2014-05-14 16:16 ` Andy Lutomirski
2014-05-14 16:18   ` Andy Lutomirski
2014-05-14 16:23   ` Stephen Smalley
2014-05-14 16:48     ` Andy Lutomirski
2014-05-14 16:28 ` Stephen Smalley
2014-05-14 21:00   ` Paul Moore
2014-05-14 21:26     ` Andy Lutomirski
2014-05-15 15:14       ` Paul Moore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.