[PATCH] D81405: [AArch64] Avoid incompatibility between SLSBLR mitigation and BTI codegen.
Kristof Beyls via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 18 22:52:05 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd938ec4509c4: [AArch64] Avoid incompatibility between SLSBLR mitigation and BTI codegen. (authored by kristof.beyls).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81405/new/
https://reviews.llvm.org/D81405
Files:
llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
Index: llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
===================================================================
--- llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
+++ llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
@@ -203,14 +203,16 @@
}
; HARDEN-label: __llvm_slsblr_thunk_x0:
-; HARDEN: br x0
+; HARDEN: mov x16, x0
+; HARDEN: br x16
; ISBDSB-NEXT: dsb sy
; ISBDSB-NEXT: isb
; SB-NEXT: dsb sy
; SB-NEXT: isb
; HARDEN-NEXT: .Lfunc_end
; HARDEN-label: __llvm_slsblr_thunk_x19:
-; HARDEN: br x19
+; HARDEN: mov x16, x19
+; HARDEN: br x16
; ISBDSB-NEXT: dsb sy
; ISBDSB-NEXT: isb
; SB-NEXT: dsb sy
Index: llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
+++ llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
@@ -223,7 +223,12 @@
// BR xN
// barrierInsts
Entry->addLiveIn(ThunkReg);
- BuildMI(Entry, DebugLoc(), TII->get(AArch64::BR)).addReg(ThunkReg);
+ // MOV X16, ThunkReg == ORR X16, XZR, ThunkReg, LSL #0
+ BuildMI(Entry, DebugLoc(), TII->get(AArch64::ORRXrs), AArch64::X16)
+ .addReg(AArch64::XZR)
+ .addReg(ThunkReg)
+ .addImm(0);
+ BuildMI(Entry, DebugLoc(), TII->get(AArch64::BR)).addReg(AArch64::X16);
// Make sure the thunks do not make use of the SB extension in case there is
// a function somewhere that will call to it that for some reason disabled
// the SB extension locally on that function, even though it's enabled for
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81405.271914.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200619/16e9fa97/attachment.bin>
More information about the llvm-commits
mailing list