[llvm-bugs] [Bug 49060] New: Caller Frame Information in x86_64 XRay trampolines is invalid

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 5 08:48:54 PST 2021


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

            Bug ID: 49060
           Summary: Caller Frame Information in x86_64 XRay trampolines is
                    invalid
           Product: XRay
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Runtime
          Assignee: dberris at google.com
          Reporter: elia.f.geretto at gmail.com
                CC: llvm-bugs at lists.llvm.org

When attempting to unwind the stack from inside an XRay handler, both using
`libunwind` and `gdb`, the stack trace is corrupted.

As an example, this happens when using `backtrace` in GDB:
#0  xray_handler (function_id=<optimized out>, entry_type=ENTRY) at main.c:140
#1  0x000000000041ad5d in __xray_FunctionEntry ()
#2  0x000000000041d250 in .annobin__ZN6__xray18fdrLoggingFinalizeEv.end ()
#3  0x000000000041d1b0 in
.annobin__ZZN6__xrayL19fdrCommonHeaderInfoEvENUlvE_4_FUNEv.end ()
#4  0x000000000041ff60 in ?? ()
#5  0x0000000000000246 in ?? ()
#6  0x000000000041ff2b in print_message () at main.c:159
#7  0x000000000041ff51 in main (argc=0x1, argv=0x0) at main.c:162

The stack trace is correct up to frame 1, but then it gets corrupted. I
verified that this is due to the following ASM macro in which `rsp` is
manipulated without adding the appropriate CFI directives:
https://github.com/llvm/llvm-project/blob/af48d2bfc23fd188e5ae162b9f5b27de306ab38f/compiler-rt/lib/xray/xray_trampoline_x86_64.S#L83-L87

-- 
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/20210205/0e12e6a9/attachment.html>


More information about the llvm-bugs mailing list