[LLVMbugs] [Bug 20800] New: Invalid compact unwind info generated for a function without frame pointers on OSX

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 29 02:53:44 PDT 2014


            Bug ID: 20800
           Summary: Invalid compact unwind info generated for a function
                    without frame pointers on OSX
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: glider at google.com
                CC: isanbard at gmail.com, kcc at google.com, kledzik at apple.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The attached file contains the __asan_report_error function for which the
compact unwind info appears to be incorrect if the frame pointers are omitted:

$ bin/clang++   -O3   -fomit-frame-pointer asan_report.ii -c
$ bin/llvm-objdump -unwind-info -d asan_report.o
       0:       55                                              pushq   %rbp
       1:       41 57                                           pushq   %r15
       3:       41 56                                           pushq   %r14
       5:       41 55                                           pushq   %r13
       7:       41 54                                           pushq   %r12
       9:       53                                              pushq   %rbx
       a:       48 81 ec 18 08 00 00                            subq    $2072,
Contents of __compact_unwind section:
  Entry at offset 0x0:
    start:                0x0 __Z19__asan_report_errormmmm
    length:               0xda
    compact encoding:     0x0309f800

According to /usr/include/mach-o/compact_unwind_encoding.h, the compact
encoding uses the frameless stack index mode (0x03000000 is
UNWIND_X86_64_MODE_STACK_IND), so the second byte of the compact encoding must
be the offset of the immediate constant denoting the stack size in the subq
instruction. This byte has value 0x9 instead of 0xc, which makes the unwinder
think the function stack size is around 3Gb.

This test case contains a reduced version of __asan_report_error in the ASan
runtime. I'm seeing actual crashes because of this bug when calling
_Unwind_Backtrace from the real __asan_report_error on OSX. GDB also has
problems unwinding through this function on OSX.
A number of other functions in the ASan runtime have the same incorrect compact
unwind info.

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/20140829/a9976c49/attachment.html>

More information about the llvm-bugs mailing list