aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-08-04 04:03:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-04 04:03:29 -0400
commit288d5abec8314ae50fe6692f324b0444acae8486 (patch)
tree58a6903344b8d9b2252144356a132a05a8359876
parent33f35f2a4ee3abfc0f87990058aa1b6b5092f725 (diff)
Boot up with usermodehelper disabled
The core device layer sends tons of uevent notifications for each device it finds, and if the kernel has been built with a non-empty CONFIG_UEVENT_HELPER_PATH that will make us try to execute the usermode helper binary for all these events very early in the boot. Not only won't the root filesystem even be mounted at that point, we literally won't have necessarily even initialized all the process handling data structures at that point, which causes no end of silly problems even when the usermode helper doesn't actually succeed in executing. So just use our existing infrastructure to disable the usermodehelpers to make the kernel start out with them disabled. We enable them when we've at least initialized stuff a bit. Problems related to an uninitialized init_ipc_ns.ids[IPC_SHM_IDS].rw_mutex reported by various people. Reported-by: Manuel Lauss <manuel.lauss@googlemail.com> Reported-by: Richard Weinberger <richard@nod.at> Reported-by: Marc Zyngier <maz@misterjones.org> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Vasiliy Kulikov <segoon@openwall.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--init/main.c5
-rw-r--r--kernel/kmod.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index 1952d37e4ecb..9c51ee7adf3d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -369,9 +369,12 @@ static noinline void __init_refok rest_init(void)
369 init_idle_bootup_task(current); 369 init_idle_bootup_task(current);
370 preempt_enable_no_resched(); 370 preempt_enable_no_resched();
371 schedule(); 371 schedule();
372 preempt_disable(); 372
373 /* At this point, we can enable user mode helper functionality */
374 usermodehelper_enable();
373 375
374 /* Call into cpu_idle with preempt disabled */ 376 /* Call into cpu_idle with preempt disabled */
377 preempt_disable();
375 cpu_idle(); 378 cpu_idle();
376} 379}
377 380
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 47613dfb7b28..ddc7644c1305 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -274,7 +274,7 @@ static void __call_usermodehelper(struct work_struct *work)
274 * (used for preventing user land processes from being created after the user 274 * (used for preventing user land processes from being created after the user
275 * land has been frozen during a system-wide hibernation or suspend operation). 275 * land has been frozen during a system-wide hibernation or suspend operation).
276 */ 276 */
277static int usermodehelper_disabled; 277static int usermodehelper_disabled = 1;
278 278
279/* Number of helpers running */ 279/* Number of helpers running */
280static atomic_t running_helpers = ATOMIC_INIT(0); 280static atomic_t running_helpers = ATOMIC_INIT(0);