Stream: git-wasmtime

Topic: wasmtime / PR #10417 x64: fix misaligned load fault with ...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 17 2025 at 23:43):

abrown requested wasmtime-compiler-reviewers for a review on PR #10417.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 17 2025 at 23:43):

abrown requested fitzgen for a review on PR #10417.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 17 2025 at 23:43):

abrown opened PR #10417 from abrown:assembler-fix-10408 to bytecodealliance:main:

In [#10408], the new assembler re-opened an old issue related to unaligned loads with SSE instructions. SSE instructions expect 128-bit aligned loads when using the m128 operand and fault if that is not the case. This had been fixed previously by disallowing load-sinking for XmmMem ([#4891]) but more recently we had adopted the use of XmmMemAligned in cranelift-codegen. Since [#10316] had no knowledge of XmmMemAligned (only XmmMem), it caused the same kind fault--an OOB trap that was in fact an unaligned load.

Why didn't CI catch this? Since all the CI machines have AVX and we do not explicitly test the SSE-only case, these unaligned, sunk loads would use the AVX lowering in CI. AVX loads handle unaligned accesses without a fault. This was only discovered during fuzzing when AVX was disabled (i.e., --target x86_64-unknown-linux-gnu).

To fix this, this change adopts the XmmMemAligned type in the generated assembler code. This is temporary, though: a more lasting fix should pass along an "alignment required" bit from the assembler AST. In the meantime, this closes #10408.

[#10408]: https://github.com/bytecodealliance/wasmtime/issues/10408
[#4891]: https://github.com/bytecodealliance/wasmtime/pull/4891
[#10316]: https://github.com/bytecodealliance/wasmtime/pull/10316

<!--
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 (Mar 17 2025 at 23:44):

abrown requested alexcrichton for a review on PR #10417.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 18 2025 at 00:22):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 18 2025 at 02:13):

github-actions[bot] commented on PR #10417:

Subscribe to Label Action

cc @cfallin, @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "cranelift:meta", "isle"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Mar 18 2025 at 14:44):

alexcrichton merged PR #10417.


Last updated: Apr 18 2025 at 09:03 UTC