From: Greg Kroah-Hartman <gre...@suse.de>

In the interest of keeping userspace from having to create new root
filesystems all the time, let's follow the lead of the other in-kernel
filesystems and provide a proper mount point for it in sysfs.

For selinuxfs, this mount point should be in /sys/fs/selinux/

Cc: Stephen Smalley <s...@tycho.nsa.gov>
Cc: James Morris <jmor...@namei.org>
Cc: Eric Paris <epa...@parisplace.org>
Cc: Lennart Poettering <mzerq...@0pointer.de>
Cc: Daniel J Walsh <dwa...@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gre...@suse.de>

---

Resend, due to lack of response.

Note, patch is untested, I don't have any selinux-based machines here,
sorry.


diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index ea39cb7..2381c16 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1897,6 +1897,7 @@ static struct file_system_type sel_fs_type = {
 };
 
 struct vfsmount *selinuxfs_mount;
+static struct kobject *selinuxfs_kobj;
 
 static int __init init_sel_fs(void)
 {
@@ -1904,9 +1905,16 @@ static int __init init_sel_fs(void)
 
        if (!selinux_enabled)
                return 0;
+
+       selinux_kobj = kobject_create_and_add("selinux", fs_kobj);
+       if (!selinux_kobj)
+               return -ENOMEM;
+
        err = register_filesystem(&sel_fs_type);
-       if (err)
+       if (err) {
+               kobject_put(selinux_kobj);
                return err;
+       }
 
        selinuxfs_mount = kern_mount(&sel_fs_type);
        if (IS_ERR(selinuxfs_mount)) {
@@ -1923,6 +1931,7 @@ __initcall(init_sel_fs);
 #ifdef CONFIG_SECURITY_SELINUX_DISABLE
 void exit_sel_fs(void)
 {
+       kobjext_put(selinux_kobj);
        unregister_filesystem(&sel_fs_type);
 }
 #endif
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to