From bb6aa92c311cbd5b290604125e7dc145974456fd Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 28 Aug 2018 10:32:50 +0000 Subject: [PATCH] [XRay][compiler-rt] Stash flags as well in x86_64 trampoline Summary: This change saves and restores the full flags register in x86_64 mode. This makes running instrumented signal handlers safer, and avoids flags set during the execution of the event handlers from polluting the instrumented call's flags state. Reviewers: kpw, eizan, jfb Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51277 llvm-svn: 340812 --- compiler-rt/lib/xray/xray_trampoline_x86_64.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler-rt/lib/xray/xray_trampoline_x86_64.S b/compiler-rt/lib/xray/xray_trampoline_x86_64.S index 99ad3966ee3a..9dffae04821c 100644 --- a/compiler-rt/lib/xray/xray_trampoline_x86_64.S +++ b/compiler-rt/lib/xray/xray_trampoline_x86_64.S @@ -19,6 +19,7 @@ .macro SAVE_REGISTERS + pushfq subq $240, %rsp CFI_DEF_CFA_OFFSET(248) movq %rbp, 232(%rsp) @@ -69,6 +70,7 @@ movq 8(%rsp), %r14 movq 0(%rsp), %r15 addq $240, %rsp + popfq CFI_DEF_CFA_OFFSET(8) .endm