Bug 481199 - waitpid() reports stopped process more than once
Summary: waitpid() reports stopped process more than once
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.3
Hardware: All
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Vitaly Mayatskikh
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
: 456342 (view as bug list)
Depends On:
Blocks: 486945
TreeView+ depends on / blocked
 
Reported: 2009-01-22 18:16 UTC by Denys Vlasenko
Modified: 2018-10-20 01:58 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 08:13:13 UTC


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


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1243 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 5.4 kernel security and bug fix update 2009-09-01 08:53:34 UTC

Description Denys Vlasenko 2009-01-22 18:16:21 UTC
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 16:05:57 UTC
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 15:44:05 UTC
Updating PM score.

Comment 4 RHEL Product and Program Management 2009-02-17 15:31:27 UTC
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 15:59:15 UTC
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 08:13:13 UTC
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 18:52:22 UTC
*** 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.