Red Hat Bugzilla – Bug 451849
ptrace(PTRACE_CONT, sig) kills app even if sig is blocked
Last modified: 2009-09-02 04:58:46 EDT
There was apparently a significant change in ptrace behavior somewhere between
2.6.9 (e.g., RHEL4) and 2.6.18 (e.g., RHEL5) that I couldn't find documented
ptrace(PTRACE_CONT, application_pid, 0, SIGUSR1)
will terminate the application even if the application has SIGUSR1 blocked, whereas
ptrace(PTRACE_CONT, application_pid, 0, 0);
kill (application_pid, SIGUSR1);
Is this a bug or a feature, and when was it introduced?
The attached pair of test programs below demonstrate this.
Created attachment 309666 [details]
test case: 2 1-file C programs
Created attachment 328559 [details]
When the signal to deliver is blocked, use a traditional signal in ptrace_induce_signal() instead of forcefully inject it with utrace_inject_signal().
Made a testcase for this bug, ptrace_cont-defeats-sigblock.c:
I forgot to signal the patch was posted on rhkl:
Jerome, if signal is blocked, your patch does prevent signal from being raised, but doesn't it accidentally also forget to make signal pending?
IOW: if process will later unblock this signal, will it be immediately raised?
If that signal is blocked, the signal is send through the traditional send_sig() function which will make that signal pending. The test case posted in first comment test that and is successful on patched kernel.
Have you noticed any problem with your test case?
No, it was an off-the-cuff comment. Sorry for adding noise. :(
I updated ptrace_cont-defeats-sigblock.c testcase to also check whether signal gets remembered, and whether it will be raised when signal mask is cleared.
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
Updating PM score.
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.
(In reply to comment #11)
> in kernel-2.6.18-133.el5
> You can download this test kernel from http://people.redhat.com/dzickus/el5
Not there yet?
sorry I suck today. the rpms are uploading right now. thanks for catching that.
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.