Repository navigation
fix(m2): address independent audit findings (P1, P2, safe P3) - #15
Merged
Merged
Conversation
…V-12) `LinuxBackend::read_cooked_shader` used `fs::read`, loading the whole file before `CookedShader::decode_named` enforced `MAX_COOKED_SHADER_BYTES`. A 512 MiB artifact raised peak RSS from 83 MiB to 558 MiB, and a symlink to a character device such as `/dev/zero` would grow without bound. Add `read_cooked_shader_bounded` in `src/options.rs` (always compiled, so it is tested headlessly on Linux and Windows): it rejects non-regular files and files whose metadata size exceeds the cap with `ENGN-0008`, then reads at most `MAX + 1` bytes so files that grow during the read are still rejected. Verified: unit tests (sparse MAX+1, exact cap, directory, missing file, `/dev/zero`); 512 MiB probe now fails with ENGN-0008 at 83 MiB peak RSS. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…V-001)
FND-T09 and F3D-T13 derived `spawn-*` edges from a hand-written TOML line
parser that silently missed valid Cargo forms: `[dependencies.<name>]`
tables, renamed dependencies (`alias = { package = "<name>" }`), and
`[build-dependencies]`. An engine crate could depend upward on
`spawn-engine` or a tool without either test failing.
Both tests now share `tests/common/graph.rs`, which takes direct edges from
Cargo's resolver (`cargo tree --workspace --invert <pkg> -e normal,build
--target all --depth 1`), so every manifest form and every target is
covered. The duplicated parsers and acyclicity helpers are removed, and
F3D-T13 now also asserts no upward edges.
Verified: new synthetic regression test; injecting each of the three forms
into crates/spawn-ecs/Cargo.toml makes FND-T09 and F3D-T13 fail (reverted).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (F3D-INV-08) F3D-T05 compared camera poses only within one process (cadence equivalence), and F3D-T04 checked `quat_from_yaw_pitch_f64` and `yaw_pitch_basis_f64` only with tolerances, so running on Windows CI proved self-consistency, not the required Linux/Windows bit identity. - F3D-T04: recorded `to_bits()` table for the camera orientation/basis helpers, including pole-limit and near-±π inputs. - F3D-T05c: 600-tick fixed input schedule (scripted ticks 0..48 plus an integer-derived look/move pattern) with recorded pose bits at ticks 1, 60, 300 and 600. Mismatch messages print a re-recordable table. Values recorded on Linux x86_64; identical in debug and release builds locally. Windows CI confirms the same bits on this PR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ser (Gate G2) The only fuzzing evidence for `decode_cooked_shader` was an uninstrumented stable libFuzzer run: without SanitizerCoverage it reports "no interesting inputs" and the corpus collapses to `1/1b`, so it exercised almost nothing. - CI job `fuzz`: installs nightly only for this job (owner-approved ADR-0007 exception), generates a synthetic seed corpus, runs `cargo fuzz run --sanitizer address decode_cooked_shader` for 300 s, uploads crash artifacts on failure, and runs cargo-deny on the fuzz package. - `crates/spawn-render/fuzz/examples/seed_corpus.rs`: writes raw and structured-path seeds (vertex/fragment/uniform/compute) that round-trip through `CookedShader`; seeds are generated, never committed. - `libfuzzer-sys` registered in DEPENDENCIES.md; deny.toml allows NCSA (bundled LLVM libFuzzer, permissive per ADR-0008) for that crate only. - ADR-0007, DECISIONS.md, GATES.md (G2 requires instrumented runs) and spawn-render AGENTS.md record the exception; VERIFICATION.md withdraws the uninstrumented claim and corrects the opt-in GPU count to 9/9. Not verified locally: nightly/cargo-fuzz are not installed on this host; the job runs for the first time on this pull request. cargo-deny passes locally for both the workspace and the fuzz package. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `RendererInfo::sync_validation_enabled` exposes whether Khronos synchronization validation (`VK_EXT_validation_features`) is active; `Validation::Required` now fails with REND-0008 unless debug-utils and sync validation are both available, and F3D-T11/F3D-T12 assert it. Previously sync validation was silently optional. - `retire_buffer`/`retire_image` queue the owned Vulkan handle before validating the suballocation, so a stale or forged suballocation returns an error without leaking the VkBuffer/VkImage (new GPU regression test). - `reclaim_completed` uses `retain` instead of building a new `Vec` on every call. - Allocator shutdown no longer `debug_assert!`s on leaks (it runs from `Drop`); leaks stay visible in `stats().live_allocations` and tests still require zero. Verified: opt-in GPU suite 10/10 on RX 460 with validation + sync validation, 0 errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mance G3 item The CI `fuzz` job on PR #15 ran `cargo fuzz run --sanitizer address decode_cooked_shader` for 300 s: 34,658,770 executions, coverage 328 -> 630, corpus 5 -> 155 units, 0 crashes/leaks/OOM, cargo-deny clean for the fuzz package. Exit-gate item 3 is now Verified with a link to the run. Gate G3 stays IN PROGRESS. The open owner items are the interactive verification protocol and the performance-budget decision (the milestone defines no numeric budget). The measured ~53 fps on a 60 Hz FIFO display is recorded as an observation still to be explained. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three live runs by the owner on the reference RX 460 / Hyprland host, with Khronos validation and sync validation enabled: - WASD and vertical translation; diagonal speed stays at or below ~6 m/s. - Mouse look only while the cursor is locked; yaw wraps across ±π. - Pitch clamps at ±1.57 rad without the image flipping. - Focus loss releases the cursor lock and clears held movement. - Live resize 769x504 -> 2530x1024 recreates the depth attachment. - `Escape` exits cleanly; validation_errors=0; no leaked GPU allocations. The owner visually confirmed the orientation, occlusion, pole clamp, and that the resize showed no corruption. Exit-gate item 5 is now Verified. Gate G3 stays IN PROGRESS, pending only the owner performance-budget decision and final sign-off. Interactive mouse-drag resize and live 0x0/minimize suspension remain listed as not exercised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lose run Fourth owner run: about 55 continuous drag-resize events (769x504 to 1468x816 and back) with Khronos validation and sync validation. The depth attachment was recreated and released on each event, the camera pose was unchanged, and the owner confirmed no corruption, flicker, or aspect distortion. The compositor close exited cleanly (CloseRequested) with validation_errors=0 and no leaked GPU allocations. The catch-up clamp dropped 6 single ticks (100 ms total) during the drag: some resize frames took longer than ~83 ms because each event triggers vkDeviceWaitIdle plus swapchain and depth recreation, in a debug build with validation. Tick stayed monotonic. Recorded as an observation. Mouse-drag resize is removed from the not-exercised list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`choose_image_count` requested `minImageCount + 1` images. RADV on Wayland reports `minImageCount = 3`, so the swapchain had 4 images. In FIFO mode the client could then queue 4 frames ahead of the display. Measured on the reference RX 460 / Hyprland at 60 Hz, release build, using a probe with wp_presentation feedback on the real engine path: - submit -> scanout: 66.7 ms -> 50.0 ms (one fewer queued refresh) - input arrival -> first visible change p50/p95: 90/99 ms -> 73/82 ms (with MESA_VK_WSI_DEBUG=nowlts) - stall in the first frame after a resize: 80 ms -> 63 ms - pacing unchanged: 60.1 fps, p99 frame interval 16.84 ms New policy: `max(minImageCount, 3)`, capped by the surface maximum. Surfaces with a minimum of 2 keep triple buffering; larger minimums are honored. Verified: unit test updated; opt-in GPU suite 10/10 with validation and sync validation; scripts/check.sh; 2 s smoke with validation_errors=0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e measurements Adds "Performance budget and measurements (reference hardware)" to the first-3d VERIFICATION.md. The owner approved the Milestone 2 local budget on 2026-11-18; all release-build measurements on the RX 460 / Hyprland reference host pass: - pacing: 60.1 fps, p99 16.84 ms, with MESA_VK_WSI_DEBUG=nowlts - CPU per frame 0.10 ms; 0.35 us per draw; simulation 0.003 ms per tick - 20 MiB GPU memory blocks; 75-83 MiB RSS - swapchain and depth recreation frame 3.9 ms - input arrival to first visible change at scanout: p95 82 ms (budget <= 100 ms), measured with wp_presentation feedback Also records: - the latency breakdown and the Mailbox lower bound (35 ms p95); - the next-milestone target (p95 <= 50 ms via VK_KHR_present_wait pacing and late latching); - the 63 ms stall after a resize; - the Mesa 26.2.5 / Hyprland 0.56 commit-timing pacing issue, reproduced with vkcube, and its workaround. The performance item of Gate G3 is now Verified. The gate stays IN PROGRESS pending only the owner's final sign-off and the stack merge. PLAN.md, root AGENTS.md and spawn-render AGENTS.md are synchronized. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The owner reviewed the exit-gate evidence and signed off on 2026-11-18: automated tests, GPU tests with validation and sync validation, coverage-guided ASan fuzzing, the four interactive runs, and the approved performance budget. Milestone 2 Phases 0-6 are EXISTS on Linux/Wayland + Vulkan 1.3. X11 and Windows remain PLANNED, and the unexercised edges stay listed. The status moves from "IN PROGRESS - PENDING OWNER VERIFICATION & SIGN-OFF" to "SIGNED OFF BY OWNER (2026-11-18)" across docs/first-3d/*, docs/README.md and the root AGENTS.md. F3D-T13 now requires the sign-off wording and rejects the stale pending status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes from the independent Milestone 2 audit. Stacked on #14; one commit per finding.
Changes
602b049): cooked-shader reads are bounded before allocation (read_cooked_shader_bounded). Non-regular files and files overMAX_COOKED_SHADER_BYTESfail withENGN-0008based on file metadata, before any content is read. A 512 MiB artifact previously pushed peak RSS to 558 MiB; it now fails at 83 MiB.b2fc73a): FND-T09 and F3D-T13 now take dependency edges from Cargo's resolver (cargo tree --invert, normal + build,--target all). Previously a hand-written TOML parser built them and missed three valid manifest forms:[dependencies.X]tables, renamed deps, and[build-dependencies].8ee9968): recorded goldento_bits()values for the camera helpers (F3D-T04) and for 600-tick camera poses (F3D-T05c). Windows CI now checks bit identity across platforms, not just consistency within one process.1011c74): new nightlyfuzzjob runscargo fuzz run --sanitizer addressfor 300 s over a generated seed corpus, as an owner-approved ADR-0007 exception that applies to this job only.libfuzzer-sysis registered in DEPENDENCIES.md, NCSA is allowed only for that crate, and the uninstrumented-run claim is withdrawn from VERIFICATION.md.2194833):RendererInfo::sync_validation_enabledis exposed, andValidation::Requirednow enforces it.retire_buffer/retire_imageno longer leak handles when given a rejected suballocation.reclaim_completedusesretain.debug_assert!fromDrop.Verification (local, reference RX 460 / Hyprland)
./scripts/check.sh: exit 0.CARGO_TERM_COLOR=always cargo test --workspace: green.crates/spawn-ecs/Cargo.tomlin turn. FND-T09 and F3D-T13 failed for each one; the change was reverted afterwards.VK_LAYER_KHRONOS_validationand sync validation, 0 errors. Opt-inslangc2026.22 test: 1/1.validation_errors=0, no leaks at shutdown.Not verified locally
fuzzjob: nightly andcargo-fuzzare not installed on this host. It runs for the first time on this PR. Its log should showcov:> 0, notcorp: 1/1b.Still owner-only for Gate G3
masterbranch protection and default-branch alignment.🤖 Generated with Claude Code