[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
[2 lines not shown]
[SCEV] Prove implied conditions via matching SCEV differences (#201839)
Add isImpliedCondOperandsViaMatchingDiff to fold equality comparisons
when getMinusSCEV(LHS, RHS) == getMinusSCEV(FoundLHS, FoundRHS).
This handles correlated IV comparisons in loops with multiple pointer
IVs sharing the same stride.
[libc] Migrate header .def files to public_includes (#206727)
Now that public_includes is supported in header yaml files, we don't
need custom .h.def templates just to include another header.
This patch removes link.h.def, string.h.def, and ucontext.h.def and
moves their inclusions directly into
their yaml definitions:
- link.yaml: add elf.h
- string.yaml: add strings.h
- sys/ucontext.yaml: add ucontext.h
Assisted by Gemini.
[libc++] Resolve LWG4366: Heterogeneous comparison of `expected` may be ill-formed (#185342)
Resolves #171362
- Implement proposed resolution
- Refactor `operator==` code to be more in line with the standard as the
current way was making an explicit `bool()` conversion in the `x.meow()
== y.meow()` cases
- Add test cases
- Update issues paper
---------
Co-authored-by: A. Jiang <de34 at live.cn>