Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objcopy crash #121751

Closed
douglas-raillard-arm opened this issue Jan 6, 2025 · 3 comments
Closed

objcopy crash #121751

douglas-raillard-arm opened this issue Jan 6, 2025 · 3 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] invalid Resolved as invalid, i.e. not a bug tools:llvm-objcopy/strip

Comments

@douglas-raillard-arm
Copy link

llvm-objcopy dies when inspecting some sections of an object file generated by rustc.
The tool is in version 18, installed on Ubuntu following the llvm.sh recipe at https://apt.llvm.org/

llvm-objdump-18 -h /tmp/tmpoync5nx4/generated/rust/rust.o_objdump.o | awk '{ print $2 }' | grep '^.binstore.c.' | xargs -n1 sh -c 'cp -f /tmp/tmpoync5nx4/generated/rust/rust.o /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o && llvm-objcopy-18 --dump-section $0=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_$0 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null'
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: llvm-objcopy-18 --dump-section .binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_.binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null
 #0 0x00007f823c643716 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94716)
 #1 0x00007f823c6416d0 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd926d0)
 #2 0x00007f823c643ddb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94ddb)
 #3 0x00007f823b49c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f823dd5a580 llvm::objcopy::elf::SectionWriter::visit(llvm::objcopy::elf::Section const&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ab580)
 #5 0x00007f823dd5b483 llvm::objcopy::elf::Section::accept(llvm::objcopy::elf::SectionVisitor&) const (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ac483)
 #6 0x00007f823dd751c0 llvm::objcopy::elf::ELFWriter<llvm::object::ELFType<(llvm::endianness)1, true> >::write() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24c61c0)
 #7 0x00007f823dd563bb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a73bb)
 #8 0x00007f823dd56701 llvm::objcopy::elf::executeObjcopyOnBinary(llvm::objcopy::CommonConfig const&, llvm::objcopy::ELFConfig const&, llvm::object::ELFObjectFileBase&, llvm::raw_ostream&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a7701)
 #9 0x00007f823dd494b7 llvm::objcopy::executeObjcopyOnBinary(llvm::objcopy::MultiFormatConfig const&, llvm::object::Binary&, llvm::raw_ostream&) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x249a4b7)
#10 0x00005631df095f69 (/usr/lib/llvm-18/bin/llvm-objcopy+0x21f69)
#11 0x00007f823c628390 llvm::writeToOutput(llvm::StringRef, std::function<llvm::Error (llvm::raw_ostream&)>) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd79390)
#12 0x00005631df0956f3 (/usr/lib/llvm-18/bin/llvm-objcopy+0x216f3)
#13 0x00005631df096006 (/usr/lib/llvm-18/bin/llvm-objcopy+0x22006)
#14 0x00007f823b483d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#15 0x00007f823b483e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#16 0x00005631df07cac5 (/usr/lib/llvm-18/bin/llvm-objcopy+0x8ac5)
@hstk30-hw hstk30-hw added tools:llvm-objcopy/strip crash Prefer [crash-on-valid] or [crash-on-invalid] labels Jan 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2025

@llvm/issue-subscribers-tools-llvm-objcopy-strip

Author: Douglas Raillard (douglas-raillard-arm)

llvm-objcopy dies when inspecting some sections of an object file generated by rustc. The tool is in version 18, installed on Ubuntu following the llvm.sh recipe at https://apt.llvm.org/
llvm-objdump-18 -h /tmp/tmpoync5nx4/generated/rust/rust.o_objdump.o | awk '{ print $2 }' | grep '^.binstore.c.' | xargs -n1 sh -c 'cp -f /tmp/tmpoync5nx4/generated/rust/rust.o /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o &amp;&amp; llvm-objcopy-18 --dump-section $0=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_$0 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null'
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: llvm-objcopy-18 --dump-section .binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652=/tmp/tmpoync5nx4/generated/rust/rust_c_shims/shim_.binstore.c.header.__lisa_c_shim_constant_assert_50141894102302112148172994662096862652 /tmp/tmpoync5nx4/generated/rust/rust.o_objcopy.o /dev/null
 #<!-- -->0 0x00007f823c643716 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94716)
 #<!-- -->1 0x00007f823c6416d0 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd926d0)
 #<!-- -->2 0x00007f823c643ddb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd94ddb)
 #<!-- -->3 0x00007f823b49c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00007f823dd5a580 llvm::objcopy::elf::SectionWriter::visit(llvm::objcopy::elf::Section const&amp;) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ab580)
 #<!-- -->5 0x00007f823dd5b483 llvm::objcopy::elf::Section::accept(llvm::objcopy::elf::SectionVisitor&amp;) const (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24ac483)
 #<!-- -->6 0x00007f823dd751c0 llvm::objcopy::elf::ELFWriter&lt;llvm::object::ELFType&lt;(llvm::endianness)1, true&gt; &gt;::write() (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24c61c0)
 #<!-- -->7 0x00007f823dd563bb (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a73bb)
 #<!-- -->8 0x00007f823dd56701 llvm::objcopy::elf::executeObjcopyOnBinary(llvm::objcopy::CommonConfig const&amp;, llvm::objcopy::ELFConfig const&amp;, llvm::object::ELFObjectFileBase&amp;, llvm::raw_ostream&amp;) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x24a7701)
 #<!-- -->9 0x00007f823dd494b7 llvm::objcopy::executeObjcopyOnBinary(llvm::objcopy::MultiFormatConfig const&amp;, llvm::object::Binary&amp;, llvm::raw_ostream&amp;) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0x249a4b7)
#<!-- -->10 0x00005631df095f69 (/usr/lib/llvm-18/bin/llvm-objcopy+0x21f69)
#<!-- -->11 0x00007f823c628390 llvm::writeToOutput(llvm::StringRef, std::function&lt;llvm::Error (llvm::raw_ostream&amp;)&gt;) (/lib/x86_64-linux-gnu/libLLVM-18.so.18.1+0xd79390)
#<!-- -->12 0x00005631df0956f3 (/usr/lib/llvm-18/bin/llvm-objcopy+0x216f3)
#<!-- -->13 0x00005631df096006 (/usr/lib/llvm-18/bin/llvm-objcopy+0x22006)
#<!-- -->14 0x00007f823b483d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->15 0x00007f823b483e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->16 0x00005631df07cac5 (/usr/lib/llvm-18/bin/llvm-objcopy+0x8ac5)

@jh7370
Copy link
Collaborator

jh7370 commented Jan 9, 2025

Hi @douglas-raillard-arm, are you able to provide the input object you're seeing this crash with?

@douglas-raillard-arm
Copy link
Author

After much hair pulling, it turns out the issue was from my Makefile where a rule was executed multiple times concurrently, leading to objcopy running on partially-written files. Sorry for the noise.

@EugeneZelenko EugeneZelenko added the invalid Resolved as invalid, i.e. not a bug label Jan 14, 2025
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] invalid Resolved as invalid, i.e. not a bug tools:llvm-objcopy/strip
Projects
None yet
Development

No branches or pull requests

5 participants