Skip to content

Fix expression depth limits, WASI access checks, and validation diagnostics - #838

Merged
LunaStev merged 9 commits into
wavefnd:masterfrom
LunaStev:fix/pre-release-stability-followups
Oct 2, 2026
Merged

LunaStev merged 9 commits into
wavefnd:masterfrom
LunaStev:fix/pre-release-stability-followups

Conversation

@LunaStev

@LunaStev LunaStev commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Limit expression nesting to 128 levels and return source-located compiler errors before recursive frontend processing. Check generated trees before HIR lowering, reduce parser/verifier/specialization frame sizes, including struct-literal error paths, and serialize expression records iteratively.
  • Implement WASI file-access checks with only the requested read/write rights, non-destructive open/close, and unchanged host errno. Reject unsupported modes and file types explicitly.
  • Report unresolved WebAssembly host imports before instantiation, naming the imports and explaining the need for an explicit JavaScript host in both human and JSON diagnostics.
  • Validate artifacts before accepting an expected nonzero program exit, and normalize repository-relative maintainer paths before matching.
  • Synchronize FreeBSD loader input with character echoes instead of relying on fixed delays before submitting boot commands.
  • Terminate the WASI smoke host with the guest exit status when the command completes, including when Node host handles remain open.

Motivation

Deep expressions could overflow the compiler stack, WASI access modes were ignored, missing host imports produced raw runtime errors, expected exits bypassed artifact checks, and equivalent paths could miss their maintainer section. Each fix is recorded in a separate signed-off commit.

Closes #818
Closes #756
Closes #712
Closes #453
Closes #813

Target and compatibility impact

  • Expressions above 128 levels are rejected in check, build, and AST-output paths. Existing JSON diagnostic fields and AST schema remain unchanged. No OS or compiler stack limit is increased.
  • AST serialization uses a bounded 512-container writer budget after expression validation; the default WSON parser/writer limit remains 256.
  • WASI F_OK checks existence. Regular-file R_OK/W_OK require all requested rights; X_OK and unsupported file types return -58, unknown mode bits return -28, and actual WASI errors are preserved. Bounded path scanning also avoids introducing a libc strlen dependency during optimization.
  • Missing-import diagnostics apply to wasm32 unknown, wasm64 unknown, and wasm32 WASI execution. Existing guest output and exit-status behavior are preserved.
  • No ABI changes or new external runtime dependencies. Compiler and standard-library license boundaries remain intact.

Validation

Local validation on Linux amd64 with Rust 1.89 and LLVM 21:

  • cargo +1.89 test --jobs 2 --workspace: 368 tests passed. The existing TCP fixture was rerun with local loopback sockets available after a sandbox-restricted failure; the complete run passed.
  • cargo +1.89 clippy --jobs 2 --workspace --all-targets -- -D warnings: passed.
  • cargo +1.89 fmt --all -- --check and git diff --check: passed.
  • The full Python tooling suite passed before the follow-up fixes (222 tests, 27 environment-dependent skips). The affected CI and FreeBSD runner modules were rerun after the changes: 33 tests passed, including two new loader-input regressions.
  • node tools/test_wasm_host.mjs: six tests passed.
  • Boundary regressions cover 128, 129, and 5,000 levels across expression shapes and driver entry points, plus generated HIR input and parser-budget recovery after errors.
  • An additional parser regression checks struct depths 128/129/5,000 on a 768 KiB thread stack through both parser entry points. It also passes as a Windows GNU binary under Wine; native MSVC validation remains in CI.
  • The debug-compiler boundary regression now enforces a 1 MiB child-process stack on Linux across check, object build, and AST JSON output. It accepts 128 levels and rejects 129/5,000 levels, including non-folded bitwise unary chains; Windows keeps its native stack settings.
  • WASI smoke-host regressions retain a Node timer and verify explicit guest exits 7/0 and normal command return. All three terminate with the correct status. The actual examples/wasm_wasi.wave smoke program also builds and runs successfully.
  • WASI access fixtures ran at O0/O2 with controlled host errors and the real Node WASI host, including unchanged file contents and revoked PATH_OPEN capability.
  • FreeBSD loader regressions check one unacknowledged character at a time and reject incomplete echoed commands. A fresh overlay of the pinned, SHA256-verified FreeBSD 14.3 amd64 image reached the single-user shell under QEMU TCG with the updated loader handshake; provider execution remains covered by CI.
  • Missing-import diagnostics ran in human/JSON modes on all three WebAssembly targets. Native OS-specific execution remains covered by PR CI.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

…ssing

Limit expressions to 128 levels across parsing, generated AST validation, HIR lowering, and AST output. Preserve source-located diagnostics and reduce recursive frame sizes without changing stack limits.

Fixes wavefnd#818

Signed-off-by: LunaStev <[email protected]>
Preserve WASI errno, reject unsupported modes and file types, and verify requested read/write rights through open and close. Exercise host failures and unchanged file contents at O0 and O2.

Fixes wavefnd#756

Signed-off-by: LunaStev <[email protected]>
Identify missing imports before instantiation and preserve human and JSON command-error formats across wasm32, wasm64, and WASI execution.

Fixes wavefnd#453

Signed-off-by: LunaStev <[email protected]>
Fold unary prefixes iteratively and separate recursive operand evaluation from numeric conversion, signature resolution, and ABI transport temporaries. Run the driver boundary regression with a 1 MiB Linux child stack so debug builds exercise the Windows constraint. Preserve the 128-level limit and existing operation semantics.

Signed-off-by: LunaStev <[email protected]>
Return guest proc_exit to the host and explicitly exit with its status instead of waiting for remaining Node handles. Cover successful and failing proc_exit plus normal _start return with a retained host timer.

Signed-off-by: LunaStev <[email protected]>
@LunaStev
LunaStev merged commit 88e4303 into wavefnd:master Oct 2, 2026
26 checks passed
@LunaStev LunaStev mentioned this pull request Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant