On Fri, Jun 13, 2014 at 05:49:24PM +0200, Tom Gundersen wrote: > On Fri, Jun 13, 2014 at 4:41 PM, Werner Fink <wer...@suse.de> wrote: > > From: Ruediger Oertel <r...@suse.de> > > > > Process 1 (aka init) needs to be started with an empty signal mask. > > That includes the process 1 that's started after the initrd is finished. > > When the initrd is using systemd (as it does with dracut based initrds) > > then it is systemd that calls the real init. Normally this is systemd > > again, except when the user uses for instance "init=/bin/bash" on the > > kernel command line. > > Why is this necessary for /bin/bash, but not for /lib/systemd/systemd? > Please include the explanation in the commit message.
I do not understand your question. AFAIK the signal mask is set by systemd accordingly to man:systemd.service(5) ... the only problem with this schem is that /bin/bash nor any other shell does reset its signal mask. I guess that systemd will support the init=/bin/bash on the kernel command line. IMHO this requires a clean signal mask. Werner > > --- > > src/core/main.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git src/core/main.c src/core/main.c > > index d5d1ee2..c082354 100644 > > --- src/core/main.c > > +++ src/core/main.c > > @@ -1831,6 +1831,7 @@ finish: > > if (reexecute) { > > const char **args; > > unsigned i, args_size; > > + sigset_t ss, o_ss; > > > > /* Close and disarm the watchdog, so that the new > > * instance can reinitialize it, but doesn't get > > @@ -1914,6 +1915,11 @@ finish: > > args[i++] = NULL; > > assert(i <= args_size); > > > > + /* reenable any blocked signals, especially important > > + * if we switch from initial ramdisk to init=... */ > > + sigemptyset(&ss); > > + sigprocmask(SIG_SETMASK,&ss,&o_ss); > > + > > if (switch_root_init) { > > args[0] = switch_root_init; > > execv(args[0], (char* const*) args); > > @@ -1932,6 +1938,9 @@ finish: > > log_error("Failed to execute /bin/sh, giving up: > > %m"); > > } else > > log_warning("Failed to execute /sbin/init, giving > > up: %m"); > > + > > + /* back to saved state if reexec failed */ > > + sigprocmask(SIG_SETMASK,&o_ss,NULL); > > } > > > > if (arg_serialization) { > > -- > > 1.7.9.2 Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr
pgpCY2aPgnV8R.pgp
Description: PGP signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel