Stream: git-wasmtime

Topic: wasmtime / PR #13772 Avoid pointer offsets for JIT reloca...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 18:23):

HueCodes opened PR #13772 from HueCodes:hue-issue-7588 to bytecodealliance:main:

Fixes #7588.

CompiledBlob::perform_relocations` computed relocation targets with unsafe pointer offsets, then cast those pointers back to integers for relocation math.

This computes checked numeric target addresses up front with ptr.addr().checked_add_signed(...). The relocation math stays the same and unlike #8041 this does not use wrapping_offset.

Tested with cargo test -p cranelift-jit, cargo clippy -p cranelift-jit --all-targets --all-features -- -D warnings, and Cranelift filetests.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 18:23):

HueCodes requested alexcrichton for a review on PR #13772.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 18:23):

HueCodes requested wasmtime-compiler-reviewers for a review on PR #13772.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 20:23):

github-actions[bot] added the label cranelift on PR #13772.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 21:02):

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 21:02):

alexcrichton added PR #13772 Avoid pointer offsets for JIT relocation targets to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 21:26):

:check: alexcrichton merged PR #13772.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 21:26):

alexcrichton removed PR #13772 Avoid pointer offsets for JIT relocation targets from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 22:30):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2026 at 22:30):

:speech_balloon: bjorn3 created PR review comment:

This should have used expose_provenance, not addr. addr() doesn't allow dereferencing the address after turning it back into a pointer, yet that is exactly what the JITed code will likely do.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 01 2026 at 00:25):

HueCodes commented on PR #13772:

Thanks for the feedback. This is good learning for me.

That makes sense: these relocation values are not just opaque integers for comparison or range math. They can become addresses that JITed code later uses as pointers, so using addr() drops provenance information that should be exposed for that use case.

I prepared a follow-up that switches this helper to expose_provenance() while leaving the checked addend handling unchanged.


Last updated: Jul 29 2026 at 05:03 UTC