[PATCH] D84414: [RISCV] Support Shadow Call Stack

Z. Zheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 16:25:30 PDT 2020


zzheng marked 2 inline comments as done.
zzheng added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:60
+  // sw   ra, 0(s2)
+  // addi s2, s2, 4
+  BuildMI(MBB, MI, DL, TII->get(IsRV64 ? RISCV::SD : RISCV::SW))
----------------
jrtc27 wrote:
> Is it intended that the shadow call stack grows *up* unlike the normal stack?
No. Which direction the SCS grows on is trivial.

The memory area hosting SCS is independent of the regular stack; and it's provided by the runtime.
mmap/malloc returns the low address of newly mapped/allocated area. Making the SCS growing down requires the runtime to return upper bound of the SCS. On AArch64, the SCS grows up as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84414/new/

https://reviews.llvm.org/D84414



More information about the cfe-commits mailing list