Stream: git-wasmtime

Topic: wasmtime / PR #12949 x64: Fix possible overflow in `Amode...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 14:19):

alexcrichton opened PR #12949 from alexcrichton:x64-fix-amode-offset-overflow to bytecodealliance:main:

This commit fixes an issue in the x64 backend of Cranelift where the Amode::offset method contained unchecked arithmetic meaning that it could possibly overflow. This in turn could lead to a miscompile of loading/storing 128-bit integers where this method is used to generate an Amode that is 8 bytes beyond the based address to load the upper bits. This miscompile isn't reachable from WebAssembly but is nonetheless still a good bugfix to have for Cranelift.

The fix here is to switch the Amode::offset method to being fallible, returning None on overflow. This then propagates up into ISLE where the amode_offset helper now has a separate case for when the addition fails, using lea to generate a register with an address in it. This then subsequently also needed fixing for various Atomic128* operations where instead of storing just a single SyntheticAmode they now store two, one for the address of the low bits and one for the address of the high bits.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 14:19):

alexcrichton requested fitzgen for a review on PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 14:19):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 14:48):

cfallin submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 14:48):

cfallin commented on PR #12949:

(cranelift-codegen unit tests for inst emission need updates wrt the new field I think)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:14):

alexcrichton updated PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:14):

alexcrichton commented on PR #12949:

@cfallin mind double-checking the most recent commit? Avoiding inflating Inst took a bit of finesse

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:21):

cfallin submitted PR review:

All the glue for the inst-arg boxing looks right to me; thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:24):

alexcrichton updated PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:24):

alexcrichton has enabled auto merge for PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 15:39):

alexcrichton added PR #12949 x64: Fix possible overflow in Amode::offset to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:05):

alexcrichton merged PR #12949.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:05):

alexcrichton removed PR #12949 x64: Fix possible overflow in Amode::offset from the merge queue


Last updated: Apr 12 2026 at 23:10 UTC