* 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
* Re: hang from HUP'ing init in linuxrc
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
1 sibling, 0 replies; 3+ messages in thread
From: Ben LaHaise @ 2001-07-02 4:24 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linux-kernel
On Mon, 2 Jul 2001, Paul Mackerras wrote:
> 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?
Well, linuxrc and a number of aspects of the boot process seem to suffer
from attempting to kludge userspace programs into the kernel. To this
end, I would like to propose that we move these functions into userspace
where they belong and instead provide support for linking an initial
filesystem image into vmlinux. We can then move linuxrc, dhcp and other
such bits out of the kernel and use the same code as is normally used at
run time -> it's better tested and easier to fix.
-ben
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hang from HUP'ing init in linuxrc
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
1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2001-07-02 8:48 UTC (permalink / raw)
To: paulus; +Cc: linux-kernel
Paul Mackerras writes:
> 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));
>
...
[ no signal delivery due to returning to kernel space, blah blah blah
:-) ]
For 2.4.x I'd just check for sigpending in this wait loop.
Longer term (ie. 2.5.x and onward) we should look into ideas like those
mentioned by Ben. I for one would not complain about seeing dhcp
getting removed from the kernel :-)
Later,
David S. Miller
davem@redhat.com
^ 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®