Bug 426647 - ptrace: PTRACE_SINGLESTEP,signal steps on the 2nd instr.
Summary: ptrace: PTRACE_SINGLESTEP,signal steps on the 2nd instr.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.6
Hardware: s390x
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Jerome Marchand
QA Contact: Martin Jenner
URL: http://sources.redhat.com/cgi-bin/cvs...
Whiteboard:
Depends On:
Blocks: 338951
TreeView+ depends on / blocked
 
Reported: 2007-12-23 16:39 UTC by Jan Kratochvil
Modified: 2008-07-24 19:23 UTC (History)
2 users (show)

Fixed In Version: RHSA-2008-0665
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-24 19:23:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Restore single_step flag after signal (1.72 KB, text/x-patch)
2008-04-24 08:47 UTC, Jerome Marchand
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2008:0665 0 normal SHIPPED_LIVE Moderate: Updated kernel packages for Red Hat Enterprise Linux 4.7 2008-07-24 16:41:06 UTC

Description Jan Kratochvil 2007-12-23 16:39:33 UTC
Description of problem:
On RHEL-4 s390 and s390x ptrace(PTRACE_SINGLESTEP,SIGALRM) will report a SIGTRAP
from the _second_ instruction of the SIGALRM handler.  All the other platforms
stop the the _first_ signal handler instruction.

Version-Release number of selected component (if applicable):
kernel-2.6.9-67.EL.s390x

How reproducible:
Always.

Steps to Reproduce:
1. wget -q -O step-into-handler.c
'http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/step-into-handler.c?cvsroot=systemtap';for
bit in 31 64;do gcc -m$bit -D_GNU_SOURCE -o step-into-handler
step-into-handler.c -Wall -ggdb2;./step-into-handler;echo $?;done

Actual results:
1
1

Expected results:
0
0

Additional info:
s390x RHEL-5 (due to utrace?) is not affected by this bug.
Other platforms (non-s390/non-s390x) are also not affected by this bug.
Also it may not be much serious, in fact it fortunately discovered a GDB
regression otherwise not caught by any platform/test.
Not sure if it should be fixed at all, probably not worth it for RHEL-4.7/4.8.

Comment 1 Jan Kratochvil 2007-12-23 16:41:20 UTC
RHEL-5 kernel under the test was: kernel-2.6.18-58.el5.utrace2.s390x


Comment 2 Roland McGrath 2007-12-23 21:21:28 UTC
This was indeed fixed in RHEL5 as part of the utrace port for s390.
The upstream code for this is being cleaned up right now, it so happens.
This is probably the right fix for RHEL4:

--- linux-2.6.9/arch/s390/kernel/signal.c
+++ linux-2.6.9/arch/s390/kernel/signal.c
@@ -514,6 +514,8 @@ int do_signal(struct pt_regs *regs, sigs
 	        }
 #endif
 		handle_signal(signr, &ka, &info, oldset, regs);
+		if (current->thread.per_info.single_step)
+			set_thread_flag(TIF_SINGLE_STEP);
 		return 1;
 	}


Comment 3 Jerome Marchand 2008-04-24 08:47:38 UTC
Created attachment 303601 [details]
Restore single_step flag after signal

Resore current->thread.per_info.single_step before returning from do_signal()
and jump to sysc_singlestep after do_signal() returned in system_call().

Comment 4 Jerome Marchand 2008-04-24 08:53:07 UTC
With the patch above applied, the reproducer returns zero on both s390 and s390x
(31 et 64 bits).

Comment 8 Vivek Goyal 2008-05-29 20:50:40 UTC
Committed in 71.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 11 errata-xmlrpc 2008-07-24 19:23:51 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-2008-0665.html


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