backtrace/1958: bad trace on x86_64, (32bit mode), linux 2.6 and shared libs

wwc@lns.mit.edu wwc@lns.mit.edu
Mon Jun 13 13:18:00 GMT 2005


>Number:         1958
>Category:       backtrace
>Synopsis:       bad trace on x86_64, (32bit mode), linux 2.6 and shared libs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 13 13:18:01 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     wwc@lns.mit.edu
>Release:        unknown-1.0
>Organization:
>Environment:
linux 2.6.x ( tested on 8<=x<=11 )
gcc 2.95...3.4.4
>Description:
The following test code generates faulty stacks with
gdb 6.3, 6.2.1 on linux 2.6 kernels (linux 2.4 is fine!)
and if compiled dynamically in 32bit mode (-static is fine).
Compiler version seems irrelevant (tested under 2.95 through
3.4).  

---------------
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
  alarm(1);
  sleep(5);
  return 0;
}
----------------

With a dynamic binary I get:

/usr/bin/gcc -m32 -v -g tt.c
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.4/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.4 (pre 3.3.5 20040809)
 /usr/lib/gcc-lib/i586-suse-linux/3.3.4/cc1 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=4 tt.c -quiet -dumpbase tt.c -m32 -auxbase tt -g -version -o /tmp/ccHUPdHX.s
GNU C version 3.3.4 (pre 3.3.5 20040809) (i586-suse-linux)
        compiled by GNU C version 3.3.4 (pre 3.3.5 20040809).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i586-suse-linux/3.3.4/include
 /usr/i586-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/bin/as -V -Qy -o /tmp/ccMUkAyN.o /tmp/ccHUPdHX.s
GNU assembler version 2.15.91.0.2 (i586-suse-linux) using BFD version 2.15.91.0.2 20040727 (SuSE Linux)
 /usr/lib/gcc-lib/i586-suse-linux/3.3.4/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../crt1.o /usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../crti.o /usr/lib/gcc-lib/i586-suse-linux/3.3.4/crtbegin.o -L/usr/lib/gcc-lib/i586-suse-linux/3.3.4 -L/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/lib -L/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../.. /tmp/ccMUkAyN.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc-lib/i586-suse-linux/3.3.4/crtend.o /usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../crtn.o

$  /usr/bin/gdb ./a.out 
GNU gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-suse-linux"...Using host libthread_db library "/lib64/tls/libthread_db.so.1".

(gdb) handle SIGALRM stop print
Signal        Stop      Print   Pass to program Description
SIGALRM       Yes       Yes     Yes             Alarm clock
(gdb) run
Starting program: /home/wwc/src/a.out 

Program received signal SIGALRM, Alarm clock.
0xffffe405 in ?? ()
(gdb) where
#0  0xffffe405 in ?? ()
#1  0xffffd218 in ?? ()
#2  0x55614b30 in __nanosleep_nocancel () from /lib/tls/libc.so.6
#3  0x55614933 in sleep () from /lib/tls/libc.so.6
#4  0x0005faa8 in ?? ()
#5  0x00000000 in ?? ()
#6  0x00000000 in ?? ()
#7  0x00000000 in ?? ()
#8  0x5556ca10 in ?? ()
#9  0x00000000 in ?? ()
#10 0x5556c020 in ?? () from /lib/ld-linux.so.2
#11 0x00000000 in ?? ()
#12 0x00000000 in ?? ()
#13 0x080495f8 in _DYNAMIC ()
#14 0x5556c3a0 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x00000000 in ?? ()
#18 0x00000000 in ?? ()
#19 0x00000000 in ?? ()
#20 0x00000000 in ?? ()
#21 0x556a4460 in ?? ()
#22 0x753f04bf in ?? ()
#23 0x0002eab6 in ?? ()
#24 0x01000000 in ?? ()
#25 0x00000000 in ?? ()
#26 0x00000000 in ?? ()
#27 0x00000000 in ?? ()
#28 0x00000000 in ?? ()
#29 0x00000000 in ?? ()
#30 0x00000000 in ?? ()
#31 0x00000001 in ?? ()
#32 0x00000000 in ?? ()
#33 0x00000000 in ?? ()
#34 0x00000000 in ?? ()
#35 0x00000000 in ?? ()
#36 0x00000000 in ?? ()
#37 0x00000000 in ?? ()
#38 0x00000000 in ?? ()
#39 0xab095750 in ?? ()
#40 0x00000000 in ?? ()
#41 0x00000000 in ?? ()
#42 0x00000000 in ?? ()
#43 0xffffd17c in ?? ()
#44 0x5556c4f0 in ?? ()
#45 0x00000001 in ?? ()
#46 0x5556cf60 in ?? ()
#47 0x00000001 in ?? ()
#48 0x00000000 in ?? ()
#49 0x00000001 in ?? ()
#50 0x555626ae in _dl_name_match_p () from /lib/ld-linux.so.2
Previous frame inner to this frame (corrupt stack?)
(gdb) 

Is this a gdb or a kernel problem?
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list