Bug 3205 - Ptrace requests may be masked by failed signal delivery.
Summary: Ptrace requests may be masked by failed signal delivery.
Status: RESOLVED WORKSFORME
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andrew Cagney
URL:
Keywords:
Depends on:
Blocks: 1496 2654
  Show dependency treegraph
 
Reported: 2006-09-14 16:42 UTC by Chris Moller
Modified: 2006-10-09 19:20 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Testcase demonstrating the failure. (509 bytes, text/plain)
2006-09-22 14:25 UTC, Chris Moller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Moller 2006-09-14 16:42:41 UTC
In ptrace requests that can also deliver a signal to the affected process, the
request itself can be ignored if the signal delivery fails.  E.g., in
kerne/ptrace.c, the code for PTRACE_DETACH is:

                ret = ptrace_induce_signal(child, engine, data);
                if (!ret)
                        ret = ptrace_detach(child, engine);

Similar code exists in other places such as that for PTRACE_CONT.

This code is in linux-2.6.17 with the utrace patches applied.

The behaviour can be exercised by, e.g., calling ptrace(PTRACE_DETACH, pid,
NULL, sig) where sig either is an invalid signal, or some internal conditions in
ptrace.c aren't met.

Also https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206475
Comment 1 Chris Moller 2006-09-22 14:25:35 UTC
Created attachment 1316 [details]
Testcase demonstrating the failure.

This t/c does two ptrace(PTRACE_DETACH...) operations.	The first tries to
deliver an invalid signal--999--thereby failing (rc == -1) and inhibiting the
intended detach.  The second delivers a valid SIGKILL and succeeds (rc == 0).
Comment 2 Roland McGrath 2006-09-28 20:45:18 UTC
vanilla kernel's ptrace_detach also fails for invalid signal

what is the errno in the real failure case?  
Comment 3 Chris Moller 2006-10-09 19:20:34 UTC
This is really "NOTABUG" but there's no option under "Resolve bug" for that.