Repository navigation
Fix ARM64 light-mode JIT reading below the stack pointer - #365
Open
thomasbuilds wants to merge 1 commit into
Open
thomasbuilds wants to merge 1 commit into
thomasbuilds wants to merge 1 commit into
Conversation
thomasbuilds
marked this pull request as draft
October 22, 2026 16:50
thomasbuilds
force-pushed
the
fix-arm64-light-stack-read
branch
from
October 22, 2026 16:57
74b5364 to
553f312
Compare
thomasbuilds
marked this pull request as ready for review
October 22, 2026 16:58
Contributor
Author
|
(ci failures are unrelated to my change) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In light mode, the ARM64 JIT computes each Dataset item into a 96-byte stack frame, frees the frame with
add sp, sp, 96, and only then reads the item. AAPCS64 has no red zone so a signal delivered in between can overwrite the item and produce a wrong hash. FreeBSD, NetBSD and OpenBSD write their signal frame right belowsp; Linux only overwrites the item when large SVE or SME state extends the frame; macOS keeps a 128-byte red zone and isn't affected.This reserves the 96 bytes once in the prologue instead, by growing the existing
str x0, [sp, -16]!tostr x0, [sp, -112]!(and the epilogue'sldrto match), so the item stays allocated until it is read.