W7e: wasm-preferred dispatch + compile-on-demand; harden unit ABI validator
- Dispatch (linux_fastcgi.cpp): route every request through wasm. On a cold/stale artifact, compile the unit on demand (get_shared_unit, forced) and serve wasm; native compiler_invoke* remains only as a fallback when wasm cannot be made ready (compile failure / backend disabled). Applies to the 4 handle_complete branches and the CLI socket path. - backend.cpp: delete the now-vestigial native-only fallback token gate (wasm_backend_native_fallback_*), empty since W7d; should_handle now gates on config + current artifact + healthy worker only. - check_unit_wasm.py: skip the defense-in-depth llvm-nm allocator scan when llvm-nm SIGSEGVs on a degenerate-but-valid module (e.g. a unit with no exported handlers). Fixes site/demo/empty.uce, the last unit that could not produce a .wasm; forbidden allocator *exports* are still rejected. A pi-assisted review caught that the compile-freshness check keys off the .so mtime only, so force_recompile is required to rebuild a missing/stale .wasm; a unit already cached in-process whose .wasm later vanished still uses native fallback (closed in W7e stage B). Native execution is otherwise bypassed for all real traffic. Verified: scripts/run_cli_tests.sh --include-wasm-kill -> 87 passed, 0 failed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,14 @@ def dylink_has_valid_mem_info(payload: bytes) -> bool:
|
||||
def defined_symbols(path: Path, llvm_nm: str) -> list[str]:
|
||||
proc = subprocess.run([llvm_nm, "--defined-only", str(path)], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if proc.returncode != 0:
|
||||
# llvm-nm (wasi-sdk) can SIGSEGV on degenerate-but-valid modules — e.g. a
|
||||
# unit with no exported handlers (`empty.uce`). A toolchain crash is not
|
||||
# evidence of a forbidden allocator, so skip this defense-in-depth scan
|
||||
# rather than fail the unit; forbidden allocator *exports* are still
|
||||
# rejected by the export-section check above.
|
||||
crashed = proc.returncode < 0 or "Stack dump:" in proc.stderr or "PLEASE submit a bug report" in proc.stderr
|
||||
if crashed:
|
||||
return []
|
||||
raise RuntimeError(proc.stderr.strip() or "llvm-nm failed")
|
||||
symbols = []
|
||||
for line in proc.stdout.splitlines():
|
||||
|
||||
Reference in New Issue
Block a user