interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / evidence / SECURITY-673 / store-write-cleanup / REVIEW.md

97 lines · 5582 bytes Raw Blame History Rendered
1# Store write descriptor cleanup: source-only candidate
2
3Publication base: `95529421e9a0e6d6d63ca5d8b8cdfaf443e0ef78` (#687).
4Historical preparation base: `19948824fea22e66499af02f27feef3ce9efa5d9`.
5Review date: 2026-10-24. Scope: authority store (#649/#670), #673 tracker.
6
7## Defect and minimal correction
8
9After a successful open, `writerec` returned 11 (failed/short write) or 12 (failed
10fsync), and `writegen` returned 41 or 42, without closing the descriptor. Each
11of those four paths now makes exactly one best-effort `fclose` call before
12returning its original error. A secondary close error must not mask the primary
13write/fsync error. No close retry is introduced: a failed close may already have
14released the descriptor. Existing successful-write close errors remain 13/43;
15record rename remains unreachable after any earlier failure.
16
17No compiler, runtime implementation, ABI, store format, lock protocol, durability
18claim, temporary-file removal, or historical receipt is changed. This does not
19repair partial generation writes or guarantee cleanup if the process is killed.
20
21## Deterministic source-level regression
22
23`store-cleanup-test.om` is handwritten Omega. `store-cleanup-source.sh` composes
24it with the real store source after mechanically renaming only five write-side
25The composer uses portable awk token matching, rejects unexpected write-side
26effect argument prefixes, and buffers output until source transformation and
27harness reading both succeed. It does not rely on GNU sed word boundaries or
28a pipeline that could mask a source-read failure.
29primitive call prefixes to its effect doubles. Global buffer arguments are omitted because ordinary Omega functions cannot accept
30global arrays; buffer contents are not under test. There are no production test hooks or
31copied writer implementations. `read` remains real but the read functions are
32never called. The fixture opens no real files; its final success message uses
33real stdout. This is a control-flow/error-precedence test, NOT a real syscall,
34fd-leak, persistence, concurrency, Linux, or hardware qualification.
35
36Eighteen cases cover both writers and nine modes: open failure, negative write,
37short write, fsync failure, close failure, success, write plus close failure,
38fsync plus close failure, rename failure (the generation writer does not rename).
39Each asserts the return code, exact ordered effect trace, and that every
40write/sync/close receives the successfully opened fake fd 7. Traces distinguish
41zero/one/multiple closes, skipped effects and unwanted rename. Open failure has
42no close. Primary failures survive a simultaneous close failure.
43
44In a disposable Linux AArch64 checkout, after approval of the reconstructed
45compiler and its prerequisites:
46
47```sh
48mkdir -p build
49sh seed/authority/store-cleanup-source.sh > build/store-cleanup.om
50cmp build/store-cleanup.om seed/authority/store-cleanup-gate.om
51seed/out/omc < build/store-cleanup.om > build/store-cleanup
52readelf -h build/store-cleanup
53chmod +x build/store-cleanup
54build/store-cleanup
55```
56
57Run each command only after its predecessor succeeds; never run failed compiler
58output. Expected: `store cleanup cases=18 fails=0`, exit 0. This standalone gate
59is not wired into `gate669`; existing real store, exact-store, dispatch,
60dispatch-order and full security gates remain separately required.
61
62Negative control: extract `seed/authority/store.om` from the publication base above,
63pass that path as the script's optional first argument, then compile/run the
64result identically. It must exit 1 without the success message: ten cases (five
65per writer) lack their required close. A compiler error, signal or timeout is
66INVALID, not a passing negative control. Both fixed and negative native outcomes
67are expectations, NOT observed results.
68
69## Inherited fixture corrections preserved
70
71The publication base already contains the #685/#686 identifier and global-array
72argument corrections. This candidate preserves those test files and the README
73fixture-correction notes byte-for-byte; it does not introduce or re-publish those
74repairs. They were reviewed alongside the new cleanup fixture during preparation.
75
76## Verification status
77
78- PASS: source diff whitespace check and shell syntax check.
79- PASS: source-only composer negative checks: separately changed the reviewed
80 fopen/write/fsync/fclose/renames argument prefix in temporary source copies;
81 all five returned nonzero with zero stdout. Missing source also returned
82 nonzero with zero stdout. No Omega source was compiled or executed.
83- PASS: independent source review of all three updated fixtures, scalar doubles,
84 effect traces, identifier limits, array arguments and negative-control structure.
85 This is source review, not compiler acceptance.
86- PASS: global/text names <=8 and function names <=63 across all authority
87 gate declarations; inherited global-array call replaced with a local copy.
88- PASS: all four existing affected gate concatenations match their component
89 sources exactly; new gate matches the source-composition script.
90- PASS: the pre-fix control composition differs only by the four missing cleanup
91 calls. No new production helper is needed by the old-source control.
92- PASS: pinned crumb structural compile/verify (source metadata only).
93- NOT_RUN: Omega compilation; fixed/negative execution; real syscall fd-leak
94 regression; full security gates; independent Linux AArch64/hardware replay.
95 No bundled native seed executable ran and no toolchain was installed.
96
97Keep draft. Source review and metadata checks are not functional qualification.