[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


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

            Bug ID: 25916
           Summary: Missing CFI directive after func epilogue and before
                    ret
           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
testcase

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
../../../libgcc/unwind-dw2.c:244
244     ../../../libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (index=16, context=0x7ffff7fe5ef0) at
../../../libgcc/unwind-dw2.c:244
#1  _Unwind_GetPtr (index=16, context=0x7ffff7fe5ef0) at
../../../libgcc/unwind-dw2.c:255
#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

Assembly:
~/workarea/llvm-r255910/dbuild/bin/clang -fsanitize=address ill.cc -S
main:                                   # @main
        .cfi_startproc
# BB#0:                                 # %entry
        pushq   %rbp
.Ltmp3:
        .cfi_def_cfa_offset 16
.Ltmp4:
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
.Ltmp5:
        .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
instruction.
        ud2
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
        .cfi_endproc

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