On Wed, May 11, 2011 at 12:35 PM, Eric Paris <epa...@parisplace.org> wrote:
> On Tue, May 10, 2011 at 6:34 PM, Greg KH <g...@kroah.com> wrote:
>>
>> 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.

I just committed the attached patch to my -next tree.

-Eric
commit 0599ea55fd0a0fc3b647dbf1ade09f9c0ddd8c05
Author: Greg Kroah-Hartman <gre...@suse.de>
Date:   Tue May 10 15:34:16 2011 -0700

    SELINUX: add /sys/fs/selinux mount point to put selinuxfs
    
    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>
    [include kobject.h - Eric Paris]
    [use selinuxfs_obj throughout - Eric Paris]
    Signed-off-by: Eric Paris <epa...@redhat.com>

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index ea39cb7..ea756a6 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -28,6 +28,7 @@
 #include <linux/percpu.h>
 #include <linux/audit.h>
 #include <linux/uaccess.h>
+#include <linux/kobject.h>
 
 /* selinuxfs pseudo filesystem for exporting the security policy API.
    Based on the proc code and the fs/nfsd/nfsctl.c code. */
@@ -1897,6 +1898,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 +1906,16 @@ static int __init init_sel_fs(void)
 
 	if (!selinux_enabled)
 		return 0;
+
+	selinuxfs_kobj = kobject_create_and_add("selinux", fs_kobj);
+	if (!selinuxfs_kobj)
+		return -ENOMEM;
+
 	err = register_filesystem(&sel_fs_type);
-	if (err)
+	if (err) {
+		kobject_put(selinuxfs_kobj);
 		return err;
+	}
 
 	selinuxfs_mount = kern_mount(&sel_fs_type);
 	if (IS_ERR(selinuxfs_mount)) {
@@ -1923,6 +1932,7 @@ __initcall(init_sel_fs);
 #ifdef CONFIG_SECURITY_SELINUX_DISABLE
 void exit_sel_fs(void)
 {
+	kobject_put(selinuxfs_kobj);
 	unregister_filesystem(&sel_fs_type);
 }
 #endif
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to