aboutsummaryrefslogtreecommitdiff
path: root/maintainer-scripts/ChangeLog
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-09-12 16:05:11 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-09-12 16:05:11 +0100
commitfee0a18abfdd4874194abd149943fa7c77a29b7c (patch)
tree725bbb523efcdd7f6f616dda1b9c9134bc137f16 /maintainer-scripts/ChangeLog
parent1785b8077cc03214ebd1db953c870172fcf15966 (diff)
downloadgcc-fee0a18abfdd4874194abd149943fa7c77a29b7c.zip
gcc-fee0a18abfdd4874194abd149943fa7c77a29b7c.tar.gz
gcc-fee0a18abfdd4874194abd149943fa7c77a29b7c.tar.bz2
aarch64: Put LR save probe in first 16 bytes
-fstack-clash-protection uses the save of LR as a probe for the next allocation. The next allocation could be: * another part of the static frame, e.g. when allocating SVE save slots or outgoing arguments * an alloca in the same function * an allocation made by a callee function However, when -fomit-frame-pointer is used, the LR save slot is placed above the other GPR save slots. It could therefore be up to 80 bytes above the base of the GPR save area (which is also the hard fp address). aarch64_allocate_and_probe_stack_space took this into account when deciding how much subsequent space could be allocated without needing a probe. However, it interacted badly with: /* If doing a small final adjustment, we always probe at offset 0. This is done to avoid issues when LR is not at position 0 or when the final adjustment is smaller than the probing offset. */ else if (final_adjustment_p && rounded_size == 0) residual_probe_offset = 0; which forces any allocation that is smaller than the guard page size to be probed at offset 0 rather than the usual offset 1024. It was therefore possible to construct cases in which we had: * a probe using LR at SP + 80 bytes (or some other value >= 16) * an allocation of the guard page size - 16 bytes * a probe at SP + 0 which allocates guard page size + 64 consecutive unprobed bytes. This patch requires the LR probe to be in the first 16 bytes of the save area when stack clash protection is active. Doing it unconditionally would cause code-quality regressions. Putting LR before other registers prevents push/pop allocation when shadow call stacks are enabled, since LR is restored separately from the other callee-saved registers. The new comment doesn't say that the probe register is required to be LR, since a later patch removes that restriction. gcc/ * config/aarch64/aarch64.cc (aarch64_layout_frame): Ensure that the LR save slot is in the first 16 bytes of the register save area. Only form STP/LDP push/pop candidates if both registers are valid. (aarch64_allocate_and_probe_stack_space): Remove workaround for when LR was not in the first 16 bytes. gcc/testsuite/ * gcc.target/aarch64/stack-check-prologue-18.c: New test. * gcc.target/aarch64/stack-check-prologue-19.c: Likewise. * gcc.target/aarch64/stack-check-prologue-20.c: Likewise.
Diffstat (limited to 'maintainer-scripts/ChangeLog')
0 files changed, 0 insertions, 0 deletions