ports/devel/llvm80/files/patch-llvm-r367068.diff
Brooks Davis 9409eb97ab Address a code generation bug that could allow the ARM stack protector
to be bypassed.

This change merges upstream r366369, r366371, and r267068 (minus some
test improvements).

Also:
 - Address bugs breaking the build with all options disabled. [0]
 - Pin the python version to 3.6 rather than 2.7.

PR:		239503 [0]
Security:	https://kb.cert.org/vuls/id/129209
2019-08-01 23:27:30 +00:00

19 lines
812 B
Diff

Index: lib/CodeGen/LocalStackSlotAllocation.cpp
===================================================================
--- lib/CodeGen/LocalStackSlotAllocation.cpp
+++ lib/CodeGen/LocalStackSlotAllocation.cpp
@@ -351,6 +351,14 @@
assert(MFI.isObjectPreAllocated(FrameIdx) &&
"Only pre-allocated locals expected!");
+ // We need to keep the references to the stack protector slot through frame
+ // index operands so that it gets resolved by PEI rather than this pass.
+ // This avoids accesses to the stack protector though virtual base
+ // registers, and forces PEI to address it using fp/sp/bp.
+ if (MFI.hasStackProtectorIndex() &&
+ FrameIdx == MFI.getStackProtectorIndex())
+ continue;
+
LLVM_DEBUG(dbgs() << "Considering: " << MI);
unsigned idx = 0;