On 5/10/2011 3:34 PM, Greg KH 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.
>
> For selinuxfs, this mount point should be in /sys/fs/selinux/

It seems that we might want this to be an LSM interface standard.
Is the call to kobject_create_and_add and associated cleanup all
that's required? I would want Smack to follow the convention as
well.


> 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
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-security-module" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to