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

GitHub aien-dev/aienux#470 (code only)

merged derived 3198b823ad3477c8 #470

Imported from GitHub aien-dev/aienux#470 (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 832bcbd98fc59a6f7695aefa68223caa7e08df05 · Head 832bcbd98fc59a6f7695aefa68223caa7e08df05

drakestapleton reviewed (COMMENTED) on 2026-10-30 12:12 UTC

Post-merge review (COMMENT only): DMA/SMMU confinement after a failed abort

I read the full non-.crumb diff and checked dev/xhci_fence.c and core/smmu_svc.c at merge commit 2b77170d.

Verdict: this PR does not weaken any capability or DMA boundary. It makes release fail closed. If ck_dma_unconfine fails, the stream stays confined and the device stays owned (dev/devices.c ck_dev_nvme_release, dev/net_bind.c ck_net_release, dev/xhci_fence.c ck_xhci_release), and every later fence or bind refuses with CK_NET_E_SMMU or CK_XHCI_E_RELEASE. The SMMU state stays consistent too: core/smmu_svc.c:341-351 frees the STE slot (in->used[slot] = 0) only after ck_smmu_abort_ste succeeds. There is one follow-up on error reporting.

Findings

  1. The xHCI release failure is reported as success. This is the follow-up I'd fix. In dev/xhci_fence.c:438-445, when the PCI xHCI has no keyboard, ck_xhci_fence calls plat_fence_all(). If that returns CK_XHCI_E_RELEASE, the code still overwrites x->state = "fenced" (L443) and returns hrc ? CK_XHCI_E_HALT : CK_XHCI_OK (L445). The new "release-failed" state set at L328-331 is lost, and the caller sees OK while a platform stream is still confined and ck_xhci_live() is 1.
    • The DMA boundary still holds, because the stream stays confined and the next ck_xhci_fence refuses at L431-434.
    • Suggested fix: right after L441, add if (prc == CK_XHCI_E_RELEASE) return prc;, which keeps "release-failed".
  2. Only part of the new behavior has a test. svc/tests/stage_test.c case 6b covers only the NVMe refused-abort path and its retry. The same ck_host_unconfine_fail mock could also cover:
    • ck_net_release with confined kept, followed by ck_net_bind returning CK_NET_E_SMMU;
    • ck_xhci_release, then plat_fence_all and ck_xhci_fence returning CK_XHCI_E_RELEASE, including the state check from item 1.
  3. A stuck stream is only retried by the next release. Nothing retries the abort on its own. That is acceptable because it fails closed. However, the device keeps a live translation onto its own DMA window. Please confirm that the backing buffers (g_dma_mem for xHCI and the NVMe/net DMA pools) are never freed or reused while the matching confined flag is 1. If they can be, that buffer reuse is the next boundary to close.
  4. Ambiguous holders cannot be unconfined. core/smmu_svc.c:345-346 returns CK_SMMU_EARG both when the stream is not confined and when it is confined on two SMMUs. Callers now treat any non-zero return as "still confined", so a stream reported as ambiguous can never be released. That is fail-closed, so it's fine. A distinct code for "confined on two SMMUs" would make the console message clearer.
  5. Housekeeping.
    • The PR title still says "(draft, pending)", but the PR was merged.
    • The probe never calls ck_dma_faults, so SMMU fault events from a stream that could not be aborted are never drained or logged. The updated B7B-PHYSICAL-BOOT-PREP.md already says this. Draining them once on the release-failed path would give evidence of what the device was doing.

No revert is needed.

— Grokbot

Code

The head commit is on main: 832bcbd98fc59a6f7695aefa68223caa7e08df05.

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/aienux
470
832bcbd98fc59a6f7695aefa68223caa7e08df05
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":470,"url":"https://github.com/aien-dev/aienux/pull/470","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:30Z","metadata":"unavailable","state_derived":true}

Changes

There is no diff: the head commit is already on main.