diff options
author | Kees Cook <kees@ubuntu.com> | 2009-04-02 18:49:29 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-04-02 20:47:11 -0400 |
commit | 3d43321b7015387cfebbe26436d0e9d299162ea1 (patch) | |
tree | bae6bd123c8f573e844a7af11c96eb5f6a73e0ee /kernel/sysctl.c | |
parent | 8a6f83afd0c5355db6d11394a798e94950306239 (diff) |
modules: sysctl to block module loading
Implement a sysctl file that disables module-loading system-wide since
there is no longer a viable way to remove CAP_SYS_MODULE after the system
bounding capability set was removed in 2.6.25.
Value can only be set to "1", and is tested only if standard capability
checks allow CAP_SYS_MODULE. Given existing /dev/mem protections, this
should allow administrators a one-way method to block module loading
after initial boot-time module loading has finished.
Signed-off-by: Kees Cook <kees.cook@canonical.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c5ef44ff850f..2fb4246d27de 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -113,6 +113,7 @@ static int ngroups_max = NGROUPS_MAX; | |||
113 | 113 | ||
114 | #ifdef CONFIG_MODULES | 114 | #ifdef CONFIG_MODULES |
115 | extern char modprobe_path[]; | 115 | extern char modprobe_path[]; |
116 | extern int modules_disabled; | ||
116 | #endif | 117 | #endif |
117 | #ifdef CONFIG_CHR_DEV_SG | 118 | #ifdef CONFIG_CHR_DEV_SG |
118 | extern int sg_big_buff; | 119 | extern int sg_big_buff; |
@@ -533,6 +534,17 @@ static struct ctl_table kern_table[] = { | |||
533 | .proc_handler = &proc_dostring, | 534 | .proc_handler = &proc_dostring, |
534 | .strategy = &sysctl_string, | 535 | .strategy = &sysctl_string, |
535 | }, | 536 | }, |
537 | { | ||
538 | .ctl_name = CTL_UNNUMBERED, | ||
539 | .procname = "modules_disabled", | ||
540 | .data = &modules_disabled, | ||
541 | .maxlen = sizeof(int), | ||
542 | .mode = 0644, | ||
543 | /* only handle a transition from default "0" to "1" */ | ||
544 | .proc_handler = &proc_dointvec_minmax, | ||
545 | .extra1 = &one, | ||
546 | .extra2 = &one, | ||
547 | }, | ||
536 | #endif | 548 | #endif |
537 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 549 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
538 | { | 550 | { |