[PATCH] D81402: [AArch64] Extend AArch64SLSHardeningPass to harden BLR instructions.

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 08:14:04 PDT 2020


kristof.beyls created this revision.
kristof.beyls added a reviewer: ostannard.
Herald added subscribers: llvm-commits, danielkiss, hiraditya.
Herald added a project: LLVM.

To make sure that no barrier gets placed on the architectural execution
path, each

  BLR x<N>

instruction gets transformed to a

  BL __llvm_slsblr_thunk_x<N>

instruction, with __llvm_slsblr_thunk_x<N> a thunk that contains
__llvm_slsblr_thunk_x<N>:

  BR x<N>
  <speculation barrier>

Therefore, the BLR instruction gets split into 2; one BL and one BR.
This transformation results in not inserting a speculation barrier on
the architectural execution path.

The mitigation is off by default and can be enabled by the
harden-sls-blr subtarget feature.

As BLRA* indirect calls are not produced by LLVM currently, this does
not aim to implement support for those.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81402

Files:
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/test/CodeGen/AArch64/O0-pipeline.ll
  llvm/test/CodeGen/AArch64/O3-pipeline.ll
  llvm/test/CodeGen/AArch64/speculation-hardening-sls-blr.mir
  llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81402.269237.patch
Type: text/x-patch
Size: 25632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200608/f7ae8809/attachment-0001.bin>


More information about the llvm-commits mailing list