mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* hang from HUP'ing init in linuxrc
@ 2001-07-02  3:50 Paul Mackerras
  2001-07-02  4:24 ` Ben LaHaise
  2001-07-02  8:48 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Mackerras @ 2001-07-02  3:50 UTC (permalink / raw)
  To: linux-kernel

Recently I tried running the Debian installer on top of a 2.4.6-pre6
kernel.  It got up to the point of installing libc and then the system
hung.  It was still taking interrupts (I could change vt's, etc.) but
no user processes were running.

What was happening was rather interesting.  The init process was stuck
inside prepare_namespace(), in the while loop here (this is lines 749
- 751 of init/main.c):

		pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
		if (pid>0)
			while (pid != wait(&i));

The installer had sent a HUP signal to init.  The init process thus
had current->sigpending == 1.  When it called wait, it got down into
sys_wait4 which worked out that there were children but none were
zombies, and at that point it would normally sleep, but because there
were signals pending, it returned -ERESTARTSYS.  Now, on the way out
from the system call, the kernel noticed that it was returning to
kernel mode and thus didn't deliver any signals, and sigpending stayed
at 1.

Thus the system was sitting in a tight loop calling wait() over and
over again in kernel mode in the init process.

This was on PPC.  I had a look at the i386 code and AFAICS it will do
the same thing.  The check for whether we are returning to user mode
is in do_signal there (whereas PPC does the check in entry.S) but the
net effect in both cases is that we don't execute the main body of
do_signal when we are returning from a syscall from a process running
in kernel mode.

I'm not sure what the best way to fix this is.  The problem would crop
up whenever we have a kernel thread which wants to wait for a child
process.  I don't think we want to start delivering signals to kernel
threads in the same way that we do to usermode processes though.

Any suggestions?

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-07-02  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02  3:50 hang from HUP'ing init in linuxrc Paul Mackerras
2001-07-02  4:24 ` Ben LaHaise
2001-07-02  8:48 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®