[Bug 257081] libunwind fails in Ceph test unittest_back_trace

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 10 Jul 2021 10:40:29 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257081

--- Comment #1 from Willem Jan Withagen <wjw@digiware.nl> ---
This is on:
FreeBSD quad-b.digiware.nl 14.0-CURRENT FreeBSD 14.0-CURRENT #3
main-n247810-28f47a199cf: Thu Jul  8 20:47:10 CEST 2021    
root@quad-b.digiware.nl:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  amd64


Tested it on the very basic program:
#include <execinfo.h>
int main() {
        void *addrlist[100];
        backtrace(addrlist, 100);
}


And got:
Starting program: /tmp/a.out

Program received signal SIGSEGV, Segmentation fault.
libunwind::CFI_Parser<libunwind::LocalAddressSpace>::findFDE (addressSpace=...,
pc=pc@entry=4195759, ehSectionStart=4196392,
    sectionLength=<optimized out>, fdeHint=<optimized out>, fdeHint@entry=0,
fdeInfo=fdeInfo@entry=0x7fffffffddc0, cieInfo=0x7fffffffdd88)
    at /usr/src/contrib/llvm-project/libunwind/src/DwarfParser.hpp:232
232         pint_t cfiLength = addressSpace.get32(p);
(gdb) l
227                                       ? static_cast<pint_t>(-1)
228                                       : (ehSectionStart + sectionLength);
229       while (p < ehSectionEnd) {
230         pint_t currentCFI = p;
231         //fprintf(stderr, "findFDE() CFI at 0x%llX\n", (long long)p);
232         pint_t cfiLength = addressSpace.get32(p);
233         p += 4;
234         if (cfiLength == 0xffffffff) {
235           // 0xffffffff means length is really next 8 bytes
236           cfiLength = (pint_t)addressSpace.get64(p);
(gdb) p /x *p
Cannot access memory at address 0x800ffc
(gdb) bt
#0  libunwind::CFI_Parser<libunwind::LocalAddressSpace>::findFDE
(addressSpace=..., pc=pc@entry=4195759, ehSectionStart=4196392,
    sectionLength=<optimized out>, fdeHint=<optimized out>, fdeHint@entry=0,
fdeInfo=fdeInfo@entry=0x7fffffffddc0, cieInfo=0x7fffffffdd88)
    at /usr/src/contrib/llvm-project/libunwind/src/DwarfParser.hpp:232
#1  0x0000000800a9bef1 in libunwind::UnwindCursor<libunwind::LocalAddressSpace,
libunwind::Registers_x86_64>::getInfoFromDwarfSection (
    this=this@entry=0x7fffffffe400, pc=pc@entry=4195759, sects=...,
fdeSectionOffsetHint=fdeSectionOffsetHint@entry=0)
    at /usr/src/contrib/llvm-project/libunwind/src/UnwindCursor.hpp:1566
#2  0x0000000800a98b00 in libunwind::UnwindCursor<libunwind::LocalAddressSpace,
libunwind::Registers_x86_64>::setInfoBasedOnIPRegister (
    this=0x7fffffffe400, isReturnAddress=true) at
/usr/src/contrib/llvm-project/libunwind/src/UnwindCursor.hpp:1958
#3  0x0000000800a9895b in libunwind::UnwindCursor<libunwind::LocalAddressSpace,
libunwind::Registers_x86_64>::step (this=0x7fffffffe400)
    at /usr/src/contrib/llvm-project/libunwind/src/UnwindCursor.hpp:2103
#4  0x0000000800a96305 in _Unwind_Backtrace (callback=0x800644fe0 <tracer>,
ref=0x7fffffffe598)
    at /usr/src/contrib/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c:131
#5  0x0000000800644fa7 in backtrace (arr=<optimized out>, len=<optimized out>)
at /usr/src/contrib/libexecinfo/unwind.c:69
#6  0x00000000004007bc in main ()
(gdb)

-- 
You are receiving this mail because:
You are the assignee for the bug.