[PATCH] D154911: Enabling fstack_clash_protection for arm32 bit, thumb and thumb2 mode

Varun Kumar E via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 17:56:48 PDT 2023


varunkumare99 created this revision.
varunkumare99 added reviewers: tnfchris, efriedma, kristof.beyls, serge-sans-paille.
Herald added a subscriber: hiraditya.
Herald added a project: All.
varunkumare99 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

adds stack probing instruction sequence for dynamic stack allocations, VLA's and constant arrays to protect against stack clash attacks.

Depending on the size of the stack allocation, various probing sequences are generated:

- straight line sequence of subtracts and stores
- A loop allocating and probing one page size per iteration, plus a single probe to deal with the remainder.
- A loop which moves the SP down to the target value held in a register, used when the allocation size is not known at compile-time

reference: https://reviews.llvm.org/D96004


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154911

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
  llvm/lib/Target/ARM/ARMFrameLowering.cpp
  llvm/lib/Target/ARM/ARMFrameLowering.h
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.h
  llvm/lib/Target/ARM/ARMInstrInfo.td
  llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
  llvm/lib/Target/ARM/Thumb1FrameLowering.h
  llvm/test/CodeGen/ARM/stackProbing_arm.ll
  llvm/test/CodeGen/ARM/stackProbing_thumb.ll
  llvm/test/CodeGen/Thumb2/stackProbing_thumb2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154911.538882.patch
Type: text/x-patch
Size: 70577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230711/1bdf7af2/attachment-0001.bin>


More information about the cfe-commits mailing list