Re: segfault in ld.elf_so

RVP <[email protected]>
Newsgroups gmane.os.netbsd.current
Message-ID <[email protected]>
On Thu, 29 Jan 2026, Thomas Klausner wrote:

> Looking for relro PRs, I found
>
> https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57792
>
> Could this be related?
>

Different issue, I think. PR 57792 is a segfault when doing ifunc relocations.
This one seems to be happening when doing the standard PLT relocations.

> (gdb) br main
> Breakpoint 1 at 0x6164
> (gdb) r
> Starting program: .../work/webkitgtk-2.50.4/tmp-introspectyh2m43hy/WebKit2WebExtension-4.1
> 
> Program received signal SIGSEGV, Segmentation fault.
> _rtld_relocate_plt_object (obj=<optimized out>, rela=0x793ddd29b7d0, tp=<synthetic pointer>) at /usr/src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:354
> 354                     *where = new_value;
> (gdb) bt
> #0  _rtld_relocate_plt_object (obj=<optimized out>, rela=0x793ddd29b7d0, tp=<synthetic pointer>) at /usr/src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:354
> #1  _rtld_bind (obj=<optimized out>, reloff=<optimized out>) at /usr/src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:372
> #2  0x00007f7ff7cb105d in _rtld_bind_start () from /usr/libexec/ld.elf_so
> #3  0x0000000000000000 in ?? ()
>

Since the linker crashes way before main() is ever called, what you should do
is:

1. Uncomment the debug defines in the Makefile and set COPTS to `-Og'.

2. Run the program with the new ld.elf_so and collect the (copious) debug
    output.

3. Run `readelf -Wa' on the program and the library it is crashing on when
    doing the PLT reloc. (if, indeed, it's crashing fixing up a library rather
    than the executable).

Post all these outputs.

-RVP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.