[PATCH] D146463: [CodeGen][RISCV] Change Shadow Call Stack Register to S11

Paul Kirth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 15:08:26 PDT 2023


paulkirth created this revision.
paulkirth added reviewers: asb, phosek, hiraditya, jrtc27, mcgrathr.
Herald added subscribers: jobnoorman, luke, Enna1, VincentWu, abrachet, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits, pcwang-thead, eopXD, MaskRay.
Herald added projects: clang, Sanitizers, LLVM.

ShadowCallStack implementation uses s2 register on RISC-V, but that
choice is problematic for reasons described in:

https://lists.riscv.org/g/sig-toolchains/message/544,
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/370, and
https://github.com/google/android-riscv64/issues/72

The concern over the register choice was also brought up in
https://reviews.llvm.org/D84414.

https://reviews.llvm.org/D84414#2228666 said:

  "If the register choice is the only concern about this work, then I think
  we can probably land it as-is and fixup the register choice if we see
  major drawbacks later. Yes, it's an ABI issue, but on the other hand the
  shadow call stack is not a standard ABI anyway.""

Since we have now found a sufficient reason to fixup the register
choice, we should go ahead and update the implementation. We propose
using s11 which seem like the best choice available.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146463

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  compiler-rt/test/shadowcallstack/lit.cfg.py
  llvm/include/llvm/TargetParser/RISCVTargetParser.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
  llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
  llvm/lib/Target/RISCV/RISCVSubtarget.cpp
  llvm/lib/TargetParser/RISCVTargetParser.cpp
  llvm/test/CodeGen/RISCV/reserved-regs.ll
  llvm/test/CodeGen/RISCV/shadowcallstack.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146463.506746.patch
Type: text/x-patch
Size: 14764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230320/77168b07/attachment-0001.bin>


More information about the cfe-commits mailing list