mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix security check for joint context= and fscontext= mount options
@ 2006-07-13 20:24 Eric Paris
  0 siblings, 0 replies; only message in thread
From: Eric Paris @ 2006-07-13 20:24 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: sds, jmorris

After some discussion on the actual meaning of the filesystem class
security check in try context mount it was determined that the checks
for the context= mount options were not correct if fscontext mount
option had already been used.  When labeling the superblock we should be
checking relabel_from and relabel_to.  But if the superblock has already
been labeled (with fscontext) then context= is actually labeling the
inodes, and so we should be checking relabel_from and associate.  This
patch fixes which checks are called depending on the mount options.

This is issue is in 2.6.8-rc1-git4 and should probably be fixed before
2.6.18 releases.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>

 security/selinux/hooks.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -523,12 +523,16 @@ static int try_context_mount(struct supe
 			goto out_free;
 		}
 
-		rc = may_context_mount_sb_relabel(sid, sbsec, tsec);
-		if (rc)
-			goto out_free;
-
-		if (!fscontext)
+		if (!fscontext) {
+			rc = may_context_mount_sb_relabel(sid, sbsec, tsec);
+			if (rc)
+				goto out_free;
 			sbsec->sid = sid;
+		} else {
+			rc = may_context_mount_inode_relabel(sid, sbsec, tsec);
+			if (rc)
+				goto out_free;
+		}
 		sbsec->mntpoint_sid = sid;
 
 		sbsec->behavior = SECURITY_FS_USE_MNTPOINT;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-13 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-13 20:24 [PATCH] Fix security check for joint context= and fscontext= mount options Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome