Comment 8 for bug 196274

Revision history for this message
Kees Cook (kees) wrote :

I can confirm that gdb now doesn't crash and still operates as expected in normal situations.

Before:

$ sleep 120 &
[1] 26974
$ gdb -p 26974
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Attaching to process 26974
Reading symbols from /bin/sleep...(no debugging symbols found)...done.
Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libc.so.6...
(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x7fbac8f106e0 (LWP 26974)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/ld-linux-x86-64.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
(no debugging symbols found)
0x00007fbac882cb50 in nanosleep () from /lib/libc.so.6
(gdb) bt
#0 0x00007fbac882cb50 in nanosleep () from /lib/libc.so.6
#1 0x0000000000402c3b in ?? ()
#2 0x0000000000402780 in ?? ()
#3 0x00000000004014ee in ?? ()
#4 0x00007fbac87ad1c4 in __libc_start_main () from /lib/libc.so.6
#5 0x00000000004011b9 in ?? ()
#6 0x00007fffd0f16078 in ?? ()
#7 0x0000000000000000 in ?? ()
(gdb) quit
The program is running. Quit anyway (and detach it)? (y or n) y
Detaching from program: /bin/sleep, process 26974

$ gdb $(which gdb)
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(no debugging symbols found)
(gdb) start
Breakpoint 1 at 0x445d50
Starting program: /usr/bin/gdb
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0x7f08a57516e0 (LWP 26956)]
[Switching to Thread 0x7f08a57516e0 (LWP 26956)]
0x0000000000445d50 in main ()
(gdb) flushregs
Register cache flushed.
(gdb) print $pc
Segmentation fault (core dumped)

After:

$ sleep 120 &
[1] 27360
$ gdb -p 27360
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Attaching to process 27360
Reading symbols from /bin/sleep...(no debugging symbols found)...done.
Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libc.so.6...
(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x7f436b4296e0 (LWP 27360)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/ld-linux-x86-64.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
(no debugging symbols found)
0x00007f436ad45b50 in nanosleep () from /lib/libc.so.6
(gdb) bt
#0 0x00007f436ad45b50 in nanosleep () from /lib/libc.so.6
#1 0x0000000000402c3b in ?? ()
#2 0x0000000000402780 in ?? ()
#3 0x00000000004014ee in ?? ()
#4 0x00007f436acc61c4 in __libc_start_main () from /lib/libc.so.6
#5 0x00000000004011b9 in ?? ()
#6 0x00007fff73430c98 in ?? ()
#7 0x0000000000000000 in ?? ()
(gdb) quit
The program is running. Quit anyway (and detach it)? (y or n) y
Detaching from program: /bin/sleep, process 27360

$ gdb $(which gdb)
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(no debugging symbols found)
(gdb) start
Breakpoint 1 at 0x445d50
Starting program: /usr/bin/gdb
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0x7fe91b8926e0 (LWP 27476)]
[Switching to Thread 0x7fe91b8926e0 (LWP 27476)]
0x0000000000445d50 in main ()
(gdb) flushregs
Register cache flushed.
(gdb) print $pc
$1 = (void (*)()) 0x445d50 <main>
(gdb) quit
The program is running. Exit anyway? (y or n) y