[llvm-bugs] [Bug 45159] New: 0-length section causes assertion failure in llvm-objcopy

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 9 12:56:34 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45159

            Bug ID: 45159
           Summary: 0-length section causes assertion failure in
                    llvm-objcopy
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-objcopy/strip
          Assignee: unassignedbugs at nondot.org
          Reporter: jgravelle at google.com
                CC: alexander.v.shaposhnikov at gmail.com,
                    jake.h.ehrlich at gmail.com,
                    jh7370.2008 at my.bristol.ac.uk,
                    llvm-bugs at lists.llvm.org, rupprecht at google.com

Created attachment 23217
  --> https://bugs.llvm.org/attachment.cgi?id=23217&action=edit
Wasm module with empty custom section that reproduces the assert

This might be a WebAssembly-only problem, not sure.

Trying to run `llvm-objcopy --dump-section` on a section that exists but is of
length 0 causes an assertion failure that size != 0. It's legal (albeit weird)
in WebAssembly to have a section with no contents, so I'd expect llvm-objcopy
to handle that too.

Attached is nothing.wasm, which has a 0-length custom section named
"interface-types". To reproduce call `llvm-objcopy nothing.wasm
--dump-section=interface-types=nothing.out`

llvm-objcopy:
~/code/wasm/waterfall/src/work/llvm-project/llvm/lib/Support/Unix/Path.inc:776:
std::error_code llvm::sys::fs::mapped_file_region::init(int, uint64_t,
llvm::sys::fs::mapped_file_region::mapmode): Assertion `Size != 0' failed.
Stack dump:
0.  Program arguments: /s/wbin/llvm-objcopy nothing.wasm
--dump-section=interface-types=nothing.out 
 #0 0x00007f323cd56a14 PrintStackTraceSignalHandler(void*)
(~/code/wasm/waterfall/src/work/wasm-install/bin/../lib/libLLVM-11git.so+0x775a14)
 #1 0x00007f323cd5457e llvm::sys::RunSignalHandlers()
(~/code/wasm/waterfall/src/work/wasm-install/bin/../lib/libLLVM-11git.so+0x77357e)
 #2 0x00007f323cd56ccc SignalHandler(int)
(~/code/wasm/waterfall/src/work/wasm-install/bin/../lib/libLLVM-11git.so+0x775ccc)
 #3 0x00007f323c5b3520 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x13520)
 #4 0x00007f323c0e2081 raise
/build/glibc-G5rUEF/glibc-2.29/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f323c0cd535 abort /build/glibc-G5rUEF/glibc-2.29/stdlib/abort.c:81:7
 #6 0x00007f323c0cd40f _nl_load_domain
/build/glibc-G5rUEF/glibc-2.29/intl/loadmsgcat.c:1177:9
 #7 0x00007f323c0dab92 (/lib/x86_64-linux-gnu/libc.so.6+0x32b92)
 #8 0x00007f323cd4e3df
(~/code/wasm/waterfall/src/work/wasm-install/bin/../lib/libLLVM-11git.so+0x76d3df)
 #9 0x00007f323ccace85 llvm::FileOutputBuffer::create(llvm::StringRef, unsigned
long, unsigned int)
(~/code/wasm/waterfall/src/work/wasm-install/bin/../lib/libLLVM-11git.so+0x6cbe85)
#10 0x00000000004825f4
llvm::objcopy::wasm::executeObjcopyOnBinary(llvm::objcopy::CopyConfig const&,
llvm::object::WasmObjectFile&, llvm::objcopy::Buffer&)
(/s/wbin/llvm-objcopy+0x4825f4)
#11 0x000000000041fee9 executeObjcopyOnBinary(llvm::objcopy::CopyConfig&,
llvm::object::Binary&, llvm::objcopy::Buffer&) (/s/wbin/llvm-objcopy+0x41fee9)
#12 0x000000000041e453 main (/s/wbin/llvm-objcopy+0x41e453)
#13 0x00007f323c0cebbb __libc_start_main
/build/glibc-G5rUEF/glibc-2.29/csu/../csu/libc-start.c:342:3
#14 0x000000000040b0da _start (/s/wbin/llvm-objcopy+0x40b0da)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200309/54565f72/attachment.html>


More information about the llvm-bugs mailing list