interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

GPU driver follow-ups from #441: PD walk, page-table overlap, stale free

Open · #493 · open 2026-10-30 21:46 UTC

Imported from GitHub aien-dev/aienux#493, by cursor[bot]

cursor[bot] wrote on 2026-10-30 21:46 UTC

Follow-ups from the security-boundary review on #441 (review 5718859842, head 9f50e634). M1, device removal while the DMA arena or an fd is still in use, is handled on that PR. These three were non-blocking there and are not fixed on it.

N2, gpu/gmmu.c L127 and L169: walk() follows PDE addresses read back from table memory without checking them. Check each against as->pt_pa[] (or the pool range) before ent().

N3, gpu/gmmu.c L206: ck_gmmu_map itself doesn't refuse a PA range that overlaps the page-table pool; only ck_gmem_init does (gpu_mem.c L17-19). Move that check into ck_gmmu_map, so a GPU mapping can never cover its own page tables.

N4, gpu/gpu_mem.c L129: free takes a bare pointer. A stale pointer to a reused slot frees the new buffer. Check gen at the API.

Line numbers are the review's, at 9f50e634.

Review: https://github.com/aien-dev/aienux/pull/441#pullrequestreview-5718859842

— Grokbot

drakestapleton wrote on 2026-10-30 21:59 UTC

Follow-up from AienuxReview's review 5719117982 on #441. Non-blocking; recorded here so it's tracked with the other #441 follow-ups.

Probe after remove: stale g.gone and a re-initialised lock

  • remove never resets g.gone, and probe calls mutex_init(&g.lock) again on every probe.
  • After a PCI remove and rescan, the device binds but every call returns -ENODEV. If an old fd is still open, the lock can be re-initialised while release() holds it.
  • Suggested fix: define the mutex once with DEFINE_MUTEX. In probe, return -EBUSY if gone is set and the open count or the live-mapping count is nonzero. Otherwise reset gone, info and doorbells before binding.

Optional guard on the arena size

  • Reject arena_mib=0 and values above SIZE_MAX >> 20, with no other upper cap. A fixed cap would reject the simulator's 192 MiB arena and the package + 9 MiB sizing.

Hardware-unverified: found by review only; nothing was loaded or run on hardware.

— Grokbot

did:key:z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd wrote on 2026-11-18 17:38 UTC

Recovered GitHub comment. Original issue #493 · posting receipt 904258562aae116bb68a03fc449dacfbd8f0bdb1df81b43574c683ea317e93f2

N2, N3 and the re-probe are in https://github.com/aien-dev/aienux/pull/504 (head d8583834). Re-run at that head: test-gpu-sim, gpu-sim-mutants, test-gpu-contract, gpu-contract-trace and both freestanding builds rc=0 (test_gpu_sim: PASS (244 checks), gpu-contract-trace: PASS (391 lines identical, hand vs contract)). N4 (gen-checked free) is still open: the free path is mirrored in gpu/contract/gen/gch_contract.c, whose generator crates/aienos-devc exists only on feat/devc-gpu (19992f84), not on main. Changing the free API needs that generator on main, or a decision to hand-edit generated code. That is Drake's call.

Sign in to comment