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

Peter Collingbourne peter at pcc.me.uk
Tue May 19 17:43:51 PDT 2015


================
Comment at: lib/Transforms/Instrumentation/SafeStack.cpp:542
@@ +541,3 @@
+
+  if (!UnsafeStackPtr)
+    UnsafeStackPtr = getOrCreateUnsafeStackPtr(*F.getParent());
----------------
kcc wrote:
> I am puzzled. Where is UnsafeStackPtr defined? 
> It should probably be defined at module init time, not here. 
The global is declared only if we see a function with the `safe_stack` attribute. I decided that it would be better to define it here rather than at module init time because the latter would cause the global to be declared in every module that the backend sees. This could be problematic if the target does not support thread local variables, for example.  (Although now that I've tried it, it does not appear to break any existing tests in `check-llvm`. Let's just move it to module-init and see what happens.)

http://reviews.llvm.org/D6094

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






More information about the llvm-commits mailing list