interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

GitHub aien-dev/CUDApp#182 (code only)

closed derived b0e7e096d4fb1b27 #182

Imported from GitHub aien-dev/CUDApp#182 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base b348277e4383ab1f37f45bb702ea7d4fb4363782 · Head 8f798a05f7c25dff991981ca414a4e180e423218

Apply it

git checkout -b patch-b0e7e096d4fb1b27 b348277e4383ab1f37f45bb702ea7d4fb4363782
curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/b0e7e096d4fb1b27.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/CUDApp
182
8f798a05f7c25dff991981ca414a4e180e423218
{"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":182,"url":"https://github.com/aien-dev/CUDApp/pull/182","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:54Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3c74c8c7..6131f66b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,6 +11,15 @@ on:
 permissions:
   contents: read
 jobs:
+  audit-scanner:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
+      - name: Scanner detections and error refusal controls
+        run: bash tools/extract/audit-selftest.sh
   host-tests:
     runs-on: ubuntu-24.04-arm
     timeout-minutes: 40
diff --git a/evidence/AUDIT-SCAN-ERRORS-20261029.md b/evidence/AUDIT-SCAN-ERRORS-20261029.md
new file mode 100644
index 00000000..cb410113
--- /dev/null
+++ b/evidence/AUDIT-SCAN-ERRORS-20261029.md
@@ -0,0 +1,28 @@
+<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
+# Scanner error refusal regression
+
+Base: b348277e4383ab1f37f45bb702ea7d4fb4363782. Linux host-only.
+No repository-wide clean-audit conclusion is established by this fixture.
+Issue #89 remains the owner of complete audit execution and independent review.
+
+`bash tools/extract/audit-error-selftest.sh` against original audit-scan.sh:
+exit 1, `grep phase -naP returned 0, expected 2`. This is a reproduced false
+success from an injected search-tool error, not evidence about real secrets.
+
+`bash tools/extract/audit-selftest.sh` against the fixed scanner: exit 0.
+The original 17 planted detections still pass. Added controls verify:
+- injected errors in raw-secret, raw-private, message-secret and message-private scans return 2;
+- invalid secret/private patterns return 2;
+- corrupted compressed content returns 2 and remains listed as unscanned;
+- clean synthetic history returns 0;
+- a synthetic secret in a filename containing the former formatting delimiter returns 1 and is retained.
+
+The fix distinguishes grep status 1 (no matches) from errors, writes matches
+before formatting them, and uses literal output prefixes. Formatting pipeline
+errors remain subject to pipefail. Binary-count pipeline failures are also
+checked before classification. A dedicated CI job runs both scanner test sets.
+
+Tested source identities:
+3dfe636aa78689dcfe443e68205b49c1230f94edd2d1566f1eb5526bb4f86e2c  tools/extract/audit-scan.sh
+4596ffdcb2f6171bc235f6855ccb0064d6827a030297e6a4983337802b61820a  tools/extract/audit-selftest.sh
+30f8866924b793e1925d40b90157ee0fa1c6b1985de9c0ebcec5922c89d81e59  tools/extract/audit-error-selftest.sh
diff --git a/evidence/AUDIT-SCAN-FD-20261029.md b/evidence/AUDIT-SCAN-FD-20261029.md
new file mode 100644
index 00000000..72e0efdf
--- /dev/null
+++ b/evidence/AUDIT-SCAN-FD-20261029.md
@@ -0,0 +1,13 @@
+<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
+# Match-output open failure distinction
+
+Follow-up to source 69f51413. The scanner now opens its match-output descriptor
+before invoking grep, so a shell output-redirection failure cannot be confused
+with grep's no-match exit status. No detection pattern changes.
+
+`bash tools/extract/audit-selftest.sh` passes after this change, retaining the
+original 17 detections and every error-refusal control described in
+AUDIT-SCAN-ERRORS-20261029.md. The earlier receipt remains bound to its earlier
+source, not relabeled. This is host scanner verification, not a clean-history
+claim. Tested scanner SHA-256:
+bc726f90851ba5e9a33939a7bf88b10c9424a0d0e3281562c9c925e089bd7bbf  tools/extract/audit-scan.sh
diff --git a/evidence/AUDIT-SCAN-OUTPUT-20261029.md b/evidence/AUDIT-SCAN-OUTPUT-20261029.md
new file mode 100644
index 00000000..bf15cc81
--- /dev/null
+++ b/evidence/AUDIT-SCAN-OUTPUT-20261029.md
@@ -0,0 +1,13 @@
+<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
+# Output-open failure control
+
+Follow-up to c67fc277. The synthetic mktemp wrapper creates a directory where
+match output must be opened. The scanner now reports incomplete and exits 2.
+The complete audit-selftest exits 0 with original planted detections and all
+error controls passing. This adds an executed output-open control to the
+previously recorded search, regex, compression and filename controls.
+No real repository-wide clean result is claimed.
+
+Tested source SHA-256:
+5538f3ddab502e44e16b6dac5101c1ef27fe28fc72057416f6395444127b8a98  tools/extract/audit-scan.sh
+289c1cb9ba451f861411cd9a7d8ff1c78e5993f2ba40008e9698882f0db9ec24  tools/extract/audit-error-selftest.sh
diff --git a/tools/extract/.crumb b/tools/extract/.crumb
new file mode 100644
index 00000000..4024be03
--- /dev/null
+++ b/tools/extract/.crumb
@@ -0,0 +1,19 @@
+{
+  "extensions": {
+    "generated": {
+      "children": [],
+      "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+      "compiled_at": "2026-10-29T02:13:05Z",
+      "compiler": "crumb-compile/1",
+      "digest": "sha256:d0c7122592333dfe6ea9a77efb7fa1722f69525ce0b4c1ef1fb774dd9c4da4dc",
+      "evidence_files": 0,
+      "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+      "files": 30,
+      "generated_at_commit": "c67fc2772186b35b562d5067449fb3dc8997bc57",
+      "source_tree": "sha256:6e807561b32f039d7bc048885a7f8ce3a9e96f42945f35deee971c1eb2407d24"
+    }
+  },
+  "name": "extract",
+  "purpose": "Publication scanner and extraction verification tools; scan errors must never establish clean results.",
+  "schema_version": "1.0.0"
+}
diff --git a/tools/extract/audit-error-selftest.sh b/tools/extract/audit-error-selftest.sh
new file mode 100644
index 00000000..68f2f4e0
--- /dev/null
+++ b/tools/extract/audit-error-selftest.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+set -euo pipefail
+here=$(cd "$(dirname "$0")" && pwd)
+t=$(mktemp -d)
+trap 'rm -rf "$t"' EXIT
+mkdir -p "$t/scanner" "$t/bin" "$t/repo"
+cp "$here/audit-scan.sh" "$t/scanner/audit-scan.sh"
+printf '%s\n' SYNTHETIC_ONLY > "$t/scanner/rules-secrets.txt"
+printf '%s\n' PRIVATE_ONLY > "$t/scanner/rules-private.txt"
+git -C "$t/repo" init -q
+git -C "$t/repo" config user.name test
+git -C "$t/repo" config user.email test@example.invalid
+printf '%s\n' benign > "$t/repo/input"
+git -C "$t/repo" add input
+git -C "$t/repo" commit -qm initial
+real_grep=$(command -v grep)
+printf '#!/bin/bash\nif [[ ${1-} == "${SCAN_FAIL_MODE-}" ]]; then exit 2; fi\nexec %q "$@"\n' "$real_grep" > "$t/bin/grep"
+chmod +x "$t/bin/grep"
+for phase in -naP -noaP -nP -noP; do
+    rc=0
+    PATH="$t/bin:$PATH" SCAN_FAIL_MODE="$phase" bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log" 2>&1 || rc=$?
+    if [[ $rc != 2 ]]; then
+        echo "ERROR SELFTEST FAIL: grep phase $phase returned $rc, expected 2"
+        exit 1
+    fi
+done
+mkdir "$t/openfailbin"
+real_mktemp=$(command -v mktemp)
+printf '#!/bin/bash\nset -e\np=$(%q "$@")\nmkdir "$p/matches"\nprintf "%%s\\n" "$p"\n' "$real_mktemp" > "$t/openfailbin/mktemp"
+chmod +x "$t/openfailbin/mktemp"
+rc=0
+PATH="$t/openfailbin:$PATH" bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log" 2>&1 || rc=$?
+[[ $rc == 2 ]] || { echo "ERROR SELFTEST FAIL: output-open error returned $rc"; exit 1; }
+for rule in secrets private; do
+    cp "$t/scanner/rules-$rule.txt" "$t/rule.save"
+    printf '[\n' > "$t/scanner/rules-$rule.txt"
+    rc=0
+    bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log" 2>&1 || rc=$?
+    cp "$t/rule.save" "$t/scanner/rules-$rule.txt"
+    [[ $rc == 2 ]] || { echo "ERROR SELFTEST FAIL: invalid $rule regex returned $rc"; exit 1; }
+done
+bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log"
+printf '\037\213broken' > "$t/repo/corrupt.gz"
+git -C "$t/repo" add .
+git -C "$t/repo" commit -qm corrupt
+rc=0
+bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log" 2>&1 || rc=$?
+[[ $rc == 2 && -s $t/out/unscanned.txt ]] || { echo 'ERROR SELFTEST FAIL: corrupt compression was not refused'; exit 1; }
+printf '%s\n' SYNTHETIC_ONLY > "$t/repo/delimiter|file"
+git -C "$t/repo" add .
+git -C "$t/repo" commit -qm delimiter
+rc=0
+bash "$t/scanner/audit-scan.sh" "$t/repo" "$t/out" > "$t/log" 2>&1 || rc=$?
+[[ $rc == 1 ]] || { echo "ERROR SELFTEST FAIL: delimiter-path secret returned $rc"; exit 1; }
+grep -F 'delimiter|file:' "$t/out/secrets.txt" > /dev/null
+echo 'ERROR SELFTEST PASS: scan errors refuse; clean input and delimiter-path detection preserved'
diff --git a/tools/extract/audit-scan.sh b/tools/extract/audit-scan.sh
index ba0b926c..8c23da4b 100755
--- a/tools/extract/audit-scan.sh
+++ b/tools/extract/audit-scan.sh
@@ -36,9 +36,31 @@ awk 'NF>=2 {sha=$1; $1=""; sub(/^ /,""); if (!(sha in p)) p[sha]=$0} END {for (s
 : > "$out/compressed.txt"; : > "$out/unscanned.txt"
 # scan FILE LABEL: secret and private rules over the raw bytes (-a: a NUL byte
 # must not make grep skip the file or stop matching).
+matches() {
+    local rc=0 match_fd
+    # Open separately: a shell redirection failure must not look like grep's no-match status.
+    if ! exec {match_fd}> "$tmp/matches"; then
+        echo 'AUDIT INCOMPLETE: cannot open match output' >&2
+        exit 2
+    fi
+    grep "$@" >&"$match_fd" || rc=$?
+    exec {match_fd}>&-
+    if (( rc > 1 )); then
+        echo "AUDIT INCOMPLETE: grep failed with status $rc" >&2
+        exit 2
+    fi
+}
+prefix() {
+    local label=$1 line
+    while IFS= read -r line; do
+        printf '%s:%s\n' "$label" "$line"
+    done
+}
 scan() {
-    grep -naP -e "$secret_re" "$1" 2>/dev/null | tr -d '\000' | cut -c1-200 | sed "s|^|$sha $2:|" >> "$out/secrets.txt" || true
-    grep -noaP -e "$private_re" "$1" 2>/dev/null | tr -d '\000' | sed "s|^|$2:|" >> "$out/private.txt" || true
+    matches -naP -e "$secret_re" "$1"
+    tr -d '\000' < "$tmp/matches" | cut -c1-200 | prefix "$sha $2" >> "$out/secrets.txt"
+    matches -noaP -e "$private_re" "$1"
+    tr -d '\000' < "$tmp/matches" | prefix "$2" >> "$out/private.txt"
 }
 mkdir -p "$tmp/b"
 nblob=0
@@ -50,7 +72,8 @@ while read -r sha type size; do
     # Binary = contains a NUL byte. Counted with tr, not grep -P '\x00': GNU
     # grep 3.11 under LC_ALL=C never matches NUL that way, which left this list
     # empty on every run before 2026-10-27 (CUDApp#89).
-    if [[ $(tr -dc '\000' < "$tmp/b/x" | wc -c) -gt 0 ]]; then
+    nul_bytes=$(tr -dc '\000' < "$tmp/b/x" | wc -c)
+    if [[ $nul_bytes -gt 0 ]]; then
         echo "$sha $size $path" >> "$out/binaries.txt"
     fi
     scan "$tmp/b/x" "$path"
@@ -77,8 +100,10 @@ done < "$tmp/types"
 # commit and tag messages (and identities, for the record)
 git -C "$repo" log --all --format='%H%n%B' > "$tmp/msgs"
 git -C "$repo" for-each-ref refs/tags --format='%(objectname)%0a%(contents)' >> "$tmp/msgs"
-grep -nP -e "$secret_re" "$tmp/msgs" | cut -c1-200 | sed 's|^|MSG:|' >> "$out/secrets.txt" || true
-grep -noP -e "$private_re" "$tmp/msgs" | sed 's|^|MSG:|' >> "$out/private.txt" || true
+matches -nP -e "$secret_re" "$tmp/msgs"
+cut -c1-200 < "$tmp/matches" | prefix MSG >> "$out/secrets.txt"
+matches -noP -e "$private_re" "$tmp/msgs"
+prefix MSG < "$tmp/matches" >> "$out/private.txt"
 cp "$tmp/msgs" "$out/messages.txt"
 
 # private hits, grouped by the matched text (the reviewer reads this list)
diff --git a/tools/extract/audit-selftest.sh b/tools/extract/audit-selftest.sh
index 76e8e82f..a86cf516 100755
--- a/tools/extract/audit-selftest.sh
+++ b/tools/extract/audit-selftest.sh
@@ -44,3 +44,4 @@ if (( found < planted )); then echo "SELFTEST FAIL: planted $planted, found $fou
 if ! grep -q "^$binsha " "$t/out/binaries.txt"; then echo "SELFTEST FAIL: NUL-byte blob not listed in binaries.txt"; exit 1; fi
 if ! grep -q "leak.gz(gzip):" "$t/out/secrets.txt"; then echo "SELFTEST FAIL: secret inside gzip blob not found"; exit 1; fi
 echo "SELFTEST PASS: planted $planted (one in a deleted file's history, one in a commit message, one in a NUL-byte blob, one gzipped), found $found; binary listed"
+bash "$here/audit-error-selftest.sh"