Bug 451849 - ptrace(PTRACE_CONT, sig) kills app even if sig is blocked
ptrace(PTRACE_CONT, sig) kills app even if sig is blocked
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.1
i686 Linux
low Severity medium
: rc
: ---
Assigned To: Jerome Marchand
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-17 15:29 EDT by Tom Fleck
Modified: 2009-09-02 04:58 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 04:58:46 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)
test case: 2 1-file C programs (4.07 KB, text/plain)
2008-06-17 15:29 EDT, Tom Fleck
no flags Details
proposed patch (535 bytes, patch)
2009-01-09 10:59 EST, Jerome Marchand
no flags Details | Diff

  None (edit)
Description Tom Fleck 2008-06-17 15:29:57 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
anywhere:
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);
will not.

Is this a bug or a feature, and when was it introduced?
The attached pair of test programs below demonstrate this.

Thanks!

...Tom
Comment 1 Tom Fleck 2008-06-17 15:29:57 EDT
Created attachment 309666 [details]
test case: 2 1-file C programs
Comment 2 Jerome Marchand 2009-01-09 10:59:10 EST
Created attachment 328559 [details]
proposed patch

When the signal to deliver is blocked, use a traditional signal in ptrace_induce_signal() instead of forcefully inject it with utrace_inject_signal().
Comment 4 Jerome Marchand 2009-01-21 09:03:07 EST
I forgot to signal the patch was posted on rhkl:
http://post-office.corp.redhat.com/archives/rhkernel-list/2009-January/msg00459.html
Comment 5 Denys Vlasenko 2009-02-05 09:25:14 EST
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?
Comment 6 Jerome Marchand 2009-02-05 09:45:43 EST
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?
Comment 7 Denys Vlasenko 2009-02-06 11:20:17 EST
No, it was an off-the-cuff comment. Sorry for adding noise. :(
Comment 8 Denys Vlasenko 2009-02-06 11:43:38 EST
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.
Comment 9 RHEL Product and Program Management 2009-02-11 05:09:58 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 10 RHEL Product and Program Management 2009-02-16 10:45:49 EST
Updating PM score.
Comment 11 Don Zickus 2009-03-04 14:59:27 EST
in kernel-2.6.18-133.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 13 Tom Fleck 2009-03-04 16:17:08 EST
(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?
Comment 14 Don Zickus 2009-03-04 17:21:00 EST
sorry I suck today.  the rpms are uploading right now.  thanks for catching that.

-Don
Comment 16 errata-xmlrpc 2009-09-02 04:58:46 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

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