lkml.org 
[lkml]   [1998]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: A bug in setpgid in kernel
Date
hjl@lucon.org (H.J. Lu) writes:
> While working on the POSIX testsuite, I think I found another kernel
> bug. This time it is setpgid.

Is there any rational as to how these tests are trying to work? It is
difficult to understand what the test is attempting.

Anyway, here are my thoughts, which may lead someone onto working out
the underlying problem.

As I can see, the process forks. The parent then waits for the exit
status of the child. The child creates a new process group using
setpgid(0,0). The child forks to create a granchild which just sends
itself a STOP signal. The child then waits, and then sends itself an
abort signal. If the original process sees the child was killed with
an abort signal, it is happy.

Under 2.0, this test passes. Under 2.1.127 this fails.

The code for setpgid is basically unchanged between 2.0 and 2.1, so it
must be the handling of task->pgrp that is causing the test to fail,
not the creation of a new process group.

I suspect that the problem is related to orphaned process groups.
When the child exits, exit_notify() notices that the process group is
about to become orphaned with stopped jobs, and sends a HUP and CONT to
the process group.

Now, the process group consists of the child and the grandchild.
The child is exiting, and is a zombie. However, I can't see anything
that would stop the kernel attempting to deliver the HUP signal to the
zombie child (the one currently in exit_notify) via kill_pg. If this
is the case, then the exit_code gets set to 0, which overwrites the
expected exit code of 134 set in do_exit().

It is this exit_code of 0 being reported via wait4 that causes the POSIX
test to fail.

I haven't had time to try putting in "if(p->state==TASK_ZOMBIE)continue",
in the for_each_task in kill_pg_info to see if this makes a difference.

An interesting aspect is that if run under "strace -f", this test passes.
I can't explain that -- I'll leave that as an aside.

--
`O O' | Home: Nick.Holloway@alfie.demon.co.uk http://www.alfie.demon.co.uk/
// ^ \\ | Work: Nick.Holloway@parallax.co.uk

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.058 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site