[PATCH] D43488: [mips][lld] Spectre variant two mitigation for MIPSR2

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 14:52:14 PST 2018


sdardis created this revision.
sdardis added reviewers: atanasyan, ruiu.
Herald added subscribers: arichardson, emaste.

This patch provides migitation for CVE-2017-5715, Spectre variant two,
which affects the https://reviews.llvm.org/P5600 and https://reviews.llvm.org/P6600. It implements the LLD part of
-z hazardplt. Like the Clang part of this patch, I have opted for that
specific option name in case alternative migitation methods are required
in the future.

The migitation strategy suggested by MIPS for these processors is to use
hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

For LLD, this changes PLT stubs to use 'jalr.hb' and 'jr.hb'.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43488

Files:
  ELF/Arch/Mips.cpp
  ELF/Config.h
  ELF/Driver.cpp
  test/ELF/mips-26-n32-n64.s
  test/ELF/mips-plt-r6.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43488.134977.patch
Type: text/x-patch
Size: 5025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180219/c08442ce/attachment.bin>


More information about the llvm-commits mailing list