[PATCH] D45303: shadowcallstack: Make runtime tests compatible with aarch64.

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 12:34:18 PDT 2018


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


================
Comment at: compiler-rt/test/shadowcallstack/minimal_runtime.h:39
+
+  // We can't simply return scs_main() because scs_main might have corrupted our
+  // return address for testing purposes (see overflow.c), so we need to exit
----------------
pcc wrote:
> vlad.tsyrklevich wrote:
> > Not sure I follow, if scs_main corrupted the RA don't we want to allow it to crash to satisfy the test? print_and_exit() also calls exit() directly so it shouldn't be required in that case.
> For aarch64 we don't crash on an RA mismatch, we just return to the address on the SCS. That means that when testing SCS + iterations=12 scs_main will return to main even though the RA on the stack is corrupted. Then when main, a non-SCS function, returns it will read the RA from the corrupted stack and return to it. We need to prevent that from happening because we want to simulate the behaviour when the entire system is built with SCS.
Ah, that makes sense.


https://reviews.llvm.org/D45303





More information about the llvm-commits mailing list