alexcrichton opened PR #12930 from alexcrichton:winch-spectre-fix to bytecodealliance:main:
This commit fixes a minor issue in the Winch backend when loading a value from a table when spectre mitigations are enabled. In this situation an extra comparison and conditional move is executed after the original bounds check and load to specifically handle the speculation case and ensure that out-of-bounds values can't be speculated on. The comparison performed on this path, however, was an incorrect one where it unconditionally used a 32-bit comparison. The comparison instead needs to use
bound_sizeto handle platform/table differences. This matches the actual bounds check, for example, which occurs prior to the spectre-related mitigation.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested cfallin for a review on PR #12930.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #12930.
alexcrichton requested wasmtime-core-reviewers for a review on PR #12930.
saulecabrera submitted PR review.
saulecabrera added PR #12930 winch: Fix spectre-related table indexing comparison size to the merge queue.
saulecabrera merged PR #12930.
saulecabrera removed PR #12930 winch: Fix spectre-related table indexing comparison size from the merge queue.
Last updated: Apr 12 2026 at 23:10 UTC