Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
About Files History Releases Proposed changes Issues For developers
fix: secure temporary listings and kernel dumps for #614
merged da521ba58f79c2a2 #690 · opened 2026-10-24 10:02 UTC · closed 2026-10-24 10:03 UTC · merged 2026-10-24 10:03 UTC
Imported from GitHub aien-dev/omega-mv#690, by drakestapleton
Base 19eebe0e04811002f641c0f7b58c1b87ea9b5c42 · Head 436bf1df5627adfb217ff2bd35a6cbb3a785ca32
Merged on GitHub as de26cf5a6b7027c22b4fbdf3a4ef4f949c88208d ; not reachable from main c7acd2607139eedfabeac16b6042cefe8ede431f (observed 2026-11-18T16:35:45Z)
drakestapleton wrote on 2026-10-24 10:02 UTC
Verification
PASS: all six affected complete translation units compile with installed GCC 14.2, -Wall -Wextra -Werror; codegen's freestanding build also compiles. Source-bound before/after controls verify five listing paths (baseline mode 0666 and forged pathname readback; fixed mode 0600 and same-descriptor readback, plus stream/flush/seek failures). Full extracted kernel-dump controls verify exact bytes, mode 0600, no-overwrite/symlink refusal, unset/overlong directory no-op and write/close/stream errors. Parent independently repeated these controls.
PASS: 13,193 source-bound filename equivalence comparisons, independently repeated, covering directory lengths 0..5000 and every byte value at all eight digest positions around the 4074-byte acceptance boundary. Pinned crumb verification: 157 current; historical evidence unchanged.
Full host/native target plan is BLOCKED by absent ../physics/m16/m16_native.c in this environment; hardware/whole-repository gates and CodeQL rerun are NOT_RUN. No GPU work or deployment.
Repair scope
Five temporary listing routines use mkstemp plus fdopen and read through the same descriptor instead of predictable-path reopen. Kernel dumps use exclusive 0600 creation, preserving no-overwrite and configured directory semantics. Replace iterative snprintf appends with one checked bounded format call; equivalence evidence supports unchanged filenames and length refusal.
These changes address six permission findings and remove the ambiguous append pattern behind the overflow warning. The environment-directory trust-boundary warning remains unresolved; this PR does not invent a path policy, dismiss alerts, or claim CodeQL is green. No global umask or existing-file chmod changes.
Narrow existing legacy safety maintenance only, with no new committed C test suite or backend feature. Target is the existing #614 candidate branch, not main. Required main qualification remains intact. Candidate 436bf1df5627adfb217ff2bd35a6cbb3a785ca32 , tree 884b62e0b41ac40cb1eb675bb8f11b2cb1788896 .
drakestapleton wrote on 2026-10-24 10:03 UTC
Independent bounded repair review complete at 436bf1df5627adfb217ff2bd35a6cbb3a785ca32 . All five listing-control pairs and kernel before/after controls were independently rerun; filename equivalence was independently recompiled and passed 13,193 comparisons. Actual changed translation units and freestanding codegen compile, and pinned metadata verifies.
Integrate only into the existing, unprotected c6/disasm candidate branch so #614 can be reanalyzed. The default-main signed verification rule is unchanged and not bypassed. This is not approval of #614 for main or hardware release. The intended environment-directory trust boundary still needs review; no alert is dismissed. Full native qualification remains outstanding.
Apply it
git checkout -b patch-da521ba58f79c2a2 19eebe0e04811002f641c0f7b58c1b87ea9b5c42
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/da521ba58f79c2a2 .patch | git am
Raw patch (mbox) · Diff
Provenance
This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:
github-import 1
aien-dev/omega-mv
690
436bf1df5627adfb217ff2bd35a6cbb3a785ca32
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":690,"url":"https://github.com/aien-dev/omega-mv/pull/690","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140 ","imported_utc":"2026-11-18T16:35:45Z"}
Changes
diff --git a/.crumb b/.crumb
index d121d2dad ..f04be8a98 100644
--- a/.crumb
+++ b/.crumb
@@ -59,8 +59,8 @@
"purpose": "Directory doctrine. Purpose not yet described by a human."
},
{
- "digest": "e7d38c87a51c3c0ee6e3b18419ef4a01d95029de12ac9bf69eb672654f0ace55 ",
- "last_commit": "ae4ad9c0 ",
+ "digest": "2ba15303f21b0b8f09f904edc793c71159628e52b4e4d2e104009ce1eb3d67f6 ",
+ "last_commit": "b6a96d10 ",
"name": "mk",
"purpose": "Directory mk. Purpose not yet described by a human."
},
@@ -77,33 +77,33 @@
"purpose": "Directory spec. Purpose not yet described by a human."
},
{
- "digest": "dfa36de2ac8649f66f80587abea51a7f166285ee0b92e0e09774c98689055250 ",
- "last_commit": "333091a6 ",
+ "digest": "a050232b58c9cd1fa1c44e00703537794331f3e6420aeb93fd290da83e8703f5 ",
+ "last_commit": "b6a96d10 ",
"name": "src",
"purpose": "Directory src. Purpose not yet described by a human."
},
{
- "digest": "4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10 ",
- "last_commit": "88e24bdd ",
+ "digest": "879d878f8c2ef7f7bf9ce2b0b560e9abeaf84d68d1c6331f93ef716b2bfc88f2 ",
+ "last_commit": "b6a96d10 ",
"name": "tests",
"purpose": "Directory tests. Purpose not yet described by a human."
},
{
- "digest": "566a123ba248da906e3c42430b73decd7c3ec030a4fd26c909d265aa9bf67db9 ",
- "last_commit": "88e24bdd ",
+ "digest": "f27e9736ebe806888cc64fd3dbc8a72bb208e095c1647946a8d87f937665618d ",
+ "last_commit": "b6a96d10 ",
"name": "tools",
"purpose": "Directory tools. Purpose not yet described by a human."
}
],
- "children_root": "sha256:e1a8c008214ad5dbc33a3e184d7e882dc56d1d50f9bd14c58f8773992961557e ",
- "compiled_at": "2026-10-18T21:10:38Z",
+ "children_root": "sha256:6a895ae782d95c383b69e2b4dbfbd4ff03d0edf9c3ac29ceba719e4610dad49d ",
+ "compiled_at": "2026-10-24T09:58:33Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:be7220db494238bb4c33023d1df17286c35f947336bee5fc2e0405c136ec3e73 ",
- "evidence_files": 11127,
- "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e ",
- "files": 14100,
- "generated_at_commit": "f4a9849fb127f8d2d664dfc56890752ad180c507 ",
- "source_tree": "sha256:21f93defce6c9ba159a4bd31083db787e156dfaa4afb80c3427cf88f732f8258 "
+ "digest": "sha256:d81d2358b6b46d67af7583066431f8c56656eea2d3808494397c8c73649c2719 ",
+ "evidence_files": 11142,
+ "evidence_root": "sha256:c0c4c2485971f4a0b5bd659c5134af832cc41af2208a5d841180c19f9e038b16 ",
+ "files": 14123,
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:2db108743b46c9f92cfa04b4445693d7280be3e594c962bdd529c9df7cc73770 "
},
"owner_lane": "",
"provenance": {
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 47ff40719 ..a671510ce 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -10,6 +10,7 @@ Every model below did real work. A model is listed only for work it did. The orc
| Codex (GPT-6.1 Sol) | Code review of the numeric changes (patch checks, receipt blobs, GPU lock handling) |
| Gemini 3.8 Flash | Code review of the numeric changes (patch checks, qualifier script, build rules) |
| Codex | Numeric uncertain-completion retention, exact completion checks, and simulated-driver lifecycle regression tests |
+| Codex | C6 private kernel dumps and temporary listings, bounded dump filenames, descriptor-safe readback, and source-bound host safety checks |
| Claude Opus 5.5 | Ionic-droplet reservoir (#440): pinned reference, CPU simulator and readout, `.mat` reader, Gate 2 comparison, benchmarks, timing and receipt |
This table starts with the numeric work on this branch. Earlier work in this repository is not yet attributed here; add rows only for work that can be traced to a model.
diff --git a/bench/prime_race/.crumb b/bench/prime_race/.crumb
index a375434b7 ..6eb5d7ff2 100644
--- a/bench/prime_race/.crumb
+++ b/bench/prime_race/.crumb
@@ -3,14 +3,14 @@
"generated": {
"children": [],
"children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "compiled_at": "2026-10-14T01:16:48Z",
+ "compiled_at": "2026-10-24T09:54:04Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:9dd7474de3f8342f85466d4629e58ebe6a7e9be694f6f282803892d32f9c272f ",
+ "digest": "sha256:6e10b0ce57c1da7d1834da476f34a5dfc7edf40b088e7c0e44eeb2181193db81 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
"files": 10,
- "generated_at_commit": "e0abd0b524f5bf8e3ba6960b53868980bdd41b4e ",
- "source_tree": "sha256:5672fda945c78b908a57f8948c2062df54c958ea0ec866691da515ddbc9c621a "
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:ab4760b263f787792642a7d890b2ea1acddf0f12bc7211ffe9240b30e0c6fa36 "
}
},
"invariants": [
diff --git a/bench/prime_race/tests/gb10_sieve_host_test.c b/bench/prime_race/tests/gb10_sieve_host_test.c
index 2e0482f3e ..950b414d7 100644
--- a/bench/prime_race/tests/gb10_sieve_host_test.c
+++ b/bench/prime_race/tests/gb10_sieve_host_test.c
@@ -387,13 +387,14 @@ static const char *const MUST_GLOBAL[] = { "LOP3.LUT", "SHF.L.U32", "IMAD.HI.U32
static const char *const MUST_STAGED[] = { "LDS", "STS", "BAR.SYNC", "LDG.E", "STG.E", "IMAD.HI.U32", "@P0 BRA", "@!P0 BRA" };
static void sm121dis_check(const OmegaBlackwellKernel *k, const BlackwellIRProgram *p, const char *const *must, const char *tag) {
char lst[64];
- snprintf(lst, sizeof lst, "/tmp/pr_gb10_sieve_%d.sass", (int)getpid());
- FILE *f = fopen(lst, "w");
- if (!f) { CHECK(0, "cannot write %s", lst); return; }
- int rc = omega_sm121_listing(k->code, k->code_size, f); fclose(f);
+ snprintf(lst, sizeof lst, "/tmp/pr_gb10_sieve_%d.sass.XXXXXX", (int)getpid());
+ int fd = mkstemp(lst); /* private, unique listing; read back the same descriptor */
+ FILE *f = fd >= 0 ? fdopen(fd, "w+") : NULL;
+ if (!f) { if (fd >= 0) close(fd); CHECK(0, "cannot write %s", lst); return; }
+ int rc = omega_sm121_listing(k->code, k->code_size, f);
CHECK(rc == 0, "sm121dis rc %d", rc);
- FILE *l = fopen(lst, "r");
- if (!l) { CHECK(0, "cannot read %s", lst); return; }
+ if (fflush(f) != 0 || fseek(f, 0, SEEK_SET) != 0) { fclose(f); CHECK(0, "cannot read %s", lst); return; }
+ FILE *l = f;
int seen[8] = {0}, insns = 0, bad = 0, bra_ok = 0, bra_bad = 0;
char line[512];
while (fgets(line, sizeof line, l)) {
@@ -413,7 +414,8 @@ static void sm121dis_check(const OmegaBlackwellKernel *k, const BlackwellIRProgr
else { bra_bad++; printf(" branch at 0x%04x: sm121dis target 0x%lx, IR target 0x%lx\n", addr, target, want); }
}
}
- fclose(l);
+ CHECK(!ferror(l), "read listing %s", lst);
+ CHECK(fclose(l) == 0, "close listing %s", lst);
for (int i = 0; i < 8; i++) CHECK(seen[i], "sm121dis listing lacks %s (%s)", must[i], lst);
CHECK(bad == 0, "%d undecodable words (%s)", bad, lst);
CHECK(bra_bad == 0 && bra_ok >= 6, "branch targets: %d match, %d differ", bra_ok, bra_bad);
diff --git a/mk/.crumb b/mk/.crumb
index cd51a1c73 ..05e6f7b2d 100644
--- a/mk/.crumb
+++ b/mk/.crumb
@@ -7,14 +7,14 @@
"generated": {
"children": [],
"children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "compiled_at": "2026-10-16T02:24:36Z",
+ "compiled_at": "2026-10-24T09:54:04Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:e7d38c87a51c3c0ee6e3b18419ef4a01d95029de12ac9bf69eb672654f0ace55 ",
+ "digest": "sha256:2ba15303f21b0b8f09f904edc793c71159628e52b4e4d2e104009ce1eb3d67f6 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 71,
- "generated_at_commit": "ccf021b944b0128a537dfd3dd301e6d83eefa311 ",
- "source_tree": "sha256:e7a2b37daa8149cb73da719737df82c74a61685b4076bf2c5b4e0c26bee61dc7 "
+ "files": 72,
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:12638726c3b1dcb7b1b599449906a451081d3018f89f81cb5d0d11dfe6b8ed63 "
},
"owner_lane": "",
"provenance": {
diff --git a/src/.crumb b/src/.crumb
index 4fe5298a4 ..61807f52b 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -182,14 +182,14 @@
}
],
"children_root": "sha256:15012a017b26a269feb256b64875ece2912f5f82c57804baafa3777c4fcb80b9 ",
- "compiled_at": "2026-10-16T07:33:43Z",
+ "compiled_at": "2026-10-24T09:58:33Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:dfa36de2ac8649f66f80587abea51a7f166285ee0b92e0e09774c98689055250 ",
+ "digest": "sha256:a050232b58c9cd1fa1c44e00703537794331f3e6420aeb93fd290da83e8703f5 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 537,
- "generated_at_commit": "1d481ab853a14d3c11eff926ce1e25993085f76a ",
- "source_tree": "sha256:200c9243151691313acb5f86d3e9cb3058f1a1b92ece2a255b3340b691dfb894 "
+ "files": 539,
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:63be3d9f81be3b9a215a0729bbdd95751538300a8b251bd46795e8952b6c9791 "
},
"owner_lane": "",
"provenance": {
diff --git a/src/omega_blackwell_codegen.c b/src/omega_blackwell_codegen.c
index 28d3d6c53 ..c9c7a03f9 100644
--- a/src/omega_blackwell_codegen.c
+++ b/src/omega_blackwell_codegen.c
@@ -7,8 +7,10 @@
* (omega_blackwell_kernel_encode_into: the caller supplies the code buffer and its capacity); the allocating
* generators, their diagnostics and the printing variation self-test exist only in the hosted build. */
#ifndef OMEGA_GPU_NO_POSIX
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#define BW_DIAG(...) fprintf(stderr, __VA_ARGS__)
#else
#define BW_DIAG(...) ((void)0)
@@ -1002,14 +1004,18 @@ void omega_kernel_dump(const uint8_t *code, size_t len) {
const char *dir = getenv("OMEGA_KERNEL_DUMP_DIR");
if (!dir || !dir[0] || !code || !len) return;
uint8_t d[SHA256_DIGEST_SIZE]; sha256_hash(code, len, d);
- char path[4096]; int n = snprintf(path, sizeof path, "%s/", dir);
- if (n < 0 || (size_t)n + 21 > sizeof path) return;
- for (unsigned i = 0; i < 8; i++) n += snprintf(path + n, sizeof path - (size_t)n, "%02x", d[i]);
- snprintf(path + n, sizeof path - (size_t)n, ".bin");
- FILE *f = fopen(path, "wbx"); /* x: an existing body is left alone */
- if (!f) return;
+ char path[4096];
+ int n = snprintf(path, sizeof path, "%s/%02x%02x%02x%02x%02x%02x%02x%02x.bin",
+ dir, (unsigned)d[0], (unsigned)d[1], (unsigned)d[2], (unsigned)d[3],
+ (unsigned)d[4], (unsigned)d[5], (unsigned)d[6], (unsigned)d[7]);
+ if (n < 0 || (size_t)n >= sizeof path) return;
+ /* Private, exclusive creation: an existing body or symlink is left alone. */
+ int fd = open(path, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600);
+ if (fd < 0) return;
+ FILE *f = fdopen(fd, "wb");
+ if (!f) { close(fd); return; }
if (fwrite(code, 1, len, f) != len) BW_DIAG("omega_kernel_dump: short write %s\n", path);
- fclose(f);
+ if (fclose(f) != 0) BW_DIAG("omega_kernel_dump: close failed %s\n", path);
#else
(void)code; (void)len;
#endif
diff --git a/tests/.crumb b/tests/.crumb
index bd5535a8b ..0f0d7453e 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -296,14 +296,14 @@
}
],
"children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8 ",
- "compiled_at": "2026-10-16T19:04:20Z",
+ "compiled_at": "2026-10-24T09:54:04Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10 ",
+ "digest": "sha256:879d878f8c2ef7f7bf9ce2b0b560e9abeaf84d68d1c6331f93ef716b2bfc88f2 ",
"evidence_files": 16,
"evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a ",
"files": 1270,
- "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426 ",
- "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc "
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:b7af1bd6024f1b7c800f8e0b69a1615d7edcba8d9cda749fb89f4ecf34a3b8f6 "
},
"owner_lane": "",
"provenance": {
diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c
index c0cd567bb ..6415dcf4d 100644
--- a/tests/gpu_attention_test.c
+++ b/tests/gpu_attention_test.c
@@ -135,11 +135,14 @@ static int sm121dis_check(bool f32, const char *name, const char *const *must, i
OmegaBlackwellKernel k; memset(&k, 0, sizeof k);
if (omega_gpu_attention_codegen_hd(f32, f32 ? 12 : 4, 3, g_hd, &k) != OMEGA_GPU_ATTN_OK) return -1;
char lst[64];
- snprintf(lst, sizeof lst, "/tmp/omega_attn_%s_%d.sass", name, (int)getpid());
- FILE *f = fopen(lst, "w"); if (!f) { free(k.code); return -1; }
- int rc = omega_sm121_listing(k.code, k.code_size, f); fclose(f);
+ snprintf(lst, sizeof lst, "/tmp/omega_attn_%s_%d.sass.XXXXXX", name, (int)getpid());
+ int fd = mkstemp(lst); /* private, unique listing; read back the same descriptor */
+ FILE *f = fd >= 0 ? fdopen(fd, "w+") : NULL;
+ if (!f) { if (fd >= 0) close(fd); free(k.code); return -1; }
+ int rc = omega_sm121_listing(k.code, k.code_size, f);
free(k.code);
- FILE *l = fopen(lst, "r"); if (!l) return -1;
+ if (fflush(f) != 0 || fseek(f, 0, SEEK_SET) != 0) { fclose(f); return -1; }
+ FILE *l = f;
char line[512]; int seen[16] = {0}; int bad = 0, insns = 0;
while (fgets(line, sizeof line, l)) {
if (!strstr(line, "/*")) continue; /* every address line, 0x1000 and up too */
@@ -147,7 +150,8 @@ static int sm121dis_check(bool f32, const char *name, const char *const *must, i
if (strstr(line, "?") || strstr(line, "error")) bad++;
for (int i = 0; i < n_must; i++) if (strstr(line, must[i])) seen[i] = 1;
}
- fclose(l);
+ if (ferror(l)) rc = -1;
+ if (fclose(l) != 0) rc = -1;
int miss = 0;
for (int i = 0; i < n_must; i++) if (!seen[i]) { printf(" %s: sm121dis listing lacks %s\n", name, must[i]); miss++; }
printf("sm121dis %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst);
diff --git a/tests/gpu_elementwise_test.c b/tests/gpu_elementwise_test.c
index af5134326 ..e9d110b5f 100644
--- a/tests/gpu_elementwise_test.c
+++ b/tests/gpu_elementwise_test.c
@@ -85,11 +85,14 @@ static int sm121dis_check(OmegaGpuEwOp op, const char *name, const char *const *
OmegaBlackwellKernel k; memset(&k, 0, sizeof k);
if (omega_gpu_elementwise_codegen(op, NULL, 0.0f, &k) != OMEGA_GPU_EW_OK) return -1;
char lst[64];
- snprintf(lst, sizeof lst, "/tmp/omega_ew_%s_%d.sass", name, (int)getpid());
- FILE *f = fopen(lst, "w"); if (!f) { free(k.code); return -1; }
- int rc = omega_sm121_listing(k.code, k.code_size, f); fclose(f);
+ snprintf(lst, sizeof lst, "/tmp/omega_ew_%s_%d.sass.XXXXXX", name, (int)getpid());
+ int fd = mkstemp(lst); /* private, unique listing; read back the same descriptor */
+ FILE *f = fd >= 0 ? fdopen(fd, "w+") : NULL;
+ if (!f) { if (fd >= 0) close(fd); free(k.code); return -1; }
+ int rc = omega_sm121_listing(k.code, k.code_size, f);
free(k.code);
- FILE *l = fopen(lst, "r"); if (!l) return -1;
+ if (fflush(f) != 0 || fseek(f, 0, SEEK_SET) != 0) { fclose(f); return -1; }
+ FILE *l = f;
char line[512]; int seen[16] = {0}; int bad = 0, insns = 0;
while (fgets(line, sizeof line, l)) {
if (!strstr(line, "/*")) continue; /* every address line, 0x1000 and up too */
@@ -97,7 +100,8 @@ static int sm121dis_check(OmegaGpuEwOp op, const char *name, const char *const *
if (strstr(line, "?") || strstr(line, "error")) bad++;
for (int i = 0; i < n_must; i++) if (strstr(line, must[i])) seen[i] = 1;
}
- fclose(l);
+ if (ferror(l)) rc = -1;
+ if (fclose(l) != 0) rc = -1;
int miss = 0;
for (int i = 0; i < n_must; i++) if (!seen[i]) { printf(" %s: sm121dis listing lacks %s\n", name, must[i]); miss++; }
printf("sm121dis %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst);
diff --git a/tests/gpu_fp8_api_test.c b/tests/gpu_fp8_api_test.c
index 17be210d5 ..7a679db1f 100644
--- a/tests/gpu_fp8_api_test.c
+++ b/tests/gpu_fp8_api_test.c
@@ -85,12 +85,15 @@ static int sm121dis_check_v(int variant, const OmegaFp8GemvSpec *spec, const cha
OmegaBlackwellKernel k; memset(&k, 0, sizeof k);
if ((variant == 2 ? omega_blackwell_codegen_fp8_gemv2(spec, &k) : omega_blackwell_codegen_fp8_gemv(spec, &k)) != 0) return -1;
char lst[96];
- snprintf(lst, sizeof lst, "/tmp/omega_fp8_%s_%d.sass", name, (int)getpid());
- FILE *f = fopen(lst, "w"); if (!f) { omega_blackwell_kernel_free(&k); return -1; }
- int rc = omega_sm121_listing(k.code, k.code_size, f); fclose(f);
+ snprintf(lst, sizeof lst, "/tmp/omega_fp8_%s_%d.sass.XXXXXX", name, (int)getpid());
+ int fd = mkstemp(lst); /* private, unique listing; read back the same descriptor */
+ FILE *f = fd >= 0 ? fdopen(fd, "w+") : NULL;
+ if (!f) { if (fd >= 0) close(fd); omega_blackwell_kernel_free(&k); return -1; }
+ int rc = omega_sm121_listing(k.code, k.code_size, f);
omega_blackwell_kernel_free(&k);
static const char *const must[] = { "LDG.E.128", "FFMA", "SHFL.DOWN", "BSSY", "BSYNC", "STG.E", "LOP3.LUT", "IMAD" };
- FILE *l = fopen(lst, "r"); if (!l) return -1;
+ if (fflush(f) != 0 || fseek(f, 0, SEEK_SET) != 0) { fclose(f); return -1; }
+ FILE *l = f;
char line[512]; int seen[8] = {0}; int bad = 0, insns = 0;
while (fgets(line, sizeof line, l)) {
if (!strstr(line, "/*") || !strstr(line, "*/")) continue; /* every address line */
@@ -99,7 +102,8 @@ static int sm121dis_check_v(int variant, const OmegaFp8GemvSpec *spec, const cha
if (strstr(line, ".FTZ")) { printf(" %s: flush-to-zero instruction: %s", name, line); bad++; } /* e4m3 subnormals travel as f32 subnormals */
for (int i = 0; i < 8; i++) if (strstr(line, must[i])) seen[i] = 1;
}
- fclose(l);
+ if (ferror(l)) rc = -1;
+ if (fclose(l) != 0) rc = -1;
int miss = 0;
for (int i = 0; i < 8; i++) if (!seen[i]) { printf(" %s: sm121dis listing lacks %s\n", name, must[i]); miss++; }
printf("sm121dis %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst);
diff --git a/tests/gpu_reconv_test.c b/tests/gpu_reconv_test.c
index 866ee9152 ..925039d69 100644
--- a/tests/gpu_reconv_test.c
+++ b/tests/gpu_reconv_test.c
@@ -174,10 +174,13 @@ static int find_op(const BlackwellIRProgram *p, BlackwellIROpcode op, int nth) {
/* --------------------------------------------------------- sm121dis listing */
static int sm121dis_bytes(const uint8_t *code, size_t bytes, const char *name, const char *const *must, int n_must) {
char lst[96];
- snprintf(lst, sizeof lst, "/tmp/omega_rc_%s_%d.sass", name, (int)getpid());
- FILE *f = fopen(lst, "w"); if (!f) return -1;
- int rc = omega_sm121_listing(code, bytes, f); fclose(f);
- FILE *l = fopen(lst, "r"); if (!l) return -1;
+ snprintf(lst, sizeof lst, "/tmp/omega_rc_%s_%d.sass.XXXXXX", name, (int)getpid());
+ int fd = mkstemp(lst); /* private, unique listing; read back the same descriptor */
+ FILE *f = fd >= 0 ? fdopen(fd, "w+") : NULL;
+ if (!f) { if (fd >= 0) close(fd); return -1; }
+ int rc = omega_sm121_listing(code, bytes, f);
+ if (fflush(f) != 0 || fseek(f, 0, SEEK_SET) != 0) { fclose(f); return -1; }
+ FILE *l = f;
char line[512]; int seen[16] = {0}, bad = 0, insns = 0;
while (fgets(line, sizeof line, l)) {
if (!strstr(line, "/*")) continue; /* every address line, 0x1000 and up too */
@@ -185,7 +188,8 @@ static int sm121dis_bytes(const uint8_t *code, size_t bytes, const char *name, c
if (strstr(line, "?") || strstr(line, "error")) bad++;
for (int i = 0; i < n_must && i < 16; i++) if (strstr(line, must[i])) seen[i] = 1;
}
- fclose(l);
+ if (ferror(l)) rc = -1;
+ if (fclose(l) != 0) rc = -1;
int miss = 0;
for (int i = 0; i < n_must && i < 16; i++) if (!seen[i]) { printf(" %s: sm121dis listing lacks %s\n", name, must[i]); miss++; }
printf("sm121dis %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst);
diff --git a/tools/.crumb b/tools/.crumb
index 8cf70bcac ..c12fe240b 100644
--- a/tools/.crumb
+++ b/tools/.crumb
@@ -62,14 +62,14 @@
}
],
"children_root": "sha256:e1f826c2beb8604bb0dcba49575f7c6b48cf5488c40b616b212fda2ed70c62ee ",
- "compiled_at": "2026-10-16T19:04:20Z",
+ "compiled_at": "2026-10-24T09:54:04Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:566a123ba248da906e3c42430b73decd7c3ec030a4fd26c909d265aa9bf67db9 ",
+ "digest": "sha256:f27e9736ebe806888cc64fd3dbc8a72bb208e095c1647946a8d87f937665618d ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 284,
- "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426 ",
- "source_tree": "sha256:eee0218ae5c8d003fa0a585291551799e81e6c329a7f5db1295e771a75aee167 "
+ "files": 289,
+ "generated_at_commit": "19eebe0e04811002f641c0f7b58c1b87ea9b5c42 ",
+ "source_tree": "sha256:dd2a95d5755fdf3f8b48c259fa1a17859c4d6ad6356cb8e0de19124eeff143ff "
},
"owner_lane": "",
"provenance": {