Public bug reported:

On ubuntu 10.04.3 core dumps are useless because relro is enabled by
default.

How to reproduce:

lib.c: 
#include <unistd.h> 

void 
lib (void) 
{ 
sleep(1000); 
} 

main.c: 
extern void lib (void); 

int 
main (void) 
{ 
lib (); 
return 0; 
} 

build stuff: 
gcc -ggdb3 -fPIC -shared lib.c -o libtest.so 
gcc main.c -ggdb3 -L`pwd` -ltest -o go 
export LD_LIBRARY_PATH=`pwd` 
./go & 
gcore <pid> 

load the core in gdb, and do a back trace, you get this: 
(gdb) bt 
#0 0x00007ffff7902380 in ?? () 
#1 0x00007ffff7902210 in ?? () 
#2 0x0000000000000000 in ?? () 


If you disable relro, you avoid hitting the bug (but this isn't a fix, keep 
reading) : 
gcc main.c -ggdb3 -L`pwd` -ltest -Wl,-z,norelro -o go 
./go & 
gcore <pid> 

load core dump, take a backtrace: 
(gdb) bt 
#0 0x00007ffff7902380 in nanosleep () from /lib/libc.so.6 
#1 0x00007ffff7902210 in sleep () from /lib/libc.so.6 
#2 0x00007ffff7bdb5fa in lib () at lib.c:6 
#3 0x00000000004005fd in main () at main.c:6 

The solution is either to: disable relro system wide (not recommended,
but would fix it) or merge some patches (preferred but technical risk of
introducing other bugs or breaking something).

The full patch for gdb (and thus gore) and be found here:
http://sourceware.org/ml/gdb-patches/2010-08/msg00499.html

** Affects: gdb (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/850077

Title:
  10.04.3 core dumps are useless because relro is enabled by default

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/850077/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to