aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorwzt.wzt@gmail.com <wzt.wzt@gmail.com>2010-02-23 10:15:28 -0500
committerJames Morris <jmorris@namei.org>2010-02-23 16:11:02 -0500
commit189b3b1c89761054fee3438f063d7f257306e2d8 (patch)
tree8099352fa731fca91b95d862ac0d7199f21ca54d /security/selinux
parent2ae3ba39389b51d8502123de0a59374bec899c4d (diff)
Security: add static to security_ops and default_security_ops variable
Enhance the security framework to support resetting the active security module. This eliminates the need for direct use of the security_ops and default_security_ops variables outside of security.c, so make security_ops and default_security_ops static. Also remove the secondary_ops variable as a cleanup since there is no use for that. secondary_ops was originally used by SELinux to call the "secondary" security module (capability or dummy), but that was replaced by direct calls to capability and the only remaining use is to save and restore the original security ops pointer value if SELinux is disabled by early userspace based on /etc/selinux/config. Further, if we support this directly in the security framework, then we can just use &default_security_ops for this purpose since that is now available. Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6b36ce2eef2e..dc7660074b99 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -126,13 +126,6 @@ __setup("selinux=", selinux_enabled_setup);
126int selinux_enabled = 1; 126int selinux_enabled = 1;
127#endif 127#endif
128 128
129
130/*
131 * Minimal support for a secondary security module,
132 * just to allow the use of the capability module.
133 */
134static struct security_operations *secondary_ops;
135
136/* Lists of inode and superblock security structures initialized 129/* Lists of inode and superblock security structures initialized
137 before the policy was loaded. */ 130 before the policy was loaded. */
138static LIST_HEAD(superblock_security_head); 131static LIST_HEAD(superblock_security_head);
@@ -5674,9 +5667,6 @@ static __init int selinux_init(void)
5674 0, SLAB_PANIC, NULL); 5667 0, SLAB_PANIC, NULL);
5675 avc_init(); 5668 avc_init();
5676 5669
5677 secondary_ops = security_ops;
5678 if (!secondary_ops)
5679 panic("SELinux: No initial security operations\n");
5680 if (register_security(&selinux_ops)) 5670 if (register_security(&selinux_ops))
5681 panic("SELinux: Unable to register with kernel.\n"); 5671 panic("SELinux: Unable to register with kernel.\n");
5682 5672
@@ -5837,8 +5827,7 @@ int selinux_disable(void)
5837 selinux_disabled = 1; 5827 selinux_disabled = 1;
5838 selinux_enabled = 0; 5828 selinux_enabled = 0;
5839 5829
5840 /* Reset security_ops to the secondary module, dummy or capability. */ 5830 reset_security_ops();
5841 security_ops = secondary_ops;
5842 5831
5843 /* Try to destroy the avc node cache */ 5832 /* Try to destroy the avc node cache */
5844 avc_disable(); 5833 avc_disable();