tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ld.elf_so core dump: NULL ehdr in _rtld_init



Hi!

I've filed a bug report because backtrace-rs (the backtrace support in
rust) has a self test that dumps core.

https://github.com/rust-lang/backtrace-rs/issues/644

When asked for details, I noticed that it's actually a core dump in
ld.elf_so.

Core was generated by `ld.elf_so'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000076c903 in _rtld_init (execname=0x7f7fffeffae0 "/usr/libexec/ld.elf_so", relocbase=<optimized out>, mapbase=0x0) at /usr/src/libexec/ld.elf_so/rtld.c:412
412             _rtld_objself.phdr = (Elf_Phdr *)((char *)mapbase + ehdr->e_phoff);
(gdb) bt
#0  0x000000000076c903 in _rtld_init (execname=0x7f7fffeffae0 "/usr/libexec/ld.elf_so", relocbase=<optimized out>, mapbase=0x0) at /usr/src/libexec/ld.elf_so/rtld.c:412
#1  _rtld (sp=<optimized out>, relocbase=<optimized out>) at /usr/src/libexec/ld.elf_so/rtld.c:574
#2  0x0000000000766033 in rtld_start ()
(gdb) p mapbase
$1 = (__caddr_t) 0x0
(gdb) p ehdr
$2 = (const Elf64_Ehdr *) 0x0

So the ehdr object passed to _rtld_init is NULL, which is probably
just wrong. However, shouldn't this be caught and not cause a core
dump?
 Thomas


Home | Main Index | Thread Index | Old Index