Project

General

Profile

Bug #9833

elfedit dumps core on incorrect file

Added by Alexander Pyhalov about 1 year ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2018-09-12
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

$ wget 'https://github.com/joyent/illumos-kvm-cmd/blob/master/share/qemu/openbios-ppc?raw=true'
$ /usr/bin/elfedit -re dyn:runpath openbios-ppc\?raw\=true 
Segmentation Fault (core dumped)

$ mdb core
Loading modules: [ libc.so.1 ld.so.1 ]
> ::status
debugging core file of elfedit (64-bit) from buildzone.oi-build.r61.net
file: /usr/bin/amd64/elfedit
initial argv: /usr/bin/elfedit -re dyn:runpath openbios-ppc?raw=true
threading model: native threads
status: process terminated by SIGSEGV (Segmentation Fault), addr=0
> $C
fffffd7fffdff9c0 libc.so.1`strncpy+0x18b3()
fffffd7fffdff9f0 init_obj_state+0x11d()
fffffd7fffdffa70 main+0x1d5()
fffffd7fffdffaa0 _start_crt+0x83()
fffffd7fffdffab0 _start+0x18()

The issue was triggered by oi-userland tool which tries automatically remove rpath from binary files.

History

#1

Updated by Michal Nowak 12 months ago

I see the same thing during golang 1.10 publish phase:

file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj zero size or zero entry ELF section - ELF capabilities ignored
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj: can't read ELF header
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj zero size or zero entry ELF section - ELF capabilities ignored
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj: can't read ELF header
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj zero size or zero entry ELF section - ELF capabilities ignored
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj: can't read ELF header
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc540-mips.obj zero size or zero entry ELF section - ELF capabilities ignored
file: .../prototype/i386/usr/lib/golang/1.10/src/debug/elf/testdata/go-relocation-test-gcc540-mips.obj: can't read ELF header
$ mdb core
Loading modules: [ libc.so.1 ld.so.1 ]
> ::status
debugging core file of elfedit (64-bit) from build-userland
file: /usr/bin/amd64/elfedit
initial argv: /usr/bin/elfedit -re dyn:runpath /export/home/newman/ws/oi-userland/components/
threading model: native threads
status: process terminated by SIGSEGV (Segmentation Fault), addr=0
> $C
fffffd7fffdff760 libc.so.1`strncpy+0x71()
fffffd7fffdff790 init_obj_state+0x105()
fffffd7fffdff810 main+0x1d5()
fffffd7fffdff840 _start_crt+0x83()
fffffd7fffdff850 _start+0x18()
#2

Updated by Andy Fiddaman 12 months ago

  • Category set to cmd - userland programs
  • Assignee set to Andy Fiddaman
  • % Done changed from 0 to 80
  • Tags deleted (needs-triage)
#4

Updated by Andy Fiddaman 12 months ago

Testing notes:

Before:

build:illumos:elfedit% elfedit -re dyn:rpath libunbound.so
     index  tag                value
      [10]  RUNPATH           0x8882              /opt/libev/lib
      [11]  RPATH             0x8882              /opt/libev/lib
build:illumos:elfedit% elfedit -re dyn:rpath openbios-ppc
zsh: segmentation fault (core dumped)  elfedit -re dyn:rpath openbios-ppc

and after:

build:illumos:elfedit% /data/omnios-build/omniosorg/bloody/illumos/proto/root_i386-nd/usr/bin/elfedit -re dyn:runpath libunbound.so
     index  tag                value
      [10]  RUNPATH           0x8882              /opt/libev/lib
      [11]  RPATH             0x8882              /opt/libev/lib
build:illumos:elfedit% /data/omnios-build/omniosorg/bloody/illumos/proto/root_i386-nd/usr/bin/elfedit -re dyn:runpath openbios-ppc
elfedit: ELF object does not have a dynamic section
#5

Updated by Andy Fiddaman 12 months ago

  • Status changed from New to Pending RTI
#6

Updated by Electric Monk 11 months ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 80 to 100

git commit 363d8186a0da4dd21c2beacec05920a71ab67022

commit  363d8186a0da4dd21c2beacec05920a71ab67022
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2018-11-09T10:36:28.000Z

    9833 elfedit dumps core on incorrect file
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
    Reviewed by: Michal Nowak <mnowak@startmail.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>

Also available in: Atom PDF