[XRay][compiler-rt][x86_64] Align the stack before and after calling handlers
authorDean Michael Berris <dberris@google.com>
Wed, 15 Nov 2017 03:35:42 +0000 (03:35 +0000)
committerDean Michael Berris <dberris@google.com>
Wed, 15 Nov 2017 03:35:42 +0000 (03:35 +0000)
commit6a40b2d0a5851f57541aaf8ae3d2e9dfe3f6cd2f
tree2094751b94157711a99724c5af25620553845690
parent1f88f4c3bc9a011fe9fdc10fa2242d1ba6a64b1e
[XRay][compiler-rt][x86_64] Align the stack before and after calling handlers

Summary:
This change fixes the XRay trampolines aside from the __xray_CustomEvent
trampoline to align the stack to 16-byte boundaries before calling the
handler. Before this change we've not been explicitly aligning the stack
to 16-byte boundaries, which makes it dangerous when calling handlers
that leave the stack in a state that isn't strictly 16-byte aligned
after calling the handlers.

We add a test that makes sure we can handle these cases appropriately
after the changes, and prevents us from regressing the state moving
forward.

Fixes http://llvm.org/PR35294.

Reviewers: pelikan, pcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D40004

llvm-svn: 318261
compiler-rt/lib/xray/xray_trampoline_x86_64.S
compiler-rt/test/xray/TestCases/Linux/common-trampoline-alignment.cc [new file with mode: 0644]