llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.13k stars 12.01k forks source link

llvm-dwarfdump crashes when processing the debuginfo for the x86_64 Fedora 36 libclang-cpp.so #60083

Open wcohen opened 1 year ago

wcohen commented 1 year ago

On x86_64 Fedora 36 llvm-dwarfdump from llvm-14.0.5-1.fc36.x86_64 crashes when trying to process the debuginfo of libclang-cpp.so. Have the following rpms installed:

llvm-14.0.5-1.fc36.x86_64 clang-libs-debuginfo-14.0.5-2.fc36.x86_64 clang-libs-14.0.5-2.fc36.x86_64

Run the following command to reproduce the crash:

llvm-dwarfdump /usr/lib/debug/usr/lib64/libclang-cpp.so.14-14.0.5-2.fc36.x86_64.debug

Very soon after starting get the following crash output:

0x00000a72:       DW_TAG_template_type_parameter
                    DW_AT_name  ("T")
                    DW_AT_type  (<alt 0x534> "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: llvm-dwarfdump /usr/lib/debug/usr/lib64/libclang-cpp.so.14-14.0.5-2.fc36.x86_64.debug
 #0 0x00007f2eda00c975 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-14.so+0xc0c975)
 #1 0x00007f2eda00cbfb (/lib64/libLLVM-14.so+0xc0cbfb)
 #2 0x00007f2eda00a2b4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-14.so+0xc0a2b4)
 #3 0x00007f2eda00d21d (/lib64/libLLVM-14.so+0xc0d21d)
 #4 0x00007f2ed8c3ea30 __restore_rt (/lib64/libc.so.6+0x3ea30)
 #5 0x00007f2edba29c34 (/lib64/libLLVM-14.so+0x2629c34)
 #6 0x00007f2edba28ea4 (/lib64/libLLVM-14.so+0x2628ea4)
 #7 0x00007f2edba26472 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-14.so+0x2626472)
 #8 0x00007f2edba26891 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-14.so+0x2626891)
 #9 0x00007f2edba26891 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-14.so+0x2626891)
#10 0x00007f2edba26891 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-14.so+0x2626891)
#11 0x00007f2edb9eb115 llvm::DWARFCompileUnit::dump(llvm::raw_ostream&, llvm::DIDumpOptions) (/lib64/libLLVM-14.so+0x25eb115)
#12 0x00007f2edb9f0ccb (/lib64/libLLVM-14.so+0x25f0ccb)
#13 0x00007f2edb9ecaa2 llvm::DWARFContext::dump(llvm::raw_ostream&, llvm::DIDumpOptions, std::array<llvm::Optional<unsigned long>, 28ul>) (/lib64/libLLVM-14.so+0x25ecaa2)
#14 0x0000000000418447 (/usr/bin/llvm-dwarfdump+0x418447)
#15 0x0000000000419b2d (/usr/bin/llvm-dwarfdump+0x419b2d)
#16 0x0000000000416104 (/usr/bin/llvm-dwarfdump+0x416104)
#17 0x0000000000415d9e (/usr/bin/llvm-dwarfdump+0x415d9e)
#18 0x00007f2ed8c29510 __libc_start_call_main /usr/src/debug/glibc-2.35-20.fc36.x86_64/csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#19 0x00007f2ed8c295c9 call_init /usr/src/debug/glibc-2.35-20.fc36.x86_64/csu/../csu/libc-start.c:128:20
#20 0x00007f2ed8c295c9 __libc_start_main@GLIBC_2.2.5 /usr/src/debug/glibc-2.35-20.fc36.x86_64/csu/../csu/libc-start.c:376:5
#21 0x000000000040a885 (/usr/bin/llvm-dwarfdump+0x40a885)
Segmentation fault (core dumped)
llvmbot commented 1 year ago

@llvm/issue-subscribers-debuginfo

dwblaikie commented 1 year ago

Could you upload libclang-cpp.so.14-14.0.5-2.fc36.x86_64.debug somewhere convenient? (or links to where to download the rpms/how to extract that file?)

wcohen commented 1 year ago

The file is rather large, 1.5GB. It would be better to download the rpm than attach it to this issue. The koji build system has the various architecture builds for clang14 in https://koji.fedoraproject.org/koji/buildinfo?buildID=2096838

The specific rpm containing the file is https://kojipkgs.fedoraproject.org//packages/clang/14.0.5/2.fc36/x86_64/clang-libs-debuginfo-14.0.5-2.fc36.x86_64.rpm (clang-libs-debuginfo-14.0.5-2.fc36.x86_64).

dwblaikie commented 1 year ago

Doesn't crash with ToT at least, I get this result for that particular DIE:

0x00000a72:       DW_TAG_template_type_parameter
                    DW_AT_name  ("T")
                    DW_AT_type  (<alt 0x534> "")
wcohen commented 1 year ago

That's good that llvm-dwarfdump made it farther. It sounds like ToT may partially addresses the problem. However, I tried the same libclang-cpp.so on fedora rawhide which is using clang15. It crashes also at the same point:

[wcohen@rawhide ~]$ rpm -q clang clang-15.0.7-1.fc38.x86_64 [wcohen@rawhide ~]$ llvm-dwarfdump ./libclang-cpp.so.14-14.0.5-2.fc36.x86_64.debug ... 0x00000a72: DW_TAG_template_type_parameter DW_AT_name ("T") DW_AT_type (<alt 0x534> "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump:

  1. Program arguments: llvm-dwarfdump ./libclang-cpp.so.14-14.0.5-2.fc36.x86_64.debug

    0 0x00007f53d0c57d45 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-15.so+0xc57d45)

    1 0x00007f53d0c57fcc (/lib64/libLLVM-15.so+0xc57fcc)

    2 0x00007f53d0c55664 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-15.so+0xc55664)

    3 0x00007f53d0c585fd (/lib64/libLLVM-15.so+0xc585fd)

    4 0x00007f53cfa5e100 __restore_rt (/lib64/libc.so.6+0x3d100)

    5 0x00007f53d27a1dd8 llvm::DWARFTypePrinter::appendScopes(llvm::DWARFDie) (/lib64/libLLVM-15.so+0x27a1dd8)

    6 0x00007f53d27bacd8 (/lib64/libLLVM-15.so+0x27bacd8)

    7 0x00007f53d27b8387 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b8387)

    8 0x00007f53d27b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    9 0x00007f53d27b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    10 0x00007f53d27b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    11 0x00007f53d277849f llvm::DWARFCompileUnit::dump(llvm::raw_ostream&, llvm::DIDumpOptions) (/lib64/libLLVM-15.so+0x277849f)

    12 0x00007f53d277dd99 (/lib64/libLLVM-15.so+0x277dd99)

    13 0x00007f53d2779d9b llvm::DWARFContext::dump(llvm::raw_ostream&, llvm::DIDumpOptions, std::array<llvm::Optional, 28ul>) (/lib64/libLLVM-15.so+0x2779d9b)

    14 0x00000000004194a3 (/usr/bin/llvm-dwarfdump+0x4194a3)

    15 0x000000000041abd0 (/usr/bin/llvm-dwarfdump+0x41abd0)

    16 0x000000000041665e (/usr/bin/llvm-dwarfdump+0x41665e)

    17 0x00000000004162bc (/usr/bin/llvm-dwarfdump+0x4162bc)

    18 0x00007f53cfa48a90 __libc_start_call_main /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../sysdeps/nptl/libc_start_call_main.h:74:3

    19 0x00007f53cfa48b49 call_init /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../csu/libc-start.c:128:20

    20 0x00007f53cfa48b49 __libc_start_main@GLIBC_2.2.5 /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../csu/libc-start.c:368:5

    21 0x000000000040a8b5 (/usr/bin/llvm-dwarfdump+0x40a8b5)

    Segmentation fault (core dumped)

Maybe some other differences in the environment such as shared libaries are causing the problem:

[wcohen@rawhide ~]$ ldd /usr/bin/llvm-dwarfdump linux-vdso.so.1 (0x00007ffe38f27000) libLLVM-15.so => /lib64/libLLVM-15.so (0x00007f106c800000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f106c400000) libc.so.6 => /lib64/libc.so.6 (0x00007f106c221000) libffi.so.8 => /lib64/libffi.so.8 (0x00007f1073514000) libedit.so.0 => /lib64/libedit.so.0 (0x00007f10734d7000) libm.so.6 => /lib64/libm.so.6 (0x00007f106c720000) libz.so.1 => /lib64/libz.so.1 (0x00007f10734bb000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f1073488000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f1073464000) /lib64/ld-linux-x86-64.so.2 (0x00007f1073539000) [wcohen@rawhide ~]$ rpm -qf /lib64/libLLVM-15.so /lib64/libstdc++.so.6 /lib64/libc.so.6 /lib64/libffi.so.8 /lib64/libedit.so.0 /lib64/libm.so.6 /lib64/libz.so.1 /lib64/libtinfo.so.6 /lib64/libgcc_s.so.1 llvm-libs-15.0.7-1.fc38.x86_64 libstdc++-13.0.0-0.9.fc38.x86_64 glibc-2.36.9000-19.fc38.x86_64 libffi-3.4.4-1.fc38.x86_64 libedit-3.1-44.20221030cvs.fc38.x86_64 glibc-2.36.9000-19.fc38.x86_64 zlib-1.2.13-2.fc38.x86_64 ncurses-libs-6.4-2.20230114.fc38.x86_64 libgcc-13.0.0-0.9.fc38.x86_64

When trying things with the debuginfo file for the newer libclang-cpp.so it gets farther but crashes:

llvm-dwarfdump /usr/lib/debug/usr/lib64/libclang-cpp.so.15-15.0.7-1.fc38.x86_64.debug ... 0x00008b07: DW_TAG_formal_parameter DW_AT_type (<alt 0x72cd3> "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump:

  1. Program arguments: llvm-dwarfdump /usr/lib/debug/usr/lib64/libclang-cpp.so.15-15.0.7-1.fc38.x86_64.debug

    0 0x00007facc4c57d45 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-15.so+0xc57d45)

    1 0x00007facc4c57fcc (/lib64/libLLVM-15.so+0xc57fcc)

    2 0x00007facc4c55664 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-15.so+0xc55664)

    3 0x00007facc4c585fd (/lib64/libLLVM-15.so+0xc585fd)

    4 0x00007facc3a5e100 __restore_rt (/lib64/libc.so.6+0x3d100)

    5 0x00007facc67a1dd8 llvm::DWARFTypePrinter::appendScopes(llvm::DWARFDie) (/lib64/libLLVM-15.so+0x27a1dd8)

    6 0x00007facc67bacd8 (/lib64/libLLVM-15.so+0x27bacd8)

    7 0x00007facc67b8387 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b8387)

    8 0x00007facc67b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    9 0x00007facc67b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    10 0x00007facc67b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    11 0x00007facc67b87a5 llvm::DWARFDie::dump(llvm::raw_ostream&, unsigned int, llvm::DIDumpOptions) const (/lib64/libLLVM-15.so+0x27b87a5)

    12 0x00007facc677849f llvm::DWARFCompileUnit::dump(llvm::raw_ostream&, llvm::DIDumpOptions) (/lib64/libLLVM-15.so+0x277849f)

    13 0x00007facc677dd99 (/lib64/libLLVM-15.so+0x277dd99)

    14 0x00007facc6779d9b llvm::DWARFContext::dump(llvm::raw_ostream&, llvm::DIDumpOptions, std::array<llvm::Optional, 28ul>) (/lib64/libLLVM-15.so+0x2779d9b)

    15 0x00000000004194a3 (/usr/bin/llvm-dwarfdump+0x4194a3)

    16 0x000000000041abd0 (/usr/bin/llvm-dwarfdump+0x41abd0)

    17 0x000000000041665e (/usr/bin/llvm-dwarfdump+0x41665e)

    18 0x00000000004162bc (/usr/bin/llvm-dwarfdump+0x4162bc)

    19 0x00007facc3a48a90 __libc_start_call_main /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../sysdeps/nptl/libc_start_call_main.h:74:3

    20 0x00007facc3a48b49 call_init /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../csu/libc-start.c:128:20

    21 0x00007facc3a48b49 __libc_start_main@GLIBC_2.2.5 /usr/src/debug/glibc-2.36.9000-19.fc38.x86_64/csu/../csu/libc-start.c:368:5

    22 0x000000000040a8b5 (/usr/bin/llvm-dwarfdump+0x40a8b5)

    Segmentation fault (core dumped)