]> err.no Git - linux-2.6/commitdiff
[PATCH] selinux: Clear selinux_enabled flag upon runtime disable.
authorStephen Smalley <sds@tycho.nsa.gov>
Wed, 3 May 2006 14:52:36 +0000 (10:52 -0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 3 May 2006 17:08:11 +0000 (10:08 -0700)
Clear selinux_enabled flag upon runtime disable of SELinux by userspace,
and make sure it is defined even if selinux= boot parameter support is
not enabled in configuration.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Tested-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
security/selinux/hooks.c
security/selinux/include/security.h

index 3cf368a16448c54a4fccd4686765fd8569cee50a..d987048d3f330526b31185d5023ea8fd4c891027 100644 (file)
@@ -101,6 +101,8 @@ static int __init selinux_enabled_setup(char *str)
        return 1;
 }
 __setup("selinux=", selinux_enabled_setup);
+#else
+int selinux_enabled = 1;
 #endif
 
 /* Original (dummy) security module. */
@@ -4535,6 +4537,7 @@ int selinux_disable(void)
        printk(KERN_INFO "SELinux:  Disabled at runtime.\n");
 
        selinux_disabled = 1;
+       selinux_enabled = 0;
 
        /* Reset security_ops to the secondary module, dummy or capability. */
        security_ops = secondary_ops;
index 5f016c98056f53e35491c779fcb3dd2dc23c54c9..063af47bb23175b4887fd634ea541fd2ae6eef05 100644 (file)
 #define POLICYDB_VERSION_MIN   POLICYDB_VERSION_BASE
 #define POLICYDB_VERSION_MAX   POLICYDB_VERSION_AVTAB
 
-#ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM
 extern int selinux_enabled;
-#else
-#define selinux_enabled 1
-#endif
-
 extern int selinux_mls_enabled;
 
 int security_load_policy(void * data, size_t len);