diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2014-07-25 19:31:34 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2014-07-25 19:31:34 +0000 |
commit | e5b6e0d2313cdd5b906bfeaf3968ff7fdd6438db (patch) | |
tree | d1258a082055dc5b5ea479d6e2072d795a281568 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | |
parent | a74e3f0c51487108c5b8afa54b83896a81660a43 (diff) | |
download | bcm5719-llvm-e5b6e0d2313cdd5b906bfeaf3968ff7fdd6438db.tar.gz bcm5719-llvm-e5b6e0d2313cdd5b906bfeaf3968ff7fdd6438db.zip |
[stack protector] Fix a potential security bug in stack protector where the
address of the stack guard was being spilled to the stack.
Previously the address of the stack guard would get spilled to the stack if it
was impossible to keep it in a register. This patch introduces a new target
independent node and pseudo instruction which gets expanded post-RA to a
sequence of instructions that load the stack guard value. Register allocator
can now just remat the value when it can't keep it in a register.
<rdar://problem/12475629>
llvm-svn: 213967
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 84679f98d84..cf0846f3430 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -397,7 +397,8 @@ private: class StackProtectorDescriptor { public: StackProtectorDescriptor() : ParentMBB(nullptr), SuccessMBB(nullptr), - FailureMBB(nullptr), Guard(nullptr) { } + FailureMBB(nullptr), Guard(nullptr), + GuardReg(0) { } ~StackProtectorDescriptor() { } /// Returns true if all fields of the stack protector descriptor are @@ -455,6 +456,9 @@ private: MachineBasicBlock *getFailureMBB() { return FailureMBB; } const Value *getGuard() { return Guard; } + unsigned getGuardReg() const { return GuardReg; } + void setGuardReg(unsigned R) { GuardReg = R; } + private: /// The basic block for which we are generating the stack protector. /// @@ -477,6 +481,9 @@ private: /// stack protector stack slot. const Value *Guard; + /// The virtual register holding the stack guard value. + unsigned GuardReg; + /// Add a successor machine basic block to ParentMBB. If the successor mbb /// has not been created yet (i.e. if SuccMBB = 0), then the machine basic /// block will be created. |