Skip to content

cranelift: avoid clobbering AArch64 stack-limit base on large offsets - #14981

Open
qiyuhuating wants to merge 2 commits into
bytecodealliance:mainfrom
qiyuhuating:fix/aarch64-stack-limit-chain-offset-14946
Open

qiyuhuating wants to merge 2 commits into
bytecodealliance:mainfrom
qiyuhuating:fix/aarch64-stack-limit-chain-offset-14946

Conversation

@qiyuhuating

Copy link
Copy Markdown

Fixes #14946.

Problem

When loading a nested stack_limit global value on AArch64, x16 may hold the base of the next load. Materializing a large offset into x16 destroys that base and yields a bad address or a crash.

Change

Use the reserved x17 temporary for offset materialization when the base register is x16; otherwise retain x16.

Regression coverage

Add a Cranelift .clif run test for nested stack-limit loads with large negative offsets, covering AArch64 and x86_64.

Validation

Not compiled or run locally. Please validate with Cranelift filetests and AArch64 CI before marking ready.

@qiyuhuating
qiyuhuating requested a review from a team as a code owner October 24, 2026 08:44
@qiyuhuating
qiyuhuating requested review from fitzgen and removed request for a team October 24, 2026 08:44
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:area:aarch64 Issues related to AArch64 backend. labels Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:aarch64 Issues related to AArch64 backend. cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aarch64: nested stack_limit global-value load with a large offset clobbers its own base register

1 participant