[all-commits] [llvm/llvm-project] 429afa: [aarch64] Mix the frame pointer with the stack coo...
Pan Tao via All-commits
all-commits at lists.llvm.org
Wed Jul 1 00:34:17 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 429afacb27aaa0ce66920e9cbab47028d182bd8b
https://github.com/llvm/llvm-project/commit/429afacb27aaa0ce66920e9cbab47028d182bd8b
Author: Pan Tao <tao.pan at intel.com>
Date: 2026-07-01 (Wed, 01 Jul 2026)
Changed paths:
M llvm/include/llvm/CodeGen/TargetLowering.h
M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M llvm/lib/CodeGen/StackProtector.cpp
M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
M llvm/lib/Target/AArch64/AArch64ISelLowering.h
M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
M llvm/lib/Target/AArch64/AArch64InstrInfo.td
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/lib/Target/X86/X86ISelLowering.h
M llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-stack-protector-windows.ll
M llvm/test/CodeGen/AArch64/arm64ec-indirect-call.ll
M llvm/test/CodeGen/AArch64/mingw-refptr.ll
M llvm/test/CodeGen/AArch64/stack-protector-target.ll
Log Message:
-----------
[aarch64] Mix the frame pointer with the stack cookie when protecting the stack (#197346)
For MSVC-compatible targets on AArch64, mix the stack cookie with the
frame pointer (FP) to create a position-dependent guard value. This
strengthens protection against attacks where the attacker knows or can
predict the cookie value, as they would also need to know the exact
frame pointer location.
Implementation details:
- Uses SUB (FP - Cookie) instead of XOR like X86 because:
* SUB maintains the existing AArch64 instruction selection patterns
* SUB provides equivalent security properties (bijective mixing)
* The result is still unpredictable without knowing both inputs
- The same SUB operation is performed in both prologue (to store the
mixed value) and epilogue (to unmix and verify the cookie)
- Forces frame pointer usage for functions with stack guards on MSVCRT
to ensure consistent addressing with dynamic stack allocation
This matches the MSVC behavior and strengthens stack protection on
AArch64 Windows platforms.
Fixes #156573.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list