tech-toolchain archive

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

Re: ld.elf_so core dump: NULL ehdr in _rtld_init



On Sat, Jul 27, 2024 at 08:45:37AM +0200, Martin Husemann wrote:
> On Sat, Jul 27, 2024 at 07:19:58AM +0200, Thomas Klausner wrote:
> > Hi!
> > 
> > I've filed a bug report because backtrace-rs (the backtrace support in
> > rust) has a self test that dumps core.
> 
> Can you objdump the headers of the binary (not sure if objdump -ph is enough,
> but it should be a start)?

Sure:

target/debug/deps/current_exe_mismatch-e7ad37dd6f4cbaa7:     file format elf64-x86-64

Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000000000040 paddr 0x0000000000000040 align 2**3
         filesz 0x00000000000002a0 memsz 0x00000000000002a0 flags r--
  INTERP off    0x00000000000002e0 vaddr 0x00000000000002e0 paddr 0x00000000000002e0 align 2**0
         filesz 0x0000000000000017 memsz 0x0000000000000017 flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
         filesz 0x000000000001a268 memsz 0x000000000001a268 flags r--
    LOAD off    0x000000000001b000 vaddr 0x000000000001b000 paddr 0x000000000001b000 align 2**12
         filesz 0x000000000012edce memsz 0x000000000012edce flags r-x
    LOAD off    0x000000000014a000 vaddr 0x000000000014a000 paddr 0x000000000014a000 align 2**12
         filesz 0x000000000003e5f4 memsz 0x000000000003e5f4 flags r--
    LOAD off    0x0000000000188e10 vaddr 0x0000000000189e10 paddr 0x0000000000189e10 align 2**12
         filesz 0x00000000000102c9 memsz 0x0000000000010438 flags rw-
 DYNAMIC off    0x0000000000195240 vaddr 0x0000000000196240 paddr 0x0000000000196240 align 2**3
         filesz 0x00000000000001e0 memsz 0x00000000000001e0 flags rw-
    NOTE off    0x00000000000002f8 vaddr 0x00000000000002f8 paddr 0x00000000000002f8 align 2**2
         filesz 0x000000000000002c memsz 0x000000000000002c flags r--
     TLS off    0x0000000000188e10 vaddr 0x0000000000189e10 paddr 0x0000000000189e10 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000050 flags r--
EH_FRAME off    0x000000000015906c vaddr 0x000000000015906c paddr 0x000000000015906c align 2**2
         filesz 0x0000000000008e9c memsz 0x0000000000008e9c flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000188e10 vaddr 0x0000000000189e10 paddr 0x0000000000189e10 align 2**0
         filesz 0x00000000000101f0 memsz 0x00000000000101f0 flags r--

Dynamic Section:
  NEEDED               libc.so.12
  NEEDED               libpthread.so.1
  NEEDED               libgcc_s.so.1
  RPATH                /usr/pkg/lib/libatomic
  INIT                 0x000000000001b000
  FINI                 0x0000000000149dc0
  HASH                 0x0000000000000328
  STRTAB               0x0000000000000ed8
  SYMTAB               0x00000000000005c0
  STRSZ                0x0000000000000524
  SYMENT               0x0000000000000018
  DEBUG                0x0000000000000000
  PLTGOT               0x0000000000196420
  PLTRELSZ             0x0000000000000078
  PLTREL               0x0000000000000007
  JMPREL               0x000000000001a1f0
  RELA                 0x0000000000001500
  RELASZ               0x0000000000018cf0
  RELAENT              0x0000000000000018
  BIND_NOW             0x0000000000000000
  FLAGS_1              0x0000000008000001
  VERNEED              0x00000000000014c0
  VERNEEDNUM           0x0000000000000001
  VERSYM               0x00000000000013fc
  RELACOUNT            0x0000000000001035

Version References:
  required from libgcc_s.so.1:
    0x09276060 0x00 04 GCC_4.2.0
    0x0b792650 0x00 03 GCC_3.0
    0x0b792653 0x00 02 GCC_3.3

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       00000017  00000000000002e0  00000000000002e0  000002e0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.netbsd.ident 00000018  00000000000002f8  00000000000002f8  000002f8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.netbsd.pax 00000014  0000000000000310  0000000000000310  00000310  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .hash         00000298  0000000000000328  0000000000000328  00000328  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000918  00000000000005c0  00000000000005c0  000005c0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       00000524  0000000000000ed8  0000000000000ed8  00000ed8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  000000c2  00000000000013fc  00000000000013fc  000013fc  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 00000040  00000000000014c0  00000000000014c0  000014c0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     00018cf0  0000000000001500  0000000000001500  00001500  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt     00000078  000000000001a1f0  000000000001a1f0  0001a1f0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init         0000000e  000000000001b000  000000000001b000  0001b000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt          00000060  000000000001b010  000000000001b010  0001b010  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .plt.got      00000038  000000000001b070  000000000001b070  0001b070  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .text         0012ed0b  000000000001b0b0  000000000001b0b0  0001b0b0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .fini         0000000e  0000000000149dc0  0000000000149dc0  00149dc0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 15 .rodata       0000f049  000000000014a000  000000000014a000  0014a000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .debug_gdb_scripts 00000022  0000000000159049  0000000000159049  00159049  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .eh_frame_hdr 00008e9c  000000000015906c  000000000015906c  0015906c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 18 .eh_frame     0001ff4c  0000000000161f08  0000000000161f08  00161f08  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 19 .gcc_except_table 000067a0  0000000000181e54  0000000000181e54  00181e54  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 20 .tbss         00000050  0000000000189e10  0000000000189e10  00188e10  2**3
                  ALLOC, THREAD_LOCAL
 21 .ctors        00000010  0000000000189e10  0000000000189e10  00188e10  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 22 .dtors        00000010  0000000000189e20  0000000000189e20  00188e20  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .jcr          00000008  0000000000189e30  0000000000189e30  00188e30  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 24 .data.rel.ro  0000c408  0000000000189e38  0000000000189e38  00188e38  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 25 .dynamic      000001e0  0000000000196240  0000000000196240  00195240  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 26 .got          00003be0  0000000000196420  0000000000196420  00195420  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 27 .data         000000d9  000000000019a000  000000000019a000  00199000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 28 .bss          00000148  000000000019a100  000000000019a100  001990d9  2**6
                  ALLOC
 29 .comment      0000006c  0000000000000000  0000000000000000  001990d9  2**0
                  CONTENTS, READONLY
 30 .ident        00000155  0000000000000000  0000000000000000  00199145  2**0
                  CONTENTS, READONLY
 31 .SUNW_ctf     00000047  0000000000000000  0000000000000000  0019929c  2**2
                  CONTENTS, READONLY
 32 .debug_aranges 00015f30  0000000000000000  0000000000000000  001992e3  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 33 .debug_info   00297985  0000000000000000  0000000000000000  001af213  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 34 .debug_abbrev 0001a5f4  0000000000000000  0000000000000000  00446b98  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 35 .debug_line   000921ac  0000000000000000  0000000000000000  0046118c  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 36 .debug_str    001b7976  0000000000000000  0000000000000000  004f3338  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 37 .debug_loc    0000b47f  0000000000000000  0000000000000000  006aacae  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 38 .debug_ranges 00068180  0000000000000000  0000000000000000  006b612d  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS


> Or provide the binary?

http://www.netbsd.org/~wiz/current_exe_mismatch.tar.gz

If you have rust installed, you can probably reproduce this by running

   git clone git%github.com@localhost:rust-lang/backtrace-rs.git
   cd backtrace-rs
   cargo test

Cheers,
 Thomas


Home | Main Index | Thread Index | Old Index