OSDN Git Service

[PATCH] do not mark init_idle() __init
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Jun 2007 05:26:30 +0000 (07:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Jun 2007 05:27:01 +0000 (07:27 +0200)
Zbigniew Baniewski reported a panic at boot when using
CONFIG_BLK_DEV_IDEDISK=m. The code crashed when calling init_idle().

PaX Team brought to my attention that init_idle() is marked __init,
and is called from cpu_idle() (which is not) itself called from
rest_init() (which is not either), on top of which there is a big
shiny comment :

 * We need to finalize in a non-__init function or else race conditions
 * between the root thread and the init thread may cause start_kernel to
 * be reaped by free_initmem before the root thread has proceeded to
 * cpu_idle.

Indeed. Simply removing __init from init_idle fixed the panic.

kernel/sched.c

index 2e49023..5ee0e78 100644 (file)
@@ -1352,7 +1352,7 @@ void daemonize(void)
 
 extern unsigned long wait_init_idle;
 
-void __init init_idle(void)
+void init_idle(void)
 {
        struct schedule_data * sched_data;
        sched_data = &aligned_data[smp_processor_id()].schedule_data;