alexcrichton opened PR #13657 from alexcrichton:fix-nostd-fiber-alignment to bytecodealliance:main:
This commit adjust how fiber stacks are allocated/aligned to 16 byte boundaries in the nostd implementation of fibers. This was found where testing as-is with MIRI flags UB where an unaligned pointer write happens. This occurs because while the base pointer of a stack is aligned it means that the size of the stack is not aligned, producing an unaligned "top addr".
The fix in this commit is to change the element type of the stack to a type that naturally has an alignment of 16, so unaligned allocations aren't possible in the first place. Unfortunately this can't be added to CI, however, because the nostd implementation of fibers requires the 'stackswitch' module which Miri does not support, and the Miri implementation of fibers is backed by threads and doesn't do any of this. For now this'll end up just being manually verified as "no Miri errors until it executes
naked_asm!".<!--
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 pchickey for a review on PR #13657.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13657.
:thumbs_up: pchickey submitted PR review.
alexcrichton added PR #13657 Adjust stack alignment in nostd fibers to the merge queue.
:check: alexcrichton merged PR #13657.
alexcrichton removed PR #13657 Adjust stack alignment in nostd fibers from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC