[PATCH] D51277: [XRay][compiler-rt] Stash flags as well in x86_64 trampoline

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 26 22:07:25 PDT 2018


dberris created this revision.
dberris added reviewers: kpw, eizan.
Herald added a reviewer: jfb.

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.


https://reviews.llvm.org/D51277

Files:
  compiler-rt/lib/xray/xray_trampoline_x86_64.S


Index: compiler-rt/lib/xray/xray_trampoline_x86_64.S
===================================================================
--- compiler-rt/lib/xray/xray_trampoline_x86_64.S
+++ 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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51277.162608.patch
Type: text/x-patch
Size: 463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180827/e19ace70/attachment.bin>


More information about the llvm-commits mailing list