Skip to content

Commit

Permalink
Set shadowstack to be thread local global variable.
Browse files Browse the repository at this point in the history
Thread-local stack is essential to avoid race conditions
where threads share the same global state.
  • Loading branch information
Pavel-Durov committed Oct 15, 2023
1 parent ca1842c commit 3b07c59
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Yk/ShadowStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class YkShadowStack : public ModulePass {
// allocated for the shadow stack.
Constant *GShadowStackPtr = M.getOrInsertGlobal(G_SHADOW_STACK, Int8PtrTy);
GlobalVariable *GVar = M.getNamedGlobal(G_SHADOW_STACK);
GVar->setThreadLocal(true);
GVar->setInitializer(
ConstantPointerNull::get(cast<PointerType>(Int8PtrTy)));

Expand Down

0 comments on commit 3b07c59

Please sign in to comment.