[systemd-devel] [PATCH] SELINUX: add /sys/fs/selinux mount point to put selinuxfs
Casey Schaufler
casey at schaufler-ca.com
Tue May 10 15:55:24 PDT 2011
On 5/10/2011 3:34 PM, Greg KH wrote:
> From: Greg Kroah-Hartman <gregkh at 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 <sds at tycho.nsa.gov>
> Cc: James Morris <jmorris at namei.org>
> Cc: Eric Paris <eparis at parisplace.org>
> Cc: Lennart Poettering <mzerqung at 0pointer.de>
> Cc: Daniel J Walsh <dwalsh at redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh at 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 at 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 majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
More information about the systemd-devel
mailing list