patchelf
patchelf copied to clipboard
Core dump, empty interpreter
Describe the bug
The program produces a core dump (crashes).
Steps To Reproduce
patchelf --set-interpreter /path-to/ld-linux.so BinaryWithEmptyInterpreter.binary produces a core dump.
The binary with empty interpreter that triggered the issue for me can be found in zipped form at https://ufile.io/y3pvil2z (38MB zipped, 136MB unzipped).
Expected behavior
Not a program crash. Maybe a no-op with an informative message.
patchelf --version output
patchelf 0.14.5
Additional context
https://github.com/yvt/nixpkgs/commit/49be2c828875522289e2250307e85c48625bccc7#commitcomment-70690616
Maybe fixed by https://github.com/NixOS/patchelf/pull/376 ?
There is now a new patchelf release and the file provided here is no longer available
Sorry for late replay, if still interested in the file here it is in parts smaller than the 25MB github upload limit,
SomeUE4DebugBinary.debug.aa.zip SomeUE4DebugBinary.debug.ab.zip
Then, to get the full 136MB binary,
cat *.aa.zip *.ab.zip > SomeDebugBinary.zip
unzip SomeDebugBinary.zip
$ nix shell github:NixOS/patchelf
$ patchelf --version
patchelf 0.15.0
$ patchelf --set-interpreter /path-to/ld-linux.so UnrealVersionSelector-Linux-Shipping.debug
patchelf: patchelf.cc:809: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Verneed, Elf_Versym>::rewriteSectionsExecutable() [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym; Elf_Verneed = Elf64_Verneed; Elf_Versym = short unsigned int]: Assertion `startAddr % getPageSize() == startOffset % getPageSize()' failed.
Aborted (core dumped)
Ok. So this is not quite a crash but a failed assertion. Also this assertion could be turned into a better error message.