Bug 113072

Summary: [PATCH] RHEL3/ia64: strace -f on multithreaded 32 bit applications doesn't work
Product: Red Hat Enterprise Linux 3 Reporter: Arun Sharma <arun-public>
Component: kernelAssignee: Jason Baron <jbaron>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: knoel, petrides, riel, rperkins, tao
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard: ia32el fujitsu nec
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-05-12 01:08:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
el3-strace.patch
none
thread test
none
strace -f output
none
strace output none

Description Arun Sharma 2004-01-07 23:55:55 UTC
Description of problem:

strace -f on multithreaded 32 bit applications doesn't work i.e. only
the first thread is straceable.

Version-Release number of selected component (if applicable):

2.4.21-4.EL

How reproducible:

strace -f one of the NPTL test programs

Comment 1 Arun Sharma 2004-01-07 23:59:26 UTC
Created attachment 96822 [details]
el3-strace.patch


The problem happens because the ia64 kernel loads system call arguments from
the memory on to the register stack. strace, when used with the -f flag
modifies some of the system call arguments in memory. Because we're not
reloading the system call arguments from memory, those changes are lost.

The attached patch reloads the system call arguments from the register stack.
The patch is also accepted in 2.6.

Comment 2 Larry Troan 2004-01-12 14:22:43 UTC
Arun, is there an Issue Tracker associated with this bug?

Comment 3 Larry Troan 2004-01-19 14:15:54 UTC
Issue Tracker 31437 opened as sev 3

Comment 11 Jason Baron 2004-02-19 16:53:57 UTC
Arun, what NPTL test programs are you referring to?

Comment 12 Arun Sharma 2004-02-19 19:05:00 UTC
Any IA-32 NPTL program. Such as glibc/nptl/tst-basic1.c. 
However, to run ia32 NPTL programs on ia64, you'll need the patch 
attached to Bug #107059.

It might be simpler to reproduce the problem with a non-NPTL 
multithreaded program such as glibc/linuxthreads/Examples/ex1.c

The fix is not specific to NPTL.

Comment 13 Roland McGrath 2004-02-20 23:02:20 UTC
Upstream strace just got a patch from David Mosberger that should fix
this.  If the reporter can build strace from the cvs sources on
strace.sourceforge.net, testing that would be helpful.  I'm not sure
off hand where things are set up for IA32 emulation on an RHEL3/IA64
machine in house for me to test.

Comment 14 Arun Sharma 2004-02-20 23:47:44 UTC
Are you talking about:

2003-12-31  David Mosberger  <davidm.com>

	* process.c (struct_user_offsets) [IA64]: Fix up register 
name list.

I can't compile this on RHEL3/ia64.

But any user level change can't possibly fix this problem because the 
kernel is failing to modify system call arguments as requested by 
strace.


Comment 15 Jason Baron 2004-02-25 22:27:32 UTC
Created attachment 98052 [details]
thread test

thread teset case

Comment 16 Jason Baron 2004-02-25 22:28:21 UTC
Created attachment 98053 [details]
strace -f output

Comment 17 Jason Baron 2004-02-25 22:29:43 UTC
The 'strace -f' still seems to fail for me with this patch, as shown
in the output in comment 16 with the test case from comment 15. Not
sure what's going on, but i did notice that this patch is different
from the current 2.4 version

Comment 18 Arun Sharma 2004-02-25 23:14:51 UTC
The patch is different from 2.4 and 2.6, because of the differences 
in the ptregs layout. The base kernels have the kernel entry/exit 
optimization patch.

Comment 19 Jason Baron 2004-02-26 00:10:12 UTC
ok, but you get a correct trace with the program from comment #15?

Comment 20 Arun Sharma 2004-02-26 02:38:35 UTC
Created attachment 98059 [details]
strace output


Can't reproduce. Here's how I tested:

- 2.4.21-9.EL
- NPTL patch
- ia32-syscalls-el3.patch (bug #107744)
- sigwait.patch
- missing-paren.patch
- el3-strace.patch

And everything seems to work fine.

Comment 21 Arun Sharma 2004-02-26 02:40:03 UTC
Jason, it looks like you're using the 64 bit strace. Can you try the
32 bit strace ?

Comment 22 Jason Baron 2004-02-26 04:09:53 UTC
yes that was the problem. thanks.

Comment 24 Tim Burke 2004-03-01 13:06:30 UTC
Setting state to modified as Ernie included into U2 on 2/29.


Comment 25 John Flanagan 2004-05-12 01:08:14 UTC
An errata 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 the 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-2004-188.html