Project

General

Profile

Actions

Bug #9833

closed

elfedit dumps core on incorrect file

Added by Alexander Pyhalov about 5 years ago. Updated about 5 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

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.

Actions #1

Updated by Michal Nowak about 5 years 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()
Actions #2

Updated by Andy Fiddaman about 5 years ago

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

Updated by Andy Fiddaman about 5 years 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
Actions #5

Updated by Andy Fiddaman about 5 years ago

  • Status changed from New to Pending RTI
Actions #6

Updated by Electric Monk about 5 years 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>

Actions

Also available in: Atom PDF