]> granicus.if.org Git - llvm/commit
[CodeGen] Don't resolve the stack protector frame accesses until PEI
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Thu, 25 Jul 2019 22:23:48 +0000 (22:23 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Thu, 25 Jul 2019 22:23:48 +0000 (22:23 +0000)
commitb1676ed4e4f9afc9d7689e0a744f7d1b5db4326d
treed11dbb06c3c015a433457eff5547e4903711bfc3
parent99818ae847feb7f1599aca161be34e60dd16d1f4
[CodeGen] Don't resolve the stack protector frame accesses until PEI

Currently, stack protector loads and stores are resolved during
LocalStackSlotAllocation (if the pass needs to run). When this is the
case, the base register assigned to the frame access is going to be one
of the vregs created during LocalStackSlotAllocation. This means that we
are keeping a pointer to the stack protector slot, and we're using this
pointer to load and store to it.

In case register pressure goes up, we may end up spilling this pointer
to the stack, which can be a security concern.

Instead, leave it to PEI to resolve the frame accesses. In order to do
that, we make all stack protector accesses go through frame index
operands, then PEI will resolve this using an offset from sp/fp/bp.

Differential Revision: https://reviews.llvm.org/D64759

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367068 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LocalStackSlotAllocation.cpp
test/CodeGen/AArch64/stack-guard-reassign.ll
test/CodeGen/ARM/stack-guard-reassign.ll
test/CodeGen/PowerPC/stack-guard-reassign.ll
test/CodeGen/Thumb/stack_guard_remat.ll