NicolasStigler opened PR #15072 from NicolasStigler:fix/aarch64-bti-indirect-targets to bytecodealliance:main:
Fixes #14938
Why
With BTI and pointer authentication enabled on AArch64, several indirect control-flow paths could trap with an illegal instruction. The affected cases include
br_tabledefaults, exception-handler targets, indirect tail calls, and tail-convention prologues usingpaciaz/pacibz.What changed
- Mark
br_tabledefaults and exception-handler targets as indirect branch targets so they receivebti j.- Emit
bti cbeforepaciaz/pacibzwhere needed.- Route indirect tail calls through
x16before branching.- Add and update AArch64 filetests and runtime configurations for BTI and pointer authentication.
Testing
cargo +1.97.0 fmt --all -- --checkcargo +1.97.0 clippy -p cranelift-codegen --all-targetscargo +1.97.0 test -p cranelift-codegencargo +1.97.0 test -p cranelift-filetestscargo +1.97.0 test -p cranelift-tools --test filetestscargo +1.97.0 test -p cranelift-tools --test logged-filetests- AArch64 Wasmtime WAST reproducers under QEMU with BTI and pointer-authentication enabled
NicolasStigler requested cfallin for a review on PR #15072.
NicolasStigler removed the review request for wasmtime-compiler-reviewers from PR #15072.
NicolasStigler requested wasmtime-compiler-reviewers for a review on PR #15072.
:memo: cfallin submitted PR review:
Thanks! A few thoughts below but overall looks good.
:speech_balloon: cfallin created PR review comment:
Can we do this only when PAC/BTI is enabled? I don't want to pessimize the case when it's not (e.g. default aarch64 Linux).
:speech_balloon: cfallin created PR review comment:
Let's make a note that this is the spill-temp register, which by Cranelift convention we are allowed to use as a scratch register within one VCode inst, so this is safe.
github-actions[bot] added the label cranelift on PR #15072.
github-actions[bot] added the label cranelift:area:machinst on PR #15072.
github-actions[bot] added the label cranelift:area:aarch64 on PR #15072.
NicolasStigler updated PR #15072.
NicolasStigler commented on PR #15072:
Would it be better if i made a new PR or its fine adding a commit to this branch? If a new PR is preferred I can squash both commits in one.
:memo: NicolasStigler submitted PR review.
:speech_balloon: NicolasStigler created PR review comment:
The mov is now gated on use_bti(), so the default aarch64 path doesnt pay an extra instruction.
NicolasStigler edited a comment on PR #15072:
Would it be better if i made a new PR or its fine adding a commit to this branch? If a new PR is preferred I can squash both commits in one. Im asking because I reverted the unnecesary expectation changes in return-call, call-pauth and tail-call-grow-frame*.
cfallin commented on PR #15072:
Would it be better if i made a new PR or its fine adding a commit to this branch? If a new PR is preferred I can squash both commits in one. Im asking because I reverted the unnecesary expectation changes in return-call, call-pauth and tail-call-grow-frame*.
No, adding commits here to address review feedback is the expected path -- the intent of a review is to say "add these bits and it'll be good". Thanks!
:thumbs_up: cfallin submitted PR review.
cfallin has enabled auto merge for PR #15072.
cfallin added PR #15072 cranelift: aarch64: fix BTI landing pads for indirect control flow to the merge queue.
:check: cfallin merged PR #15072.
cfallin removed PR #15072 cranelift: aarch64: fix BTI landing pads for indirect control flow from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC