diff options
author | James Morris <jmorris@namei.org> | 2007-10-17 02:31:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:43:07 -0400 |
commit | 20510f2f4e2dabb0ff6c13901807627ec9452f98 (patch) | |
tree | d64b9eeb90d577f7f9688a215c4c6c3c2405188a /security/root_plug.c | |
parent | 5c3b447457789374cdb7b03afe2540d48c649a36 (diff) |
security: Convert LSM into a static interface
Convert LSM into a static interface, as the ability to unload a security
module is not required by in-tree users and potentially complicates the
overall security architecture.
Needlessly exported LSM symbols have been unexported, to help reduce API
abuse.
Parameters for the capability and root_plug modules are now specified
at boot.
The SECURITY_FRAMEWORK_VERSION macro has also been removed.
In a nutshell, there is no safe way to unload an LSM. The modular interface
is thus unecessary and broken infrastructure. It is used only by out-of-tree
modules, which are often binary-only, illegal, abusive of the API and
dangerous, e.g. silently re-vectoring SELinux.
[akpm@linux-foundation.org: cleanups]
[akpm@linux-foundation.org: USB Kconfig fix]
[randy.dunlap@oracle.com: fix LSM kernel-doc]
Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Acked-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/root_plug.c')
-rw-r--r-- | security/root_plug.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/security/root_plug.c b/security/root_plug.c index 38dd4f3e641..870f13095bb 100644 --- a/security/root_plug.c +++ b/security/root_plug.c | |||
@@ -22,11 +22,11 @@ | |||
22 | * License. | 22 | * License. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
27 | #include <linux/init.h> | 26 | #include <linux/init.h> |
28 | #include <linux/security.h> | 27 | #include <linux/security.h> |
29 | #include <linux/usb.h> | 28 | #include <linux/usb.h> |
29 | #include <linux/moduleparam.h> | ||
30 | 30 | ||
31 | /* flag to keep track of how we were registered */ | 31 | /* flag to keep track of how we were registered */ |
32 | static int secondary; | 32 | static int secondary; |
@@ -36,22 +36,14 @@ static int vendor_id = 0x0557; | |||
36 | static int product_id = 0x2008; | 36 | static int product_id = 0x2008; |
37 | 37 | ||
38 | module_param(vendor_id, uint, 0400); | 38 | module_param(vendor_id, uint, 0400); |
39 | MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for"); | ||
40 | |||
41 | module_param(product_id, uint, 0400); | 39 | module_param(product_id, uint, 0400); |
42 | MODULE_PARM_DESC(product_id, "USB Product ID of device to look for"); | ||
43 | 40 | ||
44 | /* should we print out debug messages */ | 41 | /* should we print out debug messages */ |
45 | static int debug = 0; | 42 | static int debug = 0; |
46 | 43 | ||
47 | module_param(debug, bool, 0600); | 44 | module_param(debug, bool, 0600); |
48 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
49 | 45 | ||
50 | #if defined(CONFIG_SECURITY_ROOTPLUG_MODULE) | ||
51 | #define MY_NAME THIS_MODULE->name | ||
52 | #else | ||
53 | #define MY_NAME "root_plug" | 46 | #define MY_NAME "root_plug" |
54 | #endif | ||
55 | 47 | ||
56 | #define root_dbg(fmt, arg...) \ | 48 | #define root_dbg(fmt, arg...) \ |
57 | do { \ | 49 | do { \ |
@@ -117,25 +109,4 @@ static int __init rootplug_init (void) | |||
117 | return 0; | 109 | return 0; |
118 | } | 110 | } |
119 | 111 | ||
120 | static void __exit rootplug_exit (void) | ||
121 | { | ||
122 | /* remove ourselves from the security framework */ | ||
123 | if (secondary) { | ||
124 | if (mod_unreg_security (MY_NAME, &rootplug_security_ops)) | ||
125 | printk (KERN_INFO "Failure unregistering Root Plug " | ||
126 | " module with primary module.\n"); | ||
127 | } else { | ||
128 | if (unregister_security (&rootplug_security_ops)) { | ||
129 | printk (KERN_INFO "Failure unregistering Root Plug " | ||
130 | "module with the kernel\n"); | ||
131 | } | ||
132 | } | ||
133 | printk (KERN_INFO "Root Plug module removed\n"); | ||
134 | } | ||
135 | |||
136 | security_initcall (rootplug_init); | 112 | security_initcall (rootplug_init); |
137 | module_exit (rootplug_exit); | ||
138 | |||
139 | MODULE_DESCRIPTION("Root Plug sample LSM module, written for Linux Journal article"); | ||
140 | MODULE_LICENSE("GPL"); | ||
141 | |||