[PATCH] D45239: AArch64: Implement support for the shadowcallstack attribute.

Vlad Tsyrklevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 4 14:28:40 PDT 2018


vlad.tsyrklevich accepted this revision.
vlad.tsyrklevich added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/docs/ShadowCallStack.rst:12
 ShadowCallStack is an **experimental** instrumentation pass, currently only
 implemented for x86_64, that protects programs against return address
 overwrites (e.g. stack buffer overflows.) It works by saving a function's return
----------------
Should also mention aarch64 here.


================
Comment at: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp:78
                                           CallingConv::ID CC) const {
+  bool SCS = MF.getFunction().hasFnAttribute(Attribute::ShadowCallStack);
   if (CC == CallingConv::GHC)
----------------
It's sort of a stretch to construct a scenario where this is likely to happen, but is it possible that a runtime function marked with `__attribute__((no_sanitize("shadowcallstack")))` would spill x18 across a function call because of this mask if it's referenced before and after? If that was a concern, we could make this test `hasAttr(SCS) || hasFlag(fFixedx18)`


https://reviews.llvm.org/D45239





More information about the cfe-commits mailing list