gdb crashes on startup if run as root via sudo and ~/.gdbinit exists
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb (Debian) |
Fix Released
|
Unknown
|
|||
gdb (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
If a program is run like this:
$ sudo gdb ./a.out
and ~/.gdbinit exists (even as an empty file), gdb will crash...
$ cat crash_gdb.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main(int argc,
char *argv[])
{
printf ("hello\n");
exit (EXIT_SUCCESS);
}
$ gcc -g crash_gdb.c
$ ./a.out
hello
$ gdb ./a.out
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://
Reading symbols from /tmp/a.out...done.
(gdb) r
Starting program: /tmp/a.out
hello
[Inferior 1 (process 11779) exited normally]
(gdb) quit
$ sudo gdb ./a.out
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://
Reading symbols from /tmp/a.out...done.
(gdb) r
Starting program: /tmp/a.out
hello
[Inferior 1 (process 11839) exited normally]
(gdb) quit
$ ls ~/.gdbinit
ls: cannot access /home/james/
$ touch ~/.gdbinit
$ sudo gdb ./a.out
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://
warning: not using untrusted file "/home/
*** glibc detected *** gdb: double free or corruption (!prev): 0x092e1cb8 ***
======= Backtrace: =========
/lib/i386-
/lib/i386-
gdb[0x82b2475]
gdb[0x816f576]
gdb(do_
gdb[0x80f43e4]
gdb(source_
gdb(catch_
gdb[0x81d6fcb]
gdb(catch_
gdb(gdb_
gdb(main+
/lib/i386-
gdb[0x8087fd1]
======= Memory map: ========
/lib/i386-
/lib/i386-
gdb[0x82b2475]
gdb[0x816f576]
gdb(do_
gdb[0x80f43e4]
gdb(source_
gdb(catch_
gdb[0x81d6fcb]
gdb(catch_
gdb(gdb_
gdb(main+
/lib/i386-
gdb[0x8087fd1]
======= Memory map: ========
08048000-0852b000 r-xp 00000000 08:01 5769330 /usr/bin/gdb
0852b000-0852c000 r--p 004e2000 08:01 5769330 /usr/bin/gdb
0852c000-08536000 rw-p 004e3000 08:01 5769330 /usr/bin/gdb
08536000-08551000 rw-p 00000000 00:00 0
092dd000-09401000 rw-p 00000000 00:00 0 [heap]
b6e9e000-b6f64000 rw-p 00000000 00:00 0
b6f64000-b7164000 r--p 00000000 08:01 5767792 /usr/lib/
b7164000-b7166000 rw-p 00000000 00:00 0
b7166000-b7182000 r-xp 00000000 08:01 6032119 /lib/i386-
b7182000-b7183000 r--p 0001b000 08:01 6032119 /lib/i386-
b7183000-b7184000 rw-p 0001c000 08:01 6032119 /lib/i386-
b7184000-b7186000 r-xp 00000000 08:01 6029579 /lib/i386-
b7186000-b7187000 r--p 00001000 08:01 6029579 /lib/i386-
b7187000-b7188000 rw-p 00002000 08:01 6029579 /lib/i386-
b7188000-b732b000 r-xp 00000000 08:01 6029603 /lib/i386-
b732b000-b732c000 ---p 001a3000 08:01 6029603 /lib/i386-
b732c000-b732e000 r--p 001a3000 08:01 6029603 /lib/i386-
b732e000-b732f000 rw-p 001a5000 08:01 6029603 /lib/i386-
b732f000-b7332000 rw-p 00000000 00:00 0
b7332000-b7357000 r-xp 00000000 08:01 6031384 /lib/i386-
b7357000-b7359000 r--p 00025000 08:01 6031384 /lib/i386-
b7359000-b735a000 rw-p 00027000 08:01 6031384 /lib/i386-
b735a000-b75c2000 r-xp 00000000 08:01 5770182 /usr/lib/
b75c2000-b75c3000 ---p 00268000 08:01 5770182 /usr/lib/
b75c3000-b75c4000 r--p 00268000 08:01 5770182 /usr/lib/
b75c4000-b761a000 rw-p 00269000 08:01 5770182 /usr/lib/
b761a000-b7627000 rw-p 00000000 00:00 0
b7627000-b763e000 r-xp 00000000 08:01 6031346 /lib/i386-
b763e000-b763f000 r--p 00016000 08:01 6031346 /lib/i386-
b763f000-b7640000 rw-p 00017000 08:01 6031346 /lib/i386-
b7640000-b7642000 rw-p 00000000 00:00 0
b7642000-b766c000 r-xp 00000000 08:01 6031349 /lib/i386-
b766c000-b766d000 r--p 00029000 08:01 6031349 /lib/i386-
b766d000-b766e000 rw-p 0002a000 08:01 6031349 /lib/i386-
b766e000-b7685000 r-xp 00000000 08:01 6029334 /lib/i386-
b7685000-b7686000 r--p 00016000 08:01 6029334 /lib/i386-
b7686000-b7687000 rw-p 00017000 08:01 6029334 /lib/i386-
b7687000-b76a3000 r-xp 00000000 08:01 6031372 /lib/i386-
b76a3000-b76a5000 r--p 0001b000 08:01 6031372 /lib/i386-
b76a5000-b76a6000 rw-p 0001d000 08:01 6031372 /lib/i386-
b76a6000-b76c6000 r-xp 00000000 08:01 6031376 /lib/i386-
b76c6000-b76c7000 r--p 0001f000 08:01 6031376 /lib/i386-
b76c7000-b76c8000 rw-p 00020000 08:01 6031376 /lib/i386-
b76c8000-b76c9000 rw-p 00000000 00:00 0
b76c9000-b76cc000 r-xp 00000000 08:01 6031354 /lib/i386-
b76cc000-b76cd000 r--p 00002000 08:01 6031354 /lib/i386-
b76cd000-b76ce000 rw-p 00003000 08:01 6031354 /lib/i386-
b76ce000-b7703000 r-xp 00000000 08:01 6089775 /lib/i386-
b7703000-b7704000 r--p 00035000 08:01 6089775 /lib/i386-
b7704000-b7707000 rw-p 00036000 08:01 6089775 /lib/i386-
b7707000-b7708000 rw-p 00000000 00:00 0
b7728000-b772f000 r--s 00000000 08:01 5910153 /usr/lib/
b772f000-b7730000 r--p 002bd000 08:01 5767792 /usr/lib/
b7730000-b7732000 rw-p 00000000 00:00 0
b7732000-b7752000 r-xp 00000000 08:01 6031350 /lib/i386-
b7752000-b7753000 r--p 0001f000 08:01 6031350 /lib/i386-
b7753000-b7754000 rw-p 00020000 08:01 6031350 /lib/i386-
bfdeb000-bfe0c000 rw-p 00000000 00:00 0 [stack]
$ rm ~/.gdbinit
$ sudo gdb ./a.out
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://
Reading symbols from /tmp/a.out...done.
(gdb) r
Starting program: /tmp/a.out
hello
[Inferior 1 (process 12057) exited normally]
(gdb) quit
$
Related branches
tags: | added: quantal |
Changed in gdb (Ubuntu): | |
importance: | Undecided → Medium |
Changed in gdb (Debian): | |
status: | Unknown → New |
Changed in gdb (Ubuntu): | |
status: | Triaged → Fix Committed |
Changed in gdb (Debian): | |
status: | New → Fix Released |
Status changed to 'Confirmed' because the bug affects multiple users.