SebTardif opened PR #13704 from SebTardif:fix-guard-page-accounting to bytecodealliance:main:
Fix the bounds check in
VMContinuationStack::initializeto compare
against usable stack space rather than total allocation size.Prior to #13662,
initialize()had no bounds check at all, so a
high-arity function type (e.g. 600 params on an 8192-byte stack)
would unconditionally write control data into the guard page and
segfault. PR #13662 added a bounds check, but compared against
self.lenwhich for Mmap allocations includes the guard page. This
meant the 600-param case still slipped through:9664 <= 12288
passed the check, but the write still landed in the non-writable
guard page.This fix subtracts the guard page size for Mmap allocations so
the check reflects the actual usable stack space. Custom
allocations are unaffected since theirlendoes not include a
guard page.Adds a regression test matching the exact scenario from #13703
(600 params on an 8192-byte stack).Closes #13703
SebTardif requested cfallin for a review on PR #13704.
SebTardif requested wasmtime-core-reviewers for a review on PR #13704.
github-actions[bot] added the label wasmtime:api on PR #13704.
:memo: cfallin submitted PR review:
LGTM; thanks!
cfallin has enabled auto merge for PR #13704.
:thumbs_up: cfallin submitted PR review.
cfallin added PR #13704 Exclude guard page from stack bounds check in initialize to the merge queue.
:check: cfallin merged PR #13704.
cfallin removed PR #13704 Exclude guard page from stack bounds check in initialize from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC