aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-05-10 18:34:16 -0400
committerEric Paris <eparis@redhat.com>2011-05-11 12:58:09 -0400
commit7a627e3b9a2bd0f06945bbe64bcf403e788ecf6e (patch)
tree5d79dfee7868debdf428640477adce32be10968f /security
parent2875fa00830be62431f5ac22d8f85d57f9fa3033 (diff)
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 <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Eric Paris <eparis@parisplace.org> Cc: Lennart Poettering <mzerqung@0pointer.de> Cc: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> [include kobject.h - Eric Paris] [use selinuxfs_obj throughout - Eric Paris] Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/selinuxfs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 973f5a4a6fce..fde4e9d64bfd 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -28,6 +28,7 @@
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/audit.h> 29#include <linux/audit.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/kobject.h>
31 32
32/* selinuxfs pseudo filesystem for exporting the security policy API. 33/* selinuxfs pseudo filesystem for exporting the security policy API.
33 Based on the proc code and the fs/nfsd/nfsctl.c code. */ 34 Based on the proc code and the fs/nfsd/nfsctl.c code. */
@@ -1909,6 +1910,7 @@ static struct file_system_type sel_fs_type = {
1909}; 1910};
1910 1911
1911struct vfsmount *selinuxfs_mount; 1912struct vfsmount *selinuxfs_mount;
1913static struct kobject *selinuxfs_kobj;
1912 1914
1913static int __init init_sel_fs(void) 1915static int __init init_sel_fs(void)
1914{ 1916{
@@ -1916,9 +1918,16 @@ static int __init init_sel_fs(void)
1916 1918
1917 if (!selinux_enabled) 1919 if (!selinux_enabled)
1918 return 0; 1920 return 0;
1921
1922 selinuxfs_kobj = kobject_create_and_add("selinux", fs_kobj);
1923 if (!selinuxfs_kobj)
1924 return -ENOMEM;
1925
1919 err = register_filesystem(&sel_fs_type); 1926 err = register_filesystem(&sel_fs_type);
1920 if (err) 1927 if (err) {
1928 kobject_put(selinuxfs_kobj);
1921 return err; 1929 return err;
1930 }
1922 1931
1923 selinuxfs_mount = kern_mount(&sel_fs_type); 1932 selinuxfs_mount = kern_mount(&sel_fs_type);
1924 if (IS_ERR(selinuxfs_mount)) { 1933 if (IS_ERR(selinuxfs_mount)) {
@@ -1935,6 +1944,7 @@ __initcall(init_sel_fs);
1935#ifdef CONFIG_SECURITY_SELINUX_DISABLE 1944#ifdef CONFIG_SECURITY_SELINUX_DISABLE
1936void exit_sel_fs(void) 1945void exit_sel_fs(void)
1937{ 1946{
1947 kobject_put(selinuxfs_kobj);
1938 unregister_filesystem(&sel_fs_type); 1948 unregister_filesystem(&sel_fs_type);
1939} 1949}
1940#endif 1950#endif