[lkml]   [2002]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[BUG] execve("/bin/sh"...) in init/main.c
If init cannot be executed, the init(.) function in init/main.c falls back to 
sh and calls execve("/bin/sh", argv_init, envp_init).

But if there is no "init=" in the command line, argv_init can contain
something (most likely the "auto" preprended by lilo) and the shell will
terminate immediately. (parse_options(.) does not handle this case since it
does not find "init=").

I used the simple patch below to correct the problem.


--- linux-2.4.18/init/main.c Mon Feb 25 20:38:13 2002
+++ linux/init/main.c Wed Feb 27 18:46:51 2002
@@ -130,6 +130,7 @@
char root_device_name[64];

+static char * argv_sh[2] = { "sh", NULL };
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };

@@ -835,6 +836,6 @@
- execve("/bin/sh",argv_init,envp_init);
+ execve("/bin/sh",argv_sh,envp_init);
panic("No init found. Try passing init= option to kernel.");
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 13:24    [W:0.039 / U:7.928 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site