feat(parser): wasm parser-module loader, hardening, and authoring target (0.23.0) — postponed - #173
feat(parser): wasm parser-module loader, hardening, and authoring target (0.23.0) — postponed#173facontidavide wants to merge 2 commits into
Conversation
8dfaa32 to
6bc55f6
Compare
ad01f03 to
babd073
Compare
6bc55f6 to
d02344d
Compare
0279ed5 to
21f11b7
Compare
babd073 to
4e42f8b
Compare
21f11b7 to
93931f0
Compare
…0.22.0) SDK core of the parser-extensibility v4 architecture (spec: pj-official-plugins PR #272) — the complete wasmer-free surface, with the dual-target module ABI frozen here: - pj.parser_route_claims.v1 extension: exact handler-table route claims (scalar/object, exact-only match), auto-implemented by MessageParserPluginBase from its handler table; delivery via get_plugin_extension, zero layout changes - pj.parser_functional.v2: object sink gains accept_object_spliced (one splice per object, input-space offsets, frozen per-type eligibility table in builtin_object_abi.h); frozen error-kind constants; v1 byte-identical - parser_module_abi.h: frozen pj_module_* export ABI (u64 module-space tokens, token-0 creation-error channel, 512-byte error buffer) + bounds-checked little-endian codecs for BindingInfo / parse-input / output-descriptor blocks - host claim catalog + route resolver: §4 admission matrix (priority bounds, wildcard/object rules, encoding registry, duplicate identity, provenance never from manifests), module-manifest ingestion, synthesized plugin claim ids (wildcard:<encoding>, handler:<encoding>:<type>), §5 selection (pin fail-closed → exact > wildcard → provenance tier → priority → identity tie-break) with split per-route probe caches and selection traces - native module loader (dlopen RTLD_LOCAL|RTLD_NOW, per-handle export resolution, session never-unload) + module runtime over the codecs with splice eligibility/bounds validation and the fault-vs-data-error strike tracker (3 strikes → quarantine → recreate; repeat → session disable) - authoring kit pj_base/include/pj_base/parser_module/: header-only, C++17, wasi-clean (own Status/Expected/arena; -fno-exceptions capable); CdrReader + CdrFieldLocator (XCDR1 traversal plans, depth caps, bounds), ProtoReader + ProtoFieldLocator, checked time normalization, canonical-wire ObjectWriter (PointCloud/Image + splice path), pj::FunctionalParser + PJ_FUNCTIONAL_PARSER macro, pj_add_parser_module() native target - wasm manifest custom-section codec (shared embed/read; 1b's tooling wraps it) + static wasm ABI conformance: wasi-sdk 27 reactor build of the same toy module, binary-format audit of export names/signatures, reactor model, and single manifest section — no wasmer, gated on PJ_WASI_SDK_ROOT, wired into linux CI Tests: 75/75 Debug+ASAN (74 with the wasm gate skipped), incl. layout sentinels, golden byte fixtures, adversarial loader/runtime fixtures, and a kit-authored module E2E (load → admit → bind → full + spliced PointCloud). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4e42f8b to
08503f7
Compare
93931f0 to
f977260
Compare
…get (0.23.0) SDK PR 1b of the parser-extensibility v4 architecture (spec: pj-official-plugins PR #272), stacked on the core PR: a second loader for the already-frozen module ABI — wasmer execution, hardening, and the wasm authoring target. Ships as its own 0.23.0 release: the core PR lands first as 0.22.0 and this one follows, so an SDK with the wasm loader is distinguishable from one without it. - wasmer 7.0.1 statically linked (pinned; required only by the plugin_host component — plugin_sdk consumers stay wasmer-free). Exit-criterion prototype findings encoded in the loader contract: the pinned static lib exports no wasm_module_share/obtain symbols (engine-owned module reuse: one compilation, store-per-bound-instance with isolated state) and no creator-thread affinity exists — calls are sequential-only, host-serialized. Pin re-evaluated against 7.2.1: no C-API gains, WASI-syscall CVEs unreachable under the empty import allow-list, and 7.2 drops x86_64-darwin (rationale in ARCHITECTURE.md) - wasm loader: validation before any instantiation — manifest custom section via the shared codec (exactly one), reactor model enforced (_initialize required, start section/_start rejected), operational export set verified by name AND signature through the shared pj_base wasm inspector, and a frozen EMPTY import allow-list (a parser module may import nothing) - execution runtime: metered store-per-instance calls (the pinned lib exports the wasmer_metering_* C API but no interrupt/epoch/deadline surface, so limits are enforceable instruction metering — fresh point allowance per guest call, exhaustion = distinct contract violation), linear-memory base re-acquired at every point of use with overflow-safe bounds, splices resolved against the original host payload, shared fault taxonomy + strike tracker with quarantine replay - memory caps at validation: artifacts must declare a linear-memory maximum (default cap 256 MiB); the engine enforces it at runtime. Aggregate session budgets (modules, artifact size, claims, active instances, declared memory) gate admission with DECLINE and mutate nothing on rejection - adversarial fixtures: unreachable trap, metered infinite loop, memory-growth bomb, admission limits, quarantine replay — plus the M1 rejection matrix - pj-wasm-embed-manifest installed CLI (embed/verify) wrapping the shared section codec; pj_add_parser_module(... TARGETS native wasm) builds both artifacts from one source with post-link audit, dogfooded on the toy module - fix: release the metering middleware on the adapter-failure path - VERSION 0.23.0, CHANGELOG entry, CI wasmer job (metering-symbol check) Tests: 79/79 Debug+ASAN with both toolchain roots; graceful skip verified for each root independently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f977260 to
878cb93
Compare
|
Postponed — the core PR (#172) merges first on its own as This was the explicit rationale for splitting the SDK work in two: 1b is a second loader for an ABI that #172 already freezes, so deferring wasm delays wasm, never the architecture. Nothing here blocks #172, and #172 ships a complete native module story on its own. State of this branch while it waits:
🤖 Generated with Claude Code |
08503f7 to
3501581
Compare
|
Note for revival: When picking this back up, after #172 merges: rebase onto Deliberately not rebased now to avoid resolving those conflicts twice. 🤖 Generated with Claude Code |
3501581 to
817130e
Compare
SDK PR 1b of the parser-extensibility v4 architecture (spec, PlotJuggler/pj-official-plugins#272) — stacked on #172 (
feat/parser-extensibility-1a). A second loader for the already-frozen ABI: wasmer execution, hardening, budgets, and the wasm authoring target. Merge #172 first; this PR then retargets tomain. Per maintainer decision the stack carries a single version increment: this PR keeps VERSION at 0.22.0 and folds its changelog into the 0.22.0 entry (no 0.23.0).Exit-criterion prototype findings (spec §13 gate)
libwasmer.a(7.0.1, static) declares but does not exportwasm_module_share/obtain— the loader uses engine-owned module reuse: one compilation, store-per-bound-instance, isolated state verified.wasmer_metering_*C API but no interrupt/epoch/deadline surface — execution limits are enforceable instruction metering (fresh allowance per guest call), not a wall-clock watchdog that couldn't fire.Surface
_initialize; start/_startrejected), export names and signatures audited via the sharedpj_basewasm inspector, empty frozen import allow-list (a parser module may import nothing)pj-wasm-embed-manifestinstalled CLI (embed/verify);pj_add_parser_module(... TARGETS native wasm)builds both artifacts from one source with a post-link audit — dogfooded on the toy moduleplugin_hostcomponent;plugin_sdkconsumers stay wasmer-free.PJ_WASMER_ROOTgate with graceful skip; CI installs wasmer 7.0.1 and runs the wasmer-labeled testsVerification
🤖 Generated with Claude Code