[PATCH] Protection against stack-based memory corruption errors using SafeStack

Peter Collingbourne peter at pcc.me.uk
Wed May 20 16:59:58 PDT 2015


================
Comment at: lib/Transforms/Instrumentation/SafeStack.cpp:231
@@ +230,3 @@
+
+    UnsafeStackPtr = getOrCreateUnsafeStackPtr(M);
+
----------------
ksvladimir wrote:
> You can do a quick scan over all functions in a Module to check if any of them have Attribute::SafeStack, and only create the UnsafeStackPtr if it is the case. This way, the variable won't be created when -fsanitize=safe-stack is not used. You can also store the result of the scan in a class member variable and exit runOnFunction immediately when safestack is not needed.
Yes, there are many ways we could create the global on demand, but it's simplest to always create it if that works.

http://reviews.llvm.org/D6094

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list