[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: ash acts like init
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2009-03-29 14:47:01
Message-ID: 200903291647.01454.vda.linux () googlemail ! com
[Download RAW message or body]

On Sunday 29 March 2009 13:11, casty@centolos.com wrote:
> > It means that init=/bin/ash didn't take effect somehow.
> 
> /usr/src/linux/init/main.c
> 
> static char* argv_init[MAX_INT_ARGS+2] = {"init",NULL, };
> 
> ...so argv[0] = "init"....
> 
> static void __init parse_options(char *line){
> ... for each string without spaces ...{
>   if (!strncmp(line,"init=",5)){
>     line += 5;
>     execute_command = line;  // execute_command = "/bin/ash"
>     args = 0;
>     continue;
>     }
> ...
>   if (*line)
>     argv_init[++args] = line;  // argv[0] is never touched (++args)
>   }
> }
> 
> later, execve(execute_command, argv_init,...) is called. So it calls "sh"
> but argv[0] is "init" :(

I just tried booting with modified busybox and init=/bin/ash, and I see this:

...boot log ends...
argv[0]:'/bin/ash'
/ # _

So it works.

I don't know at which version of kernel do you look, but I see this
in linux-2.6.28:

static void run_init_process(char *init_filename)
{
        argv_init[0] = init_filename;
        kernel_execve(init_filename, argv_init, envp_init);
}

--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic