Bug 192193

Summary: statistics broken when switching personalities
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: cagney, ldv, swagiaal, tao
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0302 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-08 00:25:13 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:
Bug Depends On:    
Bug Blocks: 176344, 200893    
Attachments:
Description Flags
strace-alt-call_summary.diff none

Description Bastien Nocera 2006-05-18 09:47:36 UTC
strace-4.5.14-0.EL4.x86_64.rpm

$ cat helloWorld.c
#include <stdio.h>

int main ( void )
{
    printf( "Hello World\n" );
    return 0;
}
$ gcc -g -m32 -o helloWorld helloWorld.c
$ strace -c ./helloWorld
[ Process PID=18962 runs in 32 bit mode. ]
Hello World
Process 18962 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
  3.96 1275605287168.1374389535023 4196074544597155       304           sendto
  4.51 1451698946383.1460288880979 4257185943319299       341       342 recv
  4.19 1348619729142.1425929142603 4049913378592020       333       334 send
Segmentation fault

The bt under ElectricFence:
2752                    if (counts == NULL || counts[i].calls == 0)
(gdb) bt
#0  0x0000000000405a41 in call_summary (outf=0x3d8e72e680) at syscall.c:2752
#1  0x0000000000403362 in main (argc=18945, argv=0x0) at strace.c:676
#2  0x0000003d8e51c4bb in __libc_start_main (main=0x402c00 <main>, argc=3,
   ubp_av=0x7fbffff6f8, init=0x413500 <__libc_csu_init>, fini=Variable "fini" is
not available.
)
   at ../sysdeps/generic/libc-start.c:209
(gdb) p i
$3 = 254

A good explanation of the problem from Bryan Mason:
"
Not only do x86_64 and i386 personalities have different numbers of syscalls
(i386 has 343 and x86_64 has 254), but the syscalls have different numbers.  For
example execve is syscall number 11 in i386 but it's syscall number 59 on x86_64.
"

The crash occurs when trying to access syscalls > 254.

The work-around is obviously to use the 32-bit strace in the meanwhile.

Comment 2 RHEL Program Management 2006-08-18 15:50:56 UTC
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 4 Dmitry V. Levin 2006-12-14 00:25:31 UTC
Created attachment 143584 [details]
strace-alt-call_summary.diff

Proposed fix, please test.

Comment 5 Dmitry V. Levin 2006-12-21 11:46:09 UTC
Fixed upstream.

Comment 6 Roland McGrath 2007-01-11 11:16:17 UTC
these bugs are fixed upstream in the coming 4.5.15 release

Comment 7 Roland McGrath 2007-01-30 07:46:21 UTC
This bug should be fixed in strace-4.5.15-1.el4 rpms.

Comment 12 Red Hat Bugzilla 2007-05-08 00:25:13 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 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/RHBA-2007-0302.html