LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 35294 - XRay trampolines may leave the stack unaligned
Summary: XRay trampolines may leave the stack unaligned
Status: RESOLVED FIXED
Alias: None
Product: XRay
Classification: Unclassified
Component: Runtime (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Dean Michael Berris
URL:
Keywords:
: 32651 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-13 23:07 PST by Dean Michael Berris
Modified: 2018-06-13 10:59 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Michael Berris 2017-11-13 23:07:09 PST
In some situations when the XRay tracing system has been turned off in the middle of the execution of any one of __xray_Function{Entry,Exit,TailExit} and __xray_ArgLoggerEntry and the handlers have been un-installed, we could be left in an unaligned stack state.

In other cases, we might have a handler that doesn't leave the stack aligned in a specific state after returning, and could be in a situation where the stack is unaligned after the instrumentation is turned off.

We should fix the trampolines to adhere to the Linux x86_64 ABI and align the stack to 16-byte addresses always before calling a function, and re-aligning the stack before restoring the state of the registers and returning. In particular, we already do this correctly for the __xray_CustomEvent trampoline, we just need to port the same implementation across the other trampolines.
Comment 1 Dean Michael Berris 2017-12-12 15:58:08 PST
Fixed in r318261.
Comment 2 Dean Michael Berris 2018-06-13 10:59:30 PDT
*** Bug 32651 has been marked as a duplicate of this bug. ***