[llvm-bugs] [Bug 25916] New: Missing CFI directive after func epilogue and before ret

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 21 15:58:02 PST 2015


            Bug ID: 25916
           Summary: Missing CFI directive after func epilogue and before
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: wmi at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15508
  --> https://llvm.org/bugs/attachment.cgi?id=15508&action=edit

Using the most recent clang (r255910)

clang  -fsanitize=address ill.cc
ASAN_OPTIONS=handle_sigill=1:fast_unwind_on_fatal=0  ./a.out

It will catch a SIGILL signal (correct behavior) and then catch SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
_Unwind_GetGR (index=16, context=0x7ffff7fe5ef0) at
244     ../../../libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (index=16, context=0x7ffff7fe5ef0) at
#1  _Unwind_GetPtr (index=16, context=0x7ffff7fe5ef0) at
#2  uw_update_context (context=context at entry=0x7ffff7fe5ef0,
fs=fs at entry=0x7ffff7fe5fe0) at ../../../libgcc/unwind-dw2.c:1523
#3  0x00007ffff72a3e3e in _Unwind_Backtrace (trace=0x4d14d0 <Unwind_Trace()>,
trace_argument=0x7ffff7fe61a0) at ../../../libgcc/unwind.inc:303
#4  0x00000000004d16ec in SlowUnwindStack

~/workarea/llvm-r255910/dbuild/bin/clang -fsanitize=address ill.cc -S
main:                                   # @main
# BB#0:                                 # %entry
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register %rbp
        subq    $16, %rsp
        movabsq $_Z5deathv, %rax
        movl    %edi, -4(%rbp)
        movq    %rsi, -16(%rbp)
        movq    %rax, %rdi
        callq   __sanitizer_set_death_callback
        callq   __asan_handle_no_return
        xorl    %eax, %eax
        addq    $16, %rsp
        popq    %rbp         // After this instruction, cfa register should be
changed to rsp again. ".cfi_def_cfa 7, 8" should be inserted after the
        .size   main, .Lfunc_end1-main

If ".cfi_def_cfa 7, 8" is added before ud2 manually, the SEGV will be gone.

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/20151221/40967270/attachment.html>

More information about the llvm-bugs mailing list