[PATCH][SELINUX] Allow all filesystems to specify fscreate mountoption

From: James Morris
Date: Thu Sep 23 2004 - 00:23:42 EST


The patch below allows all types of filesystems to specify the fscreate
mount option (which is used to specify the security context of the
filesystem itself). This was previously only available for filesystems
with full xattr security labeling, but is also potentially required for
filesystems with e.g. psuedo xattr labeling such as devpts and tmpfs.

An example of use is to specify at mount time the fs security context of a
tmpfs filesystem, overriding the default specified in policy for that
filesystem.

This patch has been in the Fedora kernel for some weeks with no problems.

Please apply.

Signed-off-by: James Morris <jmorris@xxxxxxxxxx>
Signed-off-by: Stephen Smalley <sds@xxxxxxxxxxxxxx>


diff -purN -X dontdiff linux-2.6.8.1.o/security/selinux/hooks.c linux-2.6.8.1.w/security/selinux/hooks.c
--- linux-2.6.8.1.o/security/selinux/hooks.c 2004-08-14 10:25:45.000000000 -0400
+++ linux-2.6.8.1.w/security/selinux/hooks.c 2004-08-24 23:30:37.000000000 -0400
@@ -386,13 +386,6 @@ static int try_context_mount(struct supe
break;

case Opt_fscontext:
- if (sbsec->behavior != SECURITY_FS_USE_XATTR) {
- rc = -EINVAL;
- printk(KERN_WARNING "SELinux: "
- "fscontext option is invalid for"
- " this filesystem type\n");
- goto out_free;
- }
if (seen & (Opt_context|Opt_fscontext)) {
rc = -EINVAL;
printk(KERN_WARNING SEL_MOUNT_FAIL_MSG);



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