Bug 481199 - waitpid() reports stopped process more than once
waitpid() reports stopped process more than once
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.3
All Linux
urgent Severity medium
: rc
: ---
Assigned To: Vitaly Mayatskikh
Red Hat Kernel QE team
: ZStream
: 456342 (view as bug list)
Depends On:
Blocks: 486945
  Show dependency treegraph
 
Reported: 2009-01-22 13:16 EST by Denys Vlasenko
Modified: 2011-02-02 13:52 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 04:13:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Kernel patch: do not report stops more than once (1.10 KB, patch)
2009-01-22 13:16 EST, Denys Vlasenko
no flags Details | Diff

  None (edit)
Description Denys Vlasenko 2009-01-22 13:16:21 EST
Created attachment 329724 [details]
Kernel patch: do not report stops more than once

Forking off a kernel bug discovered while working on a strace improvement (bug 478419).

Oleg Nesterov's comment from bug 478419:
===============
simple test case:

int main(void)
{
        int pid, status;

        pid = fork();
        if (!pid) {
                ptrace(PTRACE_TRACEME, 0, 0, 0);
                return kill(getpid(), SIGSTOP);
        }

        wait(&status);
        printf("status: %04X\n", status);

        ptrace(PTRACE_SYSCALL, pid, 0, SIGSTOP);

        wait(&status);
        printf("status: %04X\n", status);

        wait(&status);
        printf("status: %04X\n", status);

        return 0;
}

ouput:

    status: 137F
    status: 137F
    status: 007F

Imho bug. Fedora is fine, and I bet upstream too.
===============

In fact, in the above example wait() will report SIGSTOPed process infinitely many times (if you put wait() in the loop), but it should block on the second call.

Attached patch seems to fix it. Run tested.
Comment 1 Denys Vlasenko 2009-02-03 11:05:57 EST
Created a testcase for it, waitpid-double-report:

http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/waitpid-double-report.c?cvsroot=systemtap
Comment 3 RHEL Product and Program Management 2009-02-16 10:44:05 EST
Updating PM score.
Comment 4 RHEL Product and Program Management 2009-02-17 10:31:27 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 7 Don Zickus 2009-04-27 11:59:15 EDT
in kernel-2.6.18-141.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.
Comment 12 errata-xmlrpc 2009-09-02 04:13:13 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1243.html
Comment 14 Oleg Nesterov 2011-02-02 13:52:22 EST
*** Bug 456342 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.