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

branch main Branches Tags History

CUDApp / AUDIT_SCOPE.md

157 lines · 9903 bytes Raw Blame History Rendered
1# Audit scope
2
3Written for an outside, independent security audit. Revision described:
4`780a0af1f08c1786ea53a4e8702ca8bb1396fdbb` on `main`, 2026-10-26. Everything below is taken from
5the repository's own files at that revision; items marked NOT_RUN were not executed while writing
6this document.
7
8## What this repository is
9
10CUDA++ (repository name `CUDApp`) is the GPU half of the Omega runtime: a C library that writes
11NVIDIA sm_121 machine code (SASS) directly, launches it through its own user-space client for
12NVIDIA's open kernel module ioctls, and ships matrix multiply, attention, elementwise and
13mixture-of-experts libraries. It uses no CUDA toolkit, `nvcc`, PTX, `libcuda` or cuBLAS. It builds
14with `make` and `gcc` on Linux; it runs kernels only on the NVIDIA GB10 (DGX Spark) with open kernel
15module 580.173.02. What ships is `build/libomega_gpu.a` (copied to `build/libcudapp.a`). Host
16simulators, references and Python scripts under `tests/` and `tools/` are test oracles. Status:
17research stage; current native qualification of this checkout is NOT_RUN.
18
19## What to review, in priority order
20
211. `nvrm/nvrm.c`, `nvrm/nvrm.h`. The driver client: opens `/dev/nvidiactl`, `/dev/nvidia0` and
22 `/dev/nvidia-uvm`, allocates resource-manager objects, maps buffers at the same address for CPU
23 and GPU, builds the command ring and rings the doorbell. Check ioctl argument structures and
24 sizes against `third_party/nvidia-open-580.173.02/`, error handling on every call, and that
25 mappings cannot alias or outlive their objects.
262. `m16/m16_gpu_wait.c` and `m16/m16_native.c`. The completion wait (hard deadline never extended,
27 stall deadline restarted only on progress) and native path. Check that a hung GPU cannot hang
28 the process forever and that an unknown completion state stops further GPU work.
293. `src/omega_gpu_platform.h`, `src/omega_gpu_platform*.c`. The platform contract: typed handles,
30 explicit rights per buffer, no silent fallback, the `CUDAPP_MEM_RESERVE_MIB` reserve check
31 before allocation, refusal of CPU-polled buffers that are not GPU-uncached. AGENTS.md requires
32 approval before changing this contract.
334. `src/omega_gpu_session.*`, `src/omega_gpu_cmdlist.*`, `src/omega_gpu_engine.*`. Session
34 lifetime, command lists, shader-cache invalidation before new code runs, wait-for-idle between
35 dependent launches, and the job engine returning exactly one named failure.
365. `src/omega_blackwell_encoder.c`, `src/omega_blackwell_codegen*.c`, `src/omega_blackwell_qmd.c`,
37 and the libraries `src/omega_gpu_*_api.*`. Generated code and launch descriptors: check that
38 grid, block, register and shared-memory sizes and buffer bounds derived from caller shapes
39 cannot address memory outside the caller's buffers.
406. `src/omega_gpu_chip.c`. The qualified chip table consulted by `make doctor`.
417. `tools/doctor/cudapp_doctor.c` and `tools/zero-cuda-gate.sh`. Read-only diagnostics; check that
42 they cannot report READY or PASS for a wrong module version or a binary that imports CUDA.
438. `tools/interop/cubin_probe.c`. Links NVIDIA's `libcuda` and refuses to run unless
44 `SPARK_WINDOW` is set; check it is not reachable from any host target.
459. `tools/extract/audit-scan.sh` with `rules-secrets.txt` and `rules-private.txt`, and
46 `tools/extract/audit-selftest.sh`. The publication secret scan and its self-test.
4710. `.github/`. Issue templates, a pull request template and, added by the audit-readiness
48 change, `workflows/ci.yml`: `make test` (host-only targets, no GPU) on a GitHub-hosted
49 arm64 runner plus an SPDX SBOM artifact; actions pinned by commit sha, read-only token.
50 AGENTS.md states that CodeQL (C/C++ and Python) also runs on pull requests; how CodeQL is
51 configured is unknown from the repository.
52
53## Trust boundaries
54
55- Untrusted input: tensor shapes, sizes and buffers passed by callers of the library API
56 (`docs/runtime/API.md`, `src/omega_runtime_api.h`); environment variables `CUDAPP_MEM_RESERVE_MIB`,
57 `CUDAPP_DOCTOR_ROOT`, `AIEN_OMEGA_DGRAPH_BARRIER`, `AIEN_OMEGA_DGRAPH_PREFETCH`;
58 `/proc` and `/sys` contents read by the doctor.
59- Trusted: NVIDIA's open kernel module 580.173.02, its headers in `third_party/`, and the
60 signed GSP firmware. The kernel module enforces the privilege boundary between processes; this
61 library runs entirely in user space with the calling user's device-file permissions.
62- Shared memory: on the GB10 CPU and GPU share one memory, and every buffer is mapped at the same
63 address for both. A GPU kernel bug therefore corrupts host-visible process memory.
64- Isolated: host tests use simulators and a fake driver; they open no device.
65
66## Threat model summary
67
68- Assets: process memory shared with the GPU, the integrity of computed results, availability of
69 the machine (memory exhaustion freezes a DGX Spark per README), and other processes' GPU work.
70- Attackers considered: a caller passing hostile shapes or sizes; a misbehaving or hung GPU; a
71 wrong kernel module version; secrets leaking through committed receipts.
72- Defended: memory reserve refusal before the driver; bounded completion waits; refusal of work
73 after an unknown completion; doctor refusal of other module versions; ELF check that built
74 programs import no CUDA library; secret scanning before publication.
75- Not defended / explicitly out of scope: no driver-version or PCI-ID admission guard on direct
76 execution or library linking (README); host results are not hardware qualification; the
77 diagnostic is not a sandbox; one device and one process only; NVIDIA kernel module and firmware
78 bugs.
79
80## Build from source at a pin
81
82Linux with `git`, GNU `make` and `gcc` (`CC ?= gcc`, `-Wall -Wextra -Werror`). No CUDA toolkit.
83There is no compiler pin file; the doctor records the compiler version it was built with.
84
85```sh
86git clone https://github.com/aien-dev/CUDApp.git
87cd CUDApp
88make -j8
89```
90
91Build variables: `CC`, `OUT_DIR` (default `build`), `PHYSICS_DIR` (default `.`). The host build
92needs no GPU. On x86-64, `make test` is the portable suite: it uses the C encoder and C cubin writer and does not assemble the seeded AArch64 binding. Target-only commands are in `docs/OMEGA_HOST_TESTS.md` (issue #15).
93
94## Run every test
95
96```sh
97make test
98make test-native-artifact
99make zero-cuda-gate
100build/hello_gpu --sim
101python3 tools/figures/make_figures.py --check
102make doctor
103make hello-gpu
104./build/gpu_<name>_test --out receipt.json
105```
106
107- `make test`: every host-only target in `HOST_TESTS` (`Makefile`). Judge by exit code and the
108 last line `CUDA++ HOST TESTS PASS (<count> targets)`. The log contains `FAIL` and `ERROR` lines
109 by design (mutation tests and negative controls). About 7 minutes. NOT_RUN here.
110- `make test-native-artifact`: offline native artifact export test. NOT_RUN here.
111- `make zero-cuda-gate`: ELF metadata check with a self-test negative control. NOT_RUN here.
112- `build/hello_gpu --sim`: first kernel on the host warp simulator. NOT_RUN here.
113- `make_figures.py --check`: AGENTS.md records that it fails on current `main`
114 (`stale figures ...: stack.svg`). NOT_RUN here.
115- `make doctor`: reads `/proc`, `/sys`, `/dev` only; a non-GB10 host is expected to report NOT
116 READY.
117- `make hello-gpu` and the chip gates `build/gpu_*_test`: need a GB10 and an authorized GPU window
118 on the DGX Spark. NOT_RUN on a plain host.
119
120## Known limitations and NOT_RUN
121
122- Current native qualification of this checkout is NOT_RUN. The imported
123 `evidence/m16-blackwell-native-path-requalification-receipt.json` is an unauditable historical
124 summary whose raw logs are absent (README).
125- One device, one process; no streams or events; a timeout ends GPU use for the process.
126- No any-shape GEMM; several libraries are shaped for specific models (README table).
127- `tools/figures/make_figures.py --check` is known stale on `main`.
128- Some host tests call NVIDIA `nvdisasm` as a cross-check when it is installed.
129- `evidence/security-host-20261026/` records a host-only run with GPU NOT_RUN and full
130 `make test` NOT_RUN.
131
132## Dependencies and provenance
133
134- No lockfile at the root; C with no external libraries beyond libc and libm for the library.
135 Sub-component pins: `om/omega-bridge.lock` (omega-bridge commit for the Omega bindings and CI),
136 `om/pipeline/dependencies.lock`, `native/learn53/omega653.lock`,
137 `native/learn53/moe-closure.lock` and `tools/c5/omc.pin`.
138- Vendored: `third_party/nvidia-open-580.173.02/` (67 NVIDIA headers, MIT, unchanged,
139 `SHA256SUMS` in that folder). Mesa NVK/NAK is cited in comments for hardware facts, no code
140 copied. Notices in `THIRD_PARTY.md` and `NOTICE`. History and licence audit in `docs/AUDIT.md`,
141 `docs/LICENSE_PROVENANCE.md`, `docs/LICENSING_TRANSITION.md`.
142- AGENTS.md: no NVIDIA binary, cubin, PTX, firmware or NVIDIA tool listing goes in the repository.
143- Omega does not build these sources at a pin yet. omega-mv main has no `cudapp.lock`; it still
144 builds its own diverged copy of the GPU code (#106) and takes the driver client from physics-mv
145 (#107). The lock, with its `check-cudapp` target and `tools/cudapp-stage.sh`, is proposed in
146 the open draft omega-mv#924.
147- No network access at build or test time is documented. At the described revision the repository
148 had no GitHub Actions workflow files; the audit-readiness change adds `.github/workflows/ci.yml`
149 (item 10 above), whose only network use is fetching the pinned actions on the runner.
150
151## Evidence
152
153Receipts live in `evidence/<topic>/`, each recording what ran on a named commit. AGENTS.md: never
154edit or regenerate an existing receipt; new receipts go in a new folder. Status words in README and
155`ROADMAP.md` are PASS only with a receipt on a named commit. Cross-repository receipts, where filed,
156belong under `aien-dev/aien-receipts` `CUDApp/<sha>/`; whether any exist is unknown from the
157repository. Receipts are append-only and never edited.