summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/kmod.c14
-rw-r--r--security/Kconfig35
2 files changed, 49 insertions, 0 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 426a614e97fe..0c407f905ca4 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -528,7 +528,12 @@ struct subprocess_info *call_usermodehelper_setup(const char *path, char **argv,
528 goto out; 528 goto out;
529 529
530 INIT_WORK(&sub_info->work, call_usermodehelper_exec_work); 530 INIT_WORK(&sub_info->work, call_usermodehelper_exec_work);
531
532#ifdef CONFIG_STATIC_USERMODEHELPER
533 sub_info->path = CONFIG_STATIC_USERMODEHELPER_PATH;
534#else
531 sub_info->path = path; 535 sub_info->path = path;
536#endif
532 sub_info->argv = argv; 537 sub_info->argv = argv;
533 sub_info->envp = envp; 538 sub_info->envp = envp;
534 539
@@ -566,6 +571,15 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
566 retval = -EBUSY; 571 retval = -EBUSY;
567 goto out; 572 goto out;
568 } 573 }
574
575 /*
576 * If there is no binary for us to call, then just return and get out of
577 * here. This allows us to set STATIC_USERMODEHELPER_PATH to "" and
578 * disable all call_usermodehelper() calls.
579 */
580 if (strlen(sub_info->path) == 0)
581 goto out;
582
569 /* 583 /*
570 * Set the completion pointer only if there is a waiter. 584 * Set the completion pointer only if there is a waiter.
571 * This makes it possible to use umh_complete to free 585 * This makes it possible to use umh_complete to free
diff --git a/security/Kconfig b/security/Kconfig
index 118f4549404e..d900f47eaa68 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -158,6 +158,41 @@ config HARDENED_USERCOPY_PAGESPAN
158 been removed. This config is intended to be used only while 158 been removed. This config is intended to be used only while
159 trying to find such users. 159 trying to find such users.
160 160
161config STATIC_USERMODEHELPER
162 bool "Force all usermode helper calls through a single binary"
163 help
164 By default, the kernel can call many different userspace
165 binary programs through the "usermode helper" kernel
166 interface. Some of these binaries are statically defined
167 either in the kernel code itself, or as a kernel configuration
168 option. However, some of these are dynamically created at
169 runtime, or can be modified after the kernel has started up.
170 To provide an additional layer of security, route all of these
171 calls through a single executable that can not have its name
172 changed.
173
174 Note, it is up to this single binary to then call the relevant
175 "real" usermode helper binary, based on the first argument
176 passed to it. If desired, this program can filter and pick
177 and choose what real programs are called.
178
179 If you wish for all usermode helper programs are to be
180 disabled, choose this option and then set
181 STATIC_USERMODEHELPER_PATH to an empty string.
182
183config STATIC_USERMODEHELPER_PATH
184 string "Path to the static usermode helper binary"
185 depends on STATIC_USERMODEHELPER
186 default "/sbin/usermode-helper"
187 help
188 The binary called by the kernel when any usermode helper
189 program is wish to be run. The "real" application's name will
190 be in the first argument passed to this program on the command
191 line.
192
193 If you wish for all usermode helper programs to be disabled,
194 specify an empty string here (i.e. "").
195
161source security/selinux/Kconfig 196source security/selinux/Kconfig
162source security/smack/Kconfig 197source security/smack/Kconfig
163source security/tomoyo/Kconfig 198source security/tomoyo/Kconfig