[PATCH] D18846: [safestack] Add canary to unsafe stack frames
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 14:02:20 PDT 2016
eugenis added inline comments.
================
Comment at: lib/CodeGen/SafeStack.cpp:504
@@ +503,3 @@
+ Constant *StackChkFail = F.getParent()->getOrInsertFunction(
+ "__stack_chk_fail", IRB.getVoidTy(), nullptr);
+ IRBFail.CreateCall(StackChkFail, {});
----------------
timshen wrote:
> timshen wrote:
> > 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.
> s/It has StackProtector::CreateFailBB/See StackProtector::CreateFailBB/.
SafeStack maintains a second stack, with the stack pointer either in a thread-local variable or a fixed TLS slot, and moves some locals to that stack.
Anything that may overflow is on the second stack. StackProtector + SafeStack should apply StackProtector cookies to that second stack, and not to the system stack.
It would be great to share more code between the two passes.
Would it be possible to extend the SDAG stuff to handle this case?
Repository:
rL LLVM
http://reviews.llvm.org/D18846
More information about the llvm-commits
mailing list