Bug 130254

Summary: glibc's traceback() fails when called from an exception handler
Product: Red Hat Enterprise Linux 3 Reporter: Ed Connell <ed.connell>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-20 13:14:19 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
C program that fails on ia64 none

Description Ed Connell 2004-08-18 11:22:59 EDT
Description of problem:
On ia64, traceback() works fine generally but causes recursive SEGV's 
when called from an exception handler.  On x86 both cases work fine.  
The bug can be observed with a small testcase or with a trivial 
testcase and the /usr/bin/catchsegv script.  I will attach the small 
testcase but include the trivial testcase inline here.

[edconn@order ~/traceppen]$ cat segv.c
int main()
{
  int *ip = (int *)0;
  *ip = 0;

  return 0;
}

[edconn@order ~/traceppen]$ gcc -o segv segv.c -rdynamic -g -funwind-
tables

[edconn@order ~/traceppen]$ catchsegv ./segv
*** Segmentation fault

Backtrace:
*** Segmentation fault
 .
 .
 .


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

How reproducible:
Every time.

Steps to Reproduce:
1. gcc -o toy toy.c -rdynamic -g -funwind-tables
2. ./toy
  
Actual results:
[edconn@order ~/traceppen]$ ./toy 
Caught SEGV. Code is 2.
Caught SEGV. Code is 1.
Caught SEGV. Code is 1.
Caught SEGV. Code is 1.
Caught SEGV. Code is 1.
Caught SEGV. Code is 1.
./toy(print_trace+0x40) [0x4000000000000f20]
./toy(segv_hand+0xa0) [0x4000000000000ec0]
[0xa0000000000040c0]
/lib/libgcc_s.so.1 [0x20000000002fda41]
/lib/libgcc_s.so.1 [0x20000000002fdf20]
/lib/libgcc_s.so.1(_Unwind_Backtrace+0x300) [0x20000000002ffc30]
/lib/tls/libc.so.6.1(backtrace+0x110) [0x200000000023f700]
./toy(print_trace+0x40) [0x4000000000000f20]
./toy(segv_hand+0xa0) [0x4000000000000ec0]
[0xa0000000000040c0]
/lib/libgcc_s.so.1 [0x20000000002fda41]
/lib/libgcc_s.so.1 [0x20000000002fdf20]
 .
 .
 .


Expected results:
edconn@chaos% ./toy 
Caught SEGV. Code is 1.
./toy(print_trace+0x1a) [0x80486e2]
./toy(segv_hand+0x21) [0x80486bd]
./toy [0x42028c40]
./toy(__libc_start_main+0xa4) [0x420158d4]
./toy(backtrace_symbols+0x31) [0x804860d]


Additional info:
Comment 1 Ed Connell 2004-08-18 11:24:18 EDT
Created attachment 102843 [details]
C program that fails on ia64
Comment 2 Jakub Jelinek 2004-10-08 07:41:29 EDT
gcc -g -o toy toy.c -Wl,--export-dynamic; ./toy; echo $?; rpm -q gcc glibc libgcc
Caught SEGV. Code is 2.
./toy(print_trace+0x40) [0x4000000000000f00]
./toy(segv_hand+0xa0) [0x4000000000000ea0]
[0xa0000000000040c0]
./toy(main+0xc1) [0x4000000000001151]
/lib/tls/libc.so.6.1(__libc_start_main+0x440) [0x200000000007e990]
./toy(_start+0x80) [0x4000000000000c80]

0
gcc-3.2.3-43
glibc-2.3.2-95.28
libgcc-3.2.3-43

catchsegv is still broken on IA-64, it doesn't use backtrace() internally
(but it should).
Comment 3 Jakub Jelinek 2004-10-15 01:19:10 EDT
catchseg should be fixed in rawhide glibc, eventually will be backported
to RHEL3 glibc too.
Comment 4 Jakub Jelinek 2004-10-22 13:43:02 EDT
catchsegv fixed in glibc-2.3.2-95.30.
Comment 5 John Flanagan 2004-12-20 13:14:19 EST
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-586.html