alexcrichton opened PR #11056 from alexcrichton:fix-miri-unsoundness to bytecodealliance:main:
This commit fixes another issue we've discovered in the wasip3 prototyping repository about a code pattern in wasm which Miri flags as un-sound. Specifically what happened was:
Invocation of WebAssembly went through
VMFuncRef::array_callwhich takes a&selfparameter.Inside of WebAssembly though a
ref.funcinstruction, or anything else that references the original exported function, will re-initialize theVMFuncRefwhich writes the&selfup the stack, which is not sound.Fixing this required changing the signature of
array_callfrom&selftome: NonNull<VMFuncRef>, and the signature was alreadyunsafeso this is a new unsafe contract for that signature.In fixing this, however, it was discovered that a mistake was made in #10943 where some internal functions for re-initializing a
VMFuncRefrelied on the previous signature of&mut selfbut that PR switche to&self. This PR corrects these signatures toPin<&mut Self>and then plumbs around the necessary changes, notably causing some refactoring in component-related bits.<!--
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 fitzgen for a review on PR #11056.
alexcrichton requested wasmtime-core-reviewers for a review on PR #11056.
fitzgen submitted PR review:
:+1:
fitzgen merged PR #11056.
Last updated: Dec 06 2025 at 06:05 UTC