[PATCH] D18846: [safestack] Add canary to unsafe stack frames

Tim Shen via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 13:34:09 PDT 2016


timshen added inline comments.

================
Comment at: lib/CodeGen/SafeStack.cpp:399
@@ +398,3 @@
+    StackGuardVar =
+        F.getParent()->getOrInsertGlobal("__stack_chk_guard", StackPtrTy);
+  return IRB.CreateLoad(StackGuardVar, "StackGuard");
----------------
Is this going to work correctly, for say, PowerPC? As of my knowledge on powerpc64le-linux-gnu, there is no "__stack_chk_guard", but similarly has a data member in TCB.

On SSP side I'm actively working on supporting PowerPC - more generally, allowing backends to lower LOAD_STACK_GUARD node manually.

================
Comment at: lib/CodeGen/SafeStack.cpp:504
@@ +503,3 @@
+  Constant *StackChkFail = F.getParent()->getOrInsertFunction(
+      "__stack_chk_fail", IRB.getVoidTy(), nullptr);
+  IRBFail.CreateCall(StackChkFail, {});
----------------
OpenBSD doesn't have __stack_chk_fail. It has StackProtector::CreateFailBB.

I wonder if it's easy to share some code between SSP and safestack, though I have no idea what safestack is doing.


Repository:
  rL LLVM

http://reviews.llvm.org/D18846





More information about the llvm-commits mailing list