Stream: git-wasmtime

Topic: wasmtime / PR #10819 x64: Fix encoding of RIP-relative ad...


view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:12):

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

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:12):

alexcrichton opened PR #10819 from alexcrichton:fix-rip-relative-addressing to bytecodealliance:main:

This commit fixes a bug in the new assembler which was surfaced through the changes in #10782 but was a pre-existing issue. Specifically the encoding of a RIP-relative addressing mode required knowing the number of bytes at the end of an instruction but this was accidentally hardcoded to 0. In #10782 imul instructions were added where a RIP-relative address mode can be used in conjunction with an immediate which cause the RIP-relative addressing to load from the wrong address.

This bug can in theory affect other instructions in the new assembler as well, but auditing the list of instructions it looks like imul is the only one that can possibly have an immediate after a RIP-relative addressing mode. That means that prior instructions using the new assembler should not be affected.

<!--
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 (May 20 2025 at 21:12):

alexcrichton requested abrown for a review on PR #10819.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:42):

abrown submitted PR review:

LGTM!

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:43):

abrown submitted PR review:

LGTM! (Though it looks like something will need to change relative to pretty-printing...)

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:45):

alexcrichton updated PR #10819.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 21:46):

alexcrichton commented on PR #10819:

@abrown mind double-checking the last commit I just added?

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:03):

abrown submitted PR review:

Yeah, there must surely be a different way to sort this all out but this is great for now.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:03):

abrown created PR review comment:

    /// of the offset, is added to what's already present in the encoding buffer.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:03):

abrown created PR review comment:

    /// pretend the label is found at the end of the `buf`. That means that the

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:03):

abrown created PR review comment:

    /// distance from the label to the end of `buf` minus 4, which is the width

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:20):

alexcrichton updated PR #10819.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 22:20):

alexcrichton has enabled auto merge for PR #10819.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2025 at 23:02):

alexcrichton merged PR #10819.


Last updated: Dec 06 2025 at 07:03 UTC