Skip to content

Navigation Menu

Sign up

AArch64: make sure SP is 16-aligned at all times during Pallocframe - #617

Merged
xavierleroy merged 1 commit into
master from
aarch64-frame-alignment
Nov 24, 2026
Merged

xavierleroy merged 1 commit into
master from
aarch64-frame-alignment

Conversation

@xavierleroy

@xavierleroy xavierleroy commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

SP-relative accesses crash if SP mod 16 != 0. This could happen before when setting up the stack frame, in the case where the outgoing arguments area of the frame has size = 8 mod 16. Then, the store of the return address and the back link would take place with SP = 8 mod 16 and crash, before SP is further decreased to a multiple of 16.

This commit avoids this problem by aligning the size of the outgoing arguments area to 16.

Fixes: #614
Closes: #615

SP-relative accesses crash if SP mod 16 != 0. This could happen before
when setting up the stack frame, in the case where the outgoing arguments area
of the frame has size = 8 mod 16. Then, the store of the return address
and the back link would take place with SP = 8 mod 16 and crash, before
SP is further decreased to a multiple of 16.
This commit avoids this problem by aligning the size of the outgoing arguments
area to 16.
Fixes: #614
Closes: #615 
xavierleroy merged commit 494c597 into master Nov 24, 2026
19 checks passed
xavierleroy deleted the aarch64-frame-alignment branch November 24, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

aarch64 (macOS): misaligned SP in the prologue of a function with a frame > 512 bytes that passes 1–8 bytes of stack arguments → SIGBUS

1 participant

AltStyle によって変換されたページ (->オリジナル) /