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

xhci: report a refused platform DMA release as CK_XHCI_E_RELEASE

merged 9565418bd493c602 #482 · opened 2026-10-30 12:37 UTC · closed 2026-10-30 13:15 UTC · merged 2026-10-30 13:15 UTC

Imported from GitHub aien-dev/aienux#482, by drakestapleton

Base a1fc1f34cd7c896a4c946b55b7634f4b2f5df5c7 · Head 099fb9103a342a7fc8d3e051ee240bf1b3aa443a

Merged on GitHub as ce2ce2ab21dad32ec9c1103a94a148179cf58892; reachable from main d01b2f19cccf3e173a6bdb3541813d467f537a76 (observed 2026-11-18T16:35:36Z)

drakestapleton wrote on 2026-10-30 12:37 UTC

A refused DMA abort on the ACPI platform xHCI fallback was reported as success. plat_fence_all() returned CK_XHCI_E_RELEASE and set state to release-failed. ck_xhci_fence() then overwrote that with fenced and returned CK_XHCI_OK when the PCI halt had succeeded (hrc == 0, which the no-keyboard path requires). The stream stayed confined. The caller was told the release worked.

The PCI path just above already returns CK_XHCI_E_RELEASE and leaves release-failed. The platform path now returns that code immediately after plat_fence_all(), and leaves the state plat_fence_all() already set.

Only CK_XHCI_E_RELEASE is propagated. plat_fence_all() turns a still-live stream into CK_XHCI_E_RELEASE before it returns, so that code is the one that means a stream is still confined. The other non-OK results happen before a grant, and the PCI controller is already released:

  • CK_XHCI_E_ARG (ambiguous name, bad or unmappable BAR)
  • CK_XHCI_E_HALT (halt before grant)
  • CK_XHCI_E_DMA (allocation before grant)
  • CK_XHCI_E_DENIED (SMMU deny)

CK_XHCI_ABSENT is not reached from this fallback. The fallback only runs when g_nplat > 0. Those other codes stay the PCI fence's result (CK_XHCI_OK / fenced on the no-keyboard path). A host case locks the deny path: a named confine of CK_SMMU_ABSENT still returns CK_XHCI_OK, state fenced, log denied (NoSmmu).

CK_XHCI_E_HALT before a grant does not install a stream. Firmware DMA if that halt failed is the existing halt path, not this reporting bug. Real ACPI platform xHCI behaviour is hardware-unverified.

virtio-net's init-failure, window-map-failure, and final-release paths could return CK_NET_E_INIT, CK_NET_E_ARG, or the original rc while n->confined stayed 1. They now return CK_NET_E_SMMU when the stream is still confined. A passing selftest whose bus master is still on still returns CK_NET_E_SMMU. A second bind while live still returns CK_NET_E_ARG. QEMU scripts match log lines (virtio_net: init FAIL, virtio_net=selftest-failed), not the C return code. devices.c treats only netrc == 0 as selftest-ok.

The optional ck_dma_unconfine distinct-error-code change is not included. The real function is static state in smmu_svc.c and is not linked into the stage host binary (ck_host.c is the mock; linking both would duplicate symbols). Distinguishing "not confined" from "confined on two SMMUs" needs an IORT, a model SMMU, page tables, and two instances. That is more than a few lines. Multi-SMMU behaviour is hardware-unverified.

Tests

Host only. Nothing here ran on real hardware. QEMU gates (scripts/qemu_ck_net_test.sh and the keyboard and SMMU QEMU gates) were NOT_RUN. stage-free was NOT_RUN on this x86_64 host: the freestanding flags (-mgeneral-regs-only, -mno-outline-atomics, -fno-tree-loop-distribute-patterns) are not supported by the x86_64 compiler. That is the ARM image build, not this patch.

Unpatched production lines (the early return and the three n->confined checks removed, tests left in), stage_test:

  • platform fallback rc=0 state=fenced live=1
  • FAIL ./svc/tests/stage_test.c:2815: rc == CK_XHCI_E_RELEASE
  • FAIL ./svc/tests/stage_test.c:2816: strcmp(ck_xhci_state(), "release-failed") == 0
  • virtio-net release rc=-504 live=1
  • FAIL ./svc/tests/stage_test.c:2901: rc == CK_NET_E_SMMU
  • CK_STAGE_HOST: FAIL checks=900 failures=3

The PCI-only refused release and the platform deny case did not fail on the unpatched tree. The PCI path already returned CK_XHCI_E_RELEASE.

With the fix, STAGE_CC=gcc make -C native/kernel -f stage.mk stage-test and stage-sanitize:

  • platform fallback rc=-606 state=release-failed live=1
  • virtio-net release rc=-508 live=1
  • CK_STAGE_HOST: PASS checks=900 failures=0
  • CK_DISK_PART_HOST: PASS, translation-bypass mutant caught by 26 checks
  • CK_USB_AUDIO_TEST: PASS checks=122 failures=0
  • CK_PI5_STORE_HOST: PASS, CK_PI5_UNLOCK_HOST: PASS, CK_PI5_FACT_HOST: PASS, CK_PI5_AGENT_HOST: PASS
  • ASan/UBSan stage-sanitize: same stage host result, PASS checks=900 failures=0

crumb verify with the compiler pinned in crumb.lock (d0f0b95d344b4c6628c3d868346932fd247ce168):

crumb verify: OK: 96 crumbs current

Default cc on this VM is clang 18. It rejects an existing -Wstring-plus-int in dev/tests/pi5_agent_test.c, which this change does not touch. gcc 13 (STAGE_CC=gcc) builds the suite clean.

Fixes #478

— Grokbot

<div><a href="https://cursor.com/agents/bc-33309ce7-ba3d-5277-8cc1-c45464e3186e?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-33309ce7-ba3d-5277-8cc1-c45464e3186e&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>

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

DMA-fence security review at f234fd4874fd1c9fe7939cccc007dea9ce8e4c1d (COMMENT, not an approval). Host-shim evidence only: a real ACPI platform xHCI and multi-SMMU behaviour are hardware-unverified, and the QEMU net/keyboard/SMMU gates were NOT_RUN.

Verdict: the fix for #478 is correct and complete for the paths it claims. I found no remaining path that reports success after a refused release, and nothing to fix before merge. The two pre-existing reporting gaps in devices.c listed below are outside this diff and non-blocking.

1. No success after a failed release: PASS

  • ck_xhci_fence, PCI path: after ck_xhci_release() (xhci_fence.c:448), a live stream sets release-failed and returns CK_XHCI_E_RELEASE (:449-452), before any platform attempt.
  • Platform fallback:
    • plat_fence_all turns any CK_XHCI_E_RELEASE or still-live stream into release-failed / CK_XHCI_E_RELEASE (:344-347).
    • The new early return (:462) passes that code out before the x->state = "fenced" overwrite (:464) and the hrc-based return (:466). This was the #478 bug, and it is closed.
    • The other prc values (ARG at :271-285, HALT at :294-297, DMA at :300-303, DENIED at :314-317) all return before x->confined = 1 (:320), so no stream exists, and the PCI controller was already shown released at :449. Keeping the PCI result (CK_XHCI_OK/fenced) is correct.
  • No-PCI path: return plat_fence_all() was already correct and is unchanged.
  • Transient state: plat_fence_one sets fenced (:327) before its own release (:328). That is transient only, because plat_fence_all overwrites it at :345 whenever the stream stays live.
  • Live re-entry: re-entering while live returns CK_XHCI_E_ARG (:359-363, and :255-259 per controller). That is not a success, but the code collides with genuine argument errors; this is #480's territory and deliberately left out.
  • virtio-net (net_bind.c):
    • The window-map failure (:398), init failure (:413) and final release (:435) now all return CK_NET_E_SMMU while n->confined is set.
    • The DMA (:372-377) and DENIED (:381-386) returns happen before n->confined = 1 (:388).
    • A stuck bus master on a failed selftest keeps its original non-OK rc, so it is still not a success.
  • NVMe (devices.c:80-110): unchanged by this PR. ck_dev_nvme_release clears claimed only when !bm_on && !confined && !stuck (:109), and the failed-bind path calls it (:140).

2. No free or reuse of a still-confined device, stream or buffer: PASS

  • xHCI: the shared g_dma_mem (xhci_fence.c:299, :401) is reused only after the live checks at :359-363 / :255-259. A failed abort keeps x->confined and stream_id (:177-181).
  • Platform → PCI handover: the fallback runs only after the PCI stream is shown released (:449).
  • virtio-net: the memset(n, 0, ...) and the reuse of g_dma_mem (net_bind.c:368-372) are behind the ck_net_live() guard (:363-366). ck_net_release keeps confined/stream_id when the abort fails (:122-128).
  • NVMe: keeps ownership while confined (devices.c:98-109).
  • Allocations: ck_dma_alloc buffers are never freed, so none of these paths can free them.
  • Test-only reset: the new ck_xhci_host_forget (xhci_fence.c:192-207) refuses while live and is compiled only under CK_HOST_TEST.

3. Callers handle the new codes: PASS, with two non-blocking reporting notes

  • Callers: ck_xhci_fence has only two: devices.c:158 (and ck_xhci_session → devices.c:241). ck_net_bind_selftest has only devices.c:148.
  • No caller checks only for rc == OK in a way that treats the new codes as benign:
    • The net summary counts only netrc == 0 as selftest-ok (:150).
    • The xHCI result is printed with ck_xhci_state() (release-failed) and its rc (:159).
    • The recovery halt re-checks every *_live() and panics if any DMA is live (:173-177).
  • There is no syscall or console code-to-name mapping for these codes, only numeric printing, so nothing else needs updating.
  • Pre-existing, outside this diff (non-blocking): ck_stage_quiesce reports success without re-checking.
    • devices.c:221 prints quiesce before reset virtio_net=released-now unconditionally after ck_net_release().
    • devices.c:219-220 prints nvme=released-now from was_live without re-checking.
    • Both can report a release that was refused. The rtl8127 and xHCI lines (:223-224) already re-check.
    • Exact fix: use ck_net_live() ? "LIVE" : "released-now" on the virtio_net line, and on the NVMe line use was_live ? ((g_nvme.bm_on || g_nvme.confined) ? "LIVE" : "released-now").
  • Optional: devices.c:150 could print selftest-failed (LIVE) when ck_net_live() is true.

4. Tests: PASS (host mock), one coverage gap

  • What they use: the tests drive the existing ck_host_unconfine_fail mock. They add ck_host_unconfine_allow, so the PCI abort succeeds and the platform abort is the one refused, plus an injected ACPI device (ck_host_plat_set) and a ck_dma_confine_named result.
  • xHCI platform fallback (stage_test.c test_xhci_release_refused):
    • asserts CK_XHCI_E_RELEASE, release-failed, live == 1, 2 grants (PCI then ACPI name), and abort FAILED, stays confined
    • checks that re-entry is refused with no new grant
    • checks that the deny control still gives CK_XHCI_OK/fenced/denied (NoSmmu)
    • On the old code this returns CK_XHCI_OK/fenced, so it fails, which matches the 3 unpatched failures in the PR body.
  • virtio-net (test_net_release_refused): covers the init-failure path, with CK_NET_E_SMMU, live, bus master revoked, no re-bind while live, and a clean re-bind after release. The old code returned CK_NET_E_INIT, so it fails.
  • Gap (non-blocking):
    • The window-map failure (net_bind.c:398) and the final-release path with a non-OK rc (:435) have no test of their own.
    • A caps region outside its BAR would cover :398.
    • Flake risk: the xHCI test relies on a 20 µs polling pthread register model, which could be flaky under load. Consider generous halt timeouts there.

5. Scope, CI and mergeability: PASS

  • Files: net_bind.c (+5/-1) and .h (comment only), xhci_fence.c (+21: the one-line fix plus a CK_HOST_TEST-only helper), xhci_fence.h (+4, CK_HOST_TEST only), the host mock (ck_host.c/.h), stage_test.c, and crumbs.
  • No Makefile, workflow or SMMU-service change. #480's distinct EARG codes are not included, as claimed.
  • Mergeability: mergeable: true, mergeable_state: clean, base 4f7f13d8.
  • CI: these succeeded: AIEN Checks, sbom, CodeQL, Analyze (actions, c-cpp, python, rust). AIEN Alpha was skipped.

Evidence: host stage suite 900/900 with the fix and 3 failures unpatched (author-reported; I did not re-run it). No QEMU or hardware runs. A real ACPI platform xHCI and multi-SMMU behaviour are hardware-unverified.

— Grokbot

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

Head re-check at 099fb9103a342a7fc8d3e051ee240bf1b3aa443a (COMMENT, not an approval).

Since f234fd48, this head adds only two main merges and regenerated crumbs:

  • 595140e5 merges main 77514f7e (#475) into f234fd48.
  • 099fb910 merges main a1fc1f34 (#391, current main) into 595140e5.

Files from main match main exactly. Every non-crumb file changed since f234fd48 has the same blob as at a1fc1f34:

  • the workflows aien-verification.yml, copilot-setup-steps.yml and sbom.yml, plus the new osc-code-flip-guard.yml
  • the two osc evidence logs
  • GATES.md, native/kernel/Makefile, osc_admit.c and qemu_ck_osc_receipt_test.sh

None of them differ from main, so nothing was hand-edited. The PR adds no code, test or workflow changes of its own.

5 regenerated crumbs: .crumb, native/.crumb, native/kernel/.crumb, native/kernel/core/.crumb and scripts/.crumb.

Fix and test files are unchanged. Excluding crumbs, the net diff against main is the same 7 files with the same blobs as at f234fd48:

  • dev/xhci_fence.c 67778129, dev/xhci_fence.h 7a02773d
  • dev/net_bind.c 6887e2e4, dev/net_bind.h 97c3ce21
  • svc/tests/ck_host.c fb26508c, ck_host.h d443edd3, stage_test.c cc8cfb1a

CI at this SHA is green. These all succeeded: AIEN Checks, osc-code-flip-guard, sbom, CodeQL, and Analyze (actions, c-cpp, python, rust). AIEN Alpha was skipped. The PR is mergeable and clean.

Caveats. Real platform xHCI and multi-SMMU are hardware-unverified. Follow-ups #489 and #490 are tracked.

— Grokbot

Fetch it

A git bundle of the pull request's head, 12916 bytes.

curl -fsSL https://interplane.io/drakestapleton/aienux/patches/9565418bd493c602.bundle -o 9565418bd493c602.bundle
git fetch 9565418bd493c602.bundle refs/pull/482/head

Raw bundle · 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/aienux
482
099fb9103a342a7fc8d3e051ee240bf1b3aa443a
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":482,"url":"https://github.com/aien-dev/aienux/pull/482","export_sha256":"222ed873664c8b6770fec92487a3521a4b5f81629ee6399038e519facf854bee","imported_utc":"2026-11-18T16:35:36Z"}

Changes

diff --git a/.crumb b/.crumb
index bf5266b4..1842c96f 100644
--- a/.crumb
+++ b/.crumb
@@ -33,14 +33,14 @@
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "1f02102b90f85ebe5f0adbf744447263e1731feb1e6182185382e630698f50dc",
-          "last_commit": "b49f84eb",
+          "digest": "871748acc4c06434293d833e95acc5ca0063361e71a75c4cc545bd5028af50b6",
+          "last_commit": "d41d5c2b",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
           "digest": "2eeb83a186f413cd87d904a1bff118758e10bc3921c288762c2e07d87d21e503",
-          "last_commit": "d288a845",
+          "last_commit": "8182d6d3",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         },
@@ -51,15 +51,15 @@
           "purpose": "First-party host artifact preparation tools"
         }
       ],
-      "children_root": "sha256:7c5deeeae4fe5eb1611e24cd00c6059f931140e4d331fa93be5decee6019e889",
-      "compiled_at": "2026-10-30T12:55:07Z",
+      "children_root": "sha256:d1820360796b68a79c143355fa8c7b6d36b1886d7d8dd6bf54c593e83106e8fc",
+      "compiled_at": "2026-10-30T13:06:28Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:c0e132c3e3a85983b035d63af5c24fed0cd9e8e2345232f6e9dd7fdd61a01325",
+      "digest": "sha256:7ae6b69a0de99da6a409490cd158f041a6fed957be1c0d47b1328f90cd373795",
       "evidence_files": 238,
       "evidence_root": "sha256:7a2a6f0fd6318a14bc86b8707a3bf324f2ed8e5c55403e5a01ab2e8df45ff308",
       "files": 3586,
-      "generated_at_commit": "df4352e4c8ff118ebce8c01f77897158ad5795ae",
-      "source_tree": "sha256:845a5188c28f7a14af7cc3ea19238576fe38a8ed8a6167b690731815f0bc8215"
+      "generated_at_commit": "595140e5bd22ebbe9b14d5c9abb683f44a0fa11c",
+      "source_tree": "sha256:902ecdc8c89ba8ebd84862899c737b08ac45e3d7c5e1dc8e11ea23bcc9c98c5a"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/.crumb b/native/.crumb
index d33268ff..f5ff4423 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -79,8 +79,8 @@
           "purpose": "Directory native/disk. Purpose not yet described by a human."
         },
         {
-          "digest": "466925f29e7cac39d858d1c12f982e65f288fc2d51b07712dba7c07d67b815e4",
-          "last_commit": "8c023766",
+          "digest": "f3976d31e569c32a762d471a506f10eb96b9278ca8b2070801487560f3a37f48",
+          "last_commit": "d41d5c2b",
           "name": "kernel",
           "purpose": "Directory native/kernel. Purpose not yet described by a human."
         },
@@ -115,15 +115,15 @@
           "purpose": "Directory native/store. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:74390fa3225744b511df76ca77b020a50a6c955c13eebd77419a961e25140087",
-      "compiled_at": "2026-10-30T12:20:30Z",
+      "children_root": "sha256:8be3d44aab9400ece8fa18db46c9b3a222e818af5c1c004dc6ea917d57f089dc",
+      "compiled_at": "2026-10-30T13:06:28Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:1f02102b90f85ebe5f0adbf744447263e1731feb1e6182185382e630698f50dc",
+      "digest": "sha256:871748acc4c06434293d833e95acc5ca0063361e71a75c4cc545bd5028af50b6",
       "evidence_files": 24,
       "evidence_root": "sha256:ecc7ccf2e924c221a5bac1d91e23b13d8f3c8d78c2a893a882ed7ca5e88d855d",
       "files": 676,
-      "generated_at_commit": "b49f84eb422b789626be68886e8ea90ec08cedd5",
-      "source_tree": "sha256:cd811f200f5cd4890d077459709ce4c3690d8321e7e981f749733f5537b85a05"
+      "generated_at_commit": "595140e5bd22ebbe9b14d5c9abb683f44a0fa11c",
+      "source_tree": "sha256:bd98a7f271e3a2407afcc4325d64664630ccc51f02ac27b65d3408566a0d68fb"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index c95eff57..30368f86 100644
--- a/native/kernel/.crumb
+++ b/native/kernel/.crumb
@@ -58,13 +58,13 @@
         },
         {
           "digest": "d4196275e1dc11d6b92d0fe9b90bbd9b7bbef17cd4ec63bc2fb09acfa7bd7b90",
-          "last_commit": "d288a845",
+          "last_commit": "dfdd5a72",
           "name": "core",
           "purpose": "Directory native/kernel/core. Purpose not yet described by a human."
         },
         {
-          "digest": "c943647976dcb5c770e04fc9da06f921c581866c680449cb5a483de3226e4483",
-          "last_commit": "8182d6d3",
+          "digest": "bc4d7808a4b43b8ebe3e68df30b702819e08783c49de07fd0e049f19f8e34845",
+          "last_commit": "f2071203",
           "name": "dev",
           "purpose": "Directory native/kernel/dev. Purpose not yet described by a human."
         },
@@ -81,8 +81,8 @@
           "purpose": "Directory native/kernel/mm. Purpose not yet described by a human."
         },
         {
-          "digest": "007a51e72c3f3064b7ad4c12575067a8db6c71d9820d057ab7aa101e129e431a",
-          "last_commit": "8182d6d3",
+          "digest": "e0a0bed1e95c876ea3d0a2dc136b94d3744491e72d5809c11de6ff787b21fd0a",
+          "last_commit": "f2071203",
           "name": "svc",
           "purpose": "Directory native/kernel/svc. Purpose not yet described by a human."
         },
@@ -99,15 +99,15 @@
           "purpose": "Hosted (Linux-built) checkers for the native kernel, run by `make -C native/kernel test`; nothin"
         }
       ],
-      "children_root": "sha256:2830fb8909c2f0daf4d958ef74919ba75272df6bcdf790a510559d6578ba203b",
-      "compiled_at": "2026-10-30T12:19:24Z",
+      "children_root": "sha256:051fc2730b7a0431ca3a2819a4936f2a5a2ab49192e0c18d0a96393e04a27055",
+      "compiled_at": "2026-10-30T13:06:28Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:466925f29e7cac39d858d1c12f982e65f288fc2d51b07712dba7c07d67b815e4",
+      "digest": "sha256:f3976d31e569c32a762d471a506f10eb96b9278ca8b2070801487560f3a37f48",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 429,
-      "generated_at_commit": "84ee2a02f78229167998d21a8ff03fe65bedb821",
-      "source_tree": "sha256:2784eac2c1866d2f4ce8a87b27ce5f02fd5e19aa0579347c9b77f36e7f4d4b77"
+      "generated_at_commit": "595140e5bd22ebbe9b14d5c9abb683f44a0fa11c",
+      "source_tree": "sha256:091dc3feafccd2e486dcd472082cc9de8c627af6727ce48141607bc00776ab3c"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/dev/.crumb b/native/kernel/dev/.crumb
index d1705067..5d9848f8 100644
--- a/native/kernel/dev/.crumb
+++ b/native/kernel/dev/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-30T02:45:55Z",
+      "compiled_at": "2026-10-30T12:35:18Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:c943647976dcb5c770e04fc9da06f921c581866c680449cb5a483de3226e4483",
+      "digest": "sha256:bc4d7808a4b43b8ebe3e68df30b702819e08783c49de07fd0e049f19f8e34845",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 48,
-      "generated_at_commit": "180618ae4336b33d9310046b94496bd9b4f4f4c5",
-      "source_tree": "sha256:0eb9f7775dc4e5f4a9edb209fdd6158f5fc45147ac445eb1d6410a45d0f0d7bb"
+      "generated_at_commit": "aab6de6d4df4b4d99e764e91303a13d10684f5fe",
+      "source_tree": "sha256:ed306c8c5368da4a67f7908d316aa3a403c7221f001f9cdf7abc8eb69535f511"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/dev/net_bind.c b/native/kernel/dev/net_bind.c
index 0fc3227b..6887e2e4 100644
--- a/native/kernel/dev/net_bind.c
+++ b/native/kernel/dev/net_bind.c
@@ -395,6 +395,7 @@ int ck_net_bind_selftest(const pci_func *f, const virtio_pci_caps *caps)
         if (!n->win[i] && i != VNET_WIN_ISR) { /* ISR is unused (polled driver) */
             ck_printf("virtio_net: not bound (capability window %d outside its BAR)\n", i);
             ck_net_release();
+            if (n->confined) return CK_NET_E_SMMU; /* abort refused: stream still confined */
             return CK_NET_E_ARG;
         }
     }
@@ -409,6 +410,7 @@ int ck_net_bind_selftest(const pci_func *f, const virtio_pci_caps *caps)
     if (e != VNET_OK) {
         ck_printf("virtio_net: init FAIL (%s)\n", vnet_err_name(e));
         ck_net_release();
+        if (n->confined) return CK_NET_E_SMMU; /* abort refused: stream still confined */
         return CK_NET_E_INIT;
     }
     const uint8_t *m = n->dev.mac;
@@ -428,6 +430,8 @@ int ck_net_bind_selftest(const pci_func *f, const virtio_pci_caps *caps)
     if (!n->dev.has_mac) ck_printf("net: no MAC offered by the device; round trip not attempted\n");
     ck_printf("net: selftest %s (rc=%d)\n", rc == CK_NET_OK ? "PASS" : "FAIL", rc);
     ck_net_release();
-    if (rc == CK_NET_OK && ck_net_live()) rc = CK_NET_E_SMMU; /* stream still confined: not released */
+    /* A refused abort leaves the stream confined. A passing selftest whose
+     * bus master is still on is not released either. */
+    if (n->confined || (rc == CK_NET_OK && ck_net_live())) rc = CK_NET_E_SMMU;
     return rc;
 }
diff --git a/native/kernel/dev/net_bind.h b/native/kernel/dev/net_bind.h
index 59b68a34..97c3ce21 100644
--- a/native/kernel/dev/net_bind.h
+++ b/native/kernel/dev/net_bind.h
@@ -55,7 +55,7 @@ enum {
     CK_NET_E_ARP = -505,     /* no ARP reply from the gateway in time */
     CK_NET_E_TX = -506,      /* frame build, post or completion failed */
     CK_NET_E_RX = -507,      /* no matching UDP reply in time, or device broken */
-    CK_NET_E_SMMU = -508,    /* SMMU negative test or its recovery failed */
+    CK_NET_E_SMMU = -508,    /* SMMU negative test, its recovery, or a refused release abort */
 };
 
 /* Attach (DMA gate, BAR map, bus master, vnet_init_flags with
@@ -64,7 +64,9 @@ enum {
  * trip (CK_NET_E_SMMU if either fails), every wait bounded by ck_time_us.
  * Leaves the device released (reset, bus master off, stream back to abort)
  * before returning, unless the SMMU refuses the abort: the stream then stays
- * confined, ck_net_live stays 1 and a passing selftest returns CK_NET_E_SMMU. */
+ * confined, ck_net_live stays 1, and the bind returns CK_NET_E_SMMU. A bus
+ * master that will not clear is still live, but that is not an SMMU refusal:
+ * the original error stands (a passing selftest still returns CK_NET_E_SMMU). */
 int ck_net_bind_selftest(const pci_func *f, const virtio_pci_caps *caps);
 
 /* Reset the device, revoke bus mastering and return the SMMU stream to
diff --git a/native/kernel/dev/xhci_fence.c b/native/kernel/dev/xhci_fence.c
index f349135a..67778129 100644
--- a/native/kernel/dev/xhci_fence.c
+++ b/native/kernel/dev/xhci_fence.c
@@ -188,6 +188,22 @@ void ck_xhci_release(void)
  * from firmware tables. */
 static struct ck_platform_dev g_plat[CK_XHCI_PLAT_MAX];
 static int g_nplat = -2; /* -2 not scanned yet, -1 no DSDT */
+#ifdef CK_HOST_TEST
+int ck_xhci_host_forget(void)
+{
+    if (ck_xhci_live()) return -1;
+    g_nplat = -2;
+    g_x.pf = 0;
+    g_x.plat = 0;
+    g_x.name[0] = 0;
+    g_x.bar0 = 0;
+    g_x.op = 0;
+    g_x.bm_on = g_x.confined = g_x.mapped = 0;
+    g_x.stream_id = 0;
+    g_x.state = "absent";
+    return 0;
+}
+#endif
 
 static void acpi_discover(void)
 {
@@ -439,6 +455,11 @@ int ck_xhci_fence(const pci_system *pci)
         ck_printf("keyboard: none on the PCI xHCI; trying %d ACPI platform controller(s)\n", g_nplat);
         x->pf = 0;
         int prc = plat_fence_all();
+        /* A refused abort leaves that platform stream confined. Other
+         * platform errors (deny, halt, bad BAR, no DMA page) happen before
+         * a grant, and the PCI controller is already released, so those
+         * stay the PCI fence's result. */
+        if (prc == CK_XHCI_E_RELEASE) return prc;
         if (prc == CK_XHCI_OK) return CK_XHCI_OK;
         x->state = "fenced";
     }
diff --git a/native/kernel/dev/xhci_fence.h b/native/kernel/dev/xhci_fence.h
index 3c1bfd63..7a02773d 100644
--- a/native/kernel/dev/xhci_fence.h
+++ b/native/kernel/dev/xhci_fence.h
@@ -107,4 +107,8 @@ int ck_xhci_sweep_enabled(void);
 void ck_xhci_after_sweep(const pci_system *pci);
 /* Short state for the devices summary line: absent, fenced, denied, ... */
 const char *ck_xhci_state(void);
+#ifdef CK_HOST_TEST
+/* Host tests only: forget the one-shot ACPI scan. -1 while a stream is live. */
+int ck_xhci_host_forget(void);
+#endif
 #endif
diff --git a/native/kernel/svc/.crumb b/native/kernel/svc/.crumb
index 2fdda680..46f4f204 100644
--- a/native/kernel/svc/.crumb
+++ b/native/kernel/svc/.crumb
@@ -18,26 +18,26 @@
       "children": [
         {
           "digest": "d6868c343497f05846433dd6f9e76a5beb0f51a3a38e70fb9ad2c6518d5c9514",
-          "last_commit": "f45d00a",
+          "last_commit": "f45d00ad",
           "name": "compat",
           "purpose": "Directory native/kernel/svc/compat. Purpose not yet described by a human."
         },
         {
-          "digest": "21cee3bc8b668eb671eb4231a76e8e2fa4f3f96d34db28bfb0666a1ab8796988",
-          "last_commit": "b50dc78",
+          "digest": "6602350f6b34e0e5a5582511e5ea65680f5d175c001bb4828ddb379f0429fc2a",
+          "last_commit": "8182d6d3",
           "name": "tests",
           "purpose": "Directory native/kernel/svc/tests. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:7cd392f0cc365296dbdcf38f51220da99ed2a31ae62bb7b47fa6a44fa66d5fe7",
-      "compiled_at": "2026-10-28T23:14:49Z",
+      "children_root": "sha256:a70bab0b29b9dbc45df8c0ac73476773e033270a3bbfbdc303964a3452799f7f",
+      "compiled_at": "2026-10-30T12:35:18Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:007a51e72c3f3064b7ad4c12575067a8db6c71d9820d057ab7aa101e129e431a",
+      "digest": "sha256:e0a0bed1e95c876ea3d0a2dc136b94d3744491e72d5809c11de6ff787b21fd0a",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 48,
-      "generated_at_commit": "b50dc7834e43ef8fbed1d8941467580b1395877a",
-      "source_tree": "sha256:15e78705087ef3ae892e8b78d14fe0cecb9c33092267f6bfdd5963208a0cf676"
+      "generated_at_commit": "aab6de6d4df4b4d99e764e91303a13d10684f5fe",
+      "source_tree": "sha256:0f2ae3117361a7d5debca6bb4a7bc06925c0f1089539b2933d4aaaf3ca13f575"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/svc/tests/.crumb b/native/kernel/svc/tests/.crumb
index f8f61a42..9c7133da 100644
--- a/native/kernel/svc/tests/.crumb
+++ b/native/kernel/svc/tests/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-28T23:14:49Z",
+      "compiled_at": "2026-10-30T12:35:18Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:21cee3bc8b668eb671eb4231a76e8e2fa4f3f96d34db28bfb0666a1ab8796988",
+      "digest": "sha256:6602350f6b34e0e5a5582511e5ea65680f5d175c001bb4828ddb379f0429fc2a",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 3,
-      "generated_at_commit": "b50dc7834e43ef8fbed1d8941467580b1395877a",
-      "source_tree": "sha256:9df370a5b767141387154676374e2be551c7751c70832cdae07f0e8b360de877"
+      "generated_at_commit": "aab6de6d4df4b4d99e764e91303a13d10684f5fe",
+      "source_tree": "sha256:0236c86e573f491ff73834e98d0a2067caf3588684381476abb0655f8dc8e861"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/svc/tests/ck_host.c b/native/kernel/svc/tests/ck_host.c
index a2d4281c..fb26508c 100644
--- a/native/kernel/svc/tests/ck_host.c
+++ b/native/kernel/svc/tests/ck_host.c
@@ -107,8 +107,8 @@ void *ck_dma_alloc(size_t bytes, size_t align, uint64_t *phys)
     if (phys) *phys = (uint64_t)(uintptr_t)p;
     return p;
 }
-/* Host: no platform MMIO by default (the ACPI platform xHCI list is always
- * empty). A test may turn on identity mapping (ck_host_try_map_ok) and make
+/* Host: no platform MMIO by default (no DSDT unless ck_host_plat_set injects
+ * one). A test may turn on identity mapping (ck_host_try_map_ok) and make
  * one exact address fail (ck_host_try_map_fail).
  *
  * The fake also keeps a tiny page map so exclusive ownership and unmap can be
@@ -195,13 +195,36 @@ int ck_mmio_unmap_exclusive(uint64_t phys, size_t len)
     hmap[i].unmapped = 1;
     return mprotect((void *)(uintptr_t)lo, hi - lo, PROT_NONE) == 0 ? 0 : -1;
 }
-/* Host: no DSDT reachable (no FADT in ck_acpi_find). */
+/* Host: no DSDT unless a test injects one platform device (ck_host_plat_set). */
+static struct ck_platform_dev host_plat;
+static int host_plat_on;
+void ck_host_plat_set(const char *name, const char *hid, uint64_t mmio_base, uint64_t mmio_len)
+{
+    memset(&host_plat, 0, sizeof host_plat);
+    if (name)
+        for (size_t i = 0; i + 1 < sizeof host_plat.name && name[i]; i++) host_plat.name[i] = name[i];
+    if (hid)
+        for (size_t i = 0; i + 1 < sizeof host_plat.hid && hid[i]; i++) host_plat.hid[i] = hid[i];
+    host_plat.table[0] = 'D'; host_plat.table[1] = 'S'; host_plat.table[2] = 'D'; host_plat.table[3] = 'T';
+    host_plat.mmio_base = mmio_base;
+    host_plat.mmio_len = mmio_len;
+    host_plat_on = 1;
+}
+void ck_host_plat_clear(void) { host_plat_on = 0; }
 int ck_acpi_platform_devices(const char *const *ids, unsigned nids, struct ck_platform_dev *out, unsigned max,
                              struct ck_acpi_scan_info *info)
 {
-    (void)ids; (void)nids; (void)out; (void)max;
     if (info) info->tables = info->refused = info->devices = 0, info->first_refusal = 0;
-    return -1;
+    if (!host_plat_on) return -1;
+    if (info) info->tables = info->devices = 1;
+    int match = 0;
+    for (unsigned i = 0; i < nids && ids && ids[i]; i++)
+        if ((host_plat.hid[0] && strcmp(host_plat.hid, ids[i]) == 0) ||
+            (host_plat.cid[0] && strcmp(host_plat.cid, ids[i]) == 0))
+            match = 1;
+    if (!match) return 0;
+    if (out && max) *out = host_plat;
+    return 1;
 }
 void ck_mb(void) { __sync_synchronize(); }
 const void *ck_acpi_find(const char sig[4])
@@ -243,9 +266,13 @@ int ck_entropy_fill(void *buf, size_t len)
 
 /* Host: no IORT by default, so no SMMU (the NVMe gate stays fail-closed). A test may set
  * ck_host_confine_rc = 0 to model an SMMU that confines; every call is recorded.
- * ck_host_unconfine_fail = 1 models an SMMU that refuses the abort (CK_SMMU_FAILED). */
+ * ck_host_confine_named_rc is the ACPI-name path (platform xHCI). 
+ * ck_host_unconfine_fail = 1 models an SMMU that refuses the abort (CK_SMMU_FAILED).
+ * ck_host_unconfine_allow lets that many aborts succeed first, then the refusal starts. */
 int ck_host_confine_rc = CK_SMMU_ABSENT;
+int ck_host_confine_named_rc = CK_SMMU_ABSENT;
 int ck_host_unconfine_fail;
+unsigned ck_host_unconfine_allow;
 unsigned ck_host_confine_calls, ck_host_unconfine_calls;
 uint32_t ck_host_confine_segment, ck_host_confine_rid;
 uint64_t ck_host_confine_phys, ck_host_confine_len;
@@ -266,14 +293,27 @@ int ck_dma_confine(uint32_t segment, uint32_t rid, uint64_t phys, uint64_t len,
 }
 int ck_dma_confine_named(const char *acpi_name, uint64_t phys, uint64_t len, struct ck_dma_confinement *out)
 {
-    (void)acpi_name; (void)phys; (void)len; (void)out;
-    return CK_SMMU_ABSENT;
+    (void)acpi_name;
+    ck_host_confine_calls++;
+    if (ck_host_confine_named_rc == 0 && out) {
+        out->smmu_base = 0x13800000ull;
+        out->stream_id = 0x5u;
+        out->iova = phys;
+        out->len = len;
+    }
+    return ck_host_confine_named_rc;
 }
 int ck_dma_unconfine(uint32_t stream_id)
 {
     (void)stream_id;
     ck_host_unconfine_calls++;
-    if (ck_host_unconfine_fail) return CK_SMMU_FAILED;
+    if (ck_host_unconfine_fail) {
+        if (ck_host_unconfine_allow) {
+            ck_host_unconfine_allow--;
+            return 0;
+        }
+        return CK_SMMU_FAILED;
+    }
     return ck_host_confine_rc == 0 ? 0 : CK_SMMU_EARG;
 }
 int ck_dma_faults(uint32_t stream_id, struct ck_dma_fault *first)
diff --git a/native/kernel/svc/tests/ck_host.h b/native/kernel/svc/tests/ck_host.h
index 06765837..d443edd3 100644
--- a/native/kernel/svc/tests/ck_host.h
+++ b/native/kernel/svc/tests/ck_host.h
@@ -24,11 +24,17 @@ extern int ck_host_try_map_ok;            /* 1: ck_mmio_try_map is identity (def
 extern uint64_t ck_host_try_map_fail;     /* with try_map_ok: this exact phys still fails (0: none) */
 extern int ck_host_unmap_calls;           /* successful ck_mmio_unmap_exclusive calls */
 extern int ck_host_confine_rc;                 /* ck_dma_confine result (default CK_SMMU_ABSENT; 0 models a confining SMMU) */
+extern int ck_host_confine_named_rc;           /* ck_dma_confine_named result (default CK_SMMU_ABSENT; 0 grants) */
 extern int ck_host_unconfine_fail;             /* 1: ck_dma_unconfine refuses the abort (CK_SMMU_FAILED) */
+extern unsigned ck_host_unconfine_allow;       /* with unconfine_fail: this many calls still succeed, then it refuses */
 extern unsigned ck_host_confine_calls, ck_host_unconfine_calls;
 extern uint32_t ck_host_confine_segment, ck_host_confine_rid;
 extern uint64_t ck_host_confine_phys, ck_host_confine_len;
 void ck_host_mmio_reset(void);            /* forget every recorded mapping and the counter */
+/* One ACPI platform device the next ck_acpi_platform_devices scan can return.
+ * Cleared: the scan reports no DSDT, as on an unconfigured host. */
+void ck_host_plat_set(const char *name, const char *hid, uint64_t mmio_base, uint64_t mmio_len);
+void ck_host_plat_clear(void);
 void ck_host_capture_start(void);         /* record ck_printf/ck_puts text (even when quiet) */
 const char *ck_host_capture_text(void);   /* NUL-terminated text captured since start */
 void ck_host_capture_stop(void);
diff --git a/native/kernel/svc/tests/stage_test.c b/native/kernel/svc/tests/stage_test.c
index 5f7dd48f..cc8cfb1a 100644
--- a/native/kernel/svc/tests/stage_test.c
+++ b/native/kernel/svc/tests/stage_test.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <signal.h>
+#include <pthread.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
 #include "ck.h"
@@ -2703,6 +2704,220 @@ static void test_cortex_journal(void)
     unlink(img);
 }
 
+/* A tiny xHCI: HCRST completes and Run/Stop clears HCH, so the keyboard phase
+ * can reach "no device" instead of a register or reset timeout. Host only. */
+static uint8_t *volatile xhci_watch_bar[2];
+static volatile int xhci_watch_on;
+static uint32_t xhci_ld32(volatile uint8_t *p)
+{
+    return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);
+}
+static void xhci_st32(volatile uint8_t *p, uint32_t v)
+{
+    p[0] = (uint8_t)v;
+    p[1] = (uint8_t)(v >> 8);
+    p[2] = (uint8_t)(v >> 16);
+    p[3] = (uint8_t)(v >> 24);
+}
+static void *xhci_watch(void *arg)
+{
+    (void)arg;
+    while (xhci_watch_on) {
+        for (int i = 0; i < 2; i++) {
+            volatile uint8_t *bar = xhci_watch_bar[i];
+            if (!bar) continue;
+            uint32_t op = xhci_ld32(bar) & 0xffu;
+            if (op + 8u > 0x4000u) continue;
+            uint32_t cmd = xhci_ld32(bar + op), sts = xhci_ld32(bar + op + 4);
+            if (cmd & 2u) { /* HCRST: complete, leave the controller halted */
+                xhci_st32(bar + op, cmd & ~2u);
+                xhci_st32(bar + op + 4, (sts & ~0x800u) | 1u);
+            } else if (cmd & 1u) { /* RS: running */
+                if (sts & 1u) xhci_st32(bar + op + 4, sts & ~1u);
+            } else if (!(sts & 1u)) {
+                xhci_st32(bar + op + 4, sts | 1u);
+            }
+        }
+        usleep(20);
+    }
+    return 0;
+}
+
+/* Failed DMA release. Host shim only: nothing here is a real xHCI or SMMU.
+ * The PCI xHCI path already returns CK_XHCI_E_RELEASE. The platform fallback
+ * used to overwrite that with "fenced" and CK_XHCI_OK. virtio-net used to
+ * return CK_NET_E_INIT from a failed init even when the abort was refused. */
+static void test_xhci_release_refused(void)
+{
+    printf("  [xHCI release refused, host, not hardware]\n");
+    static uint8_t cfg[4096];
+    static uint8_t bar[0x4000] __attribute__((aligned(4096)));
+    static pci_system s;
+    memset(cfg, 0, sizeof cfg);
+    memset(bar, 0, sizeof bar);
+    put32(bar + 4, 1u); /* caplength 0, so op is 0 and this is USBSTS.HCH */
+    memset(&s, 0, sizeof s);
+    s.n = 1;
+    s.f[0].class_code = CK_XHCI_CLASS;
+    s.f[0].cfg = cfg;
+    s.f[0].bar[0].addr = (uint64_t)(uintptr_t)bar;
+    s.f[0].bar[0].size = sizeof bar;
+    s.f[0].bar[0].is64 = 1;
+    ck_host_confine_rc = 0;
+    ck_host_unconfine_fail = 1;
+    unsigned grants = ck_host_confine_calls;
+    ck_host_capture_start();
+    int rc = ck_xhci_fence(&s);
+    ck_host_capture_stop();
+    CHECK(rc == CK_XHCI_E_RELEASE && strcmp(ck_xhci_state(), "release-failed") == 0 && ck_xhci_live() == 1);
+    CHECK(ck_host_confine_calls == grants + 1);
+    CHECK(has(ck_host_capture_text(), "abort FAILED, stays confined"));
+    grants = ck_host_confine_calls;
+    CHECK(ck_xhci_fence(&s) == CK_XHCI_E_ARG && ck_host_confine_calls == grants && ck_xhci_live() == 1);
+    ck_host_unconfine_fail = 0;
+    ck_xhci_release();
+    CHECK(ck_xhci_live() == 0);
+
+    /* PCI controller the keyboard phase can finish on (no device, so NOKBD),
+     * then one ACPI platform controller whose abort is refused. */
+    printf("  [xHCI platform fallback release refused, host, not hardware]\n");
+    static uint8_t pbar[0x4000] __attribute__((aligned(4096)));
+    memset(bar, 0, sizeof bar);
+    put32(bar + 0x00, 0x01000020u); /* caplength 0x20 */
+    put32(bar + 0x10, 0x1u);        /* AC64 */
+    put32(bar + 0x14, 0x2000u);     /* doorbell */
+    put32(bar + 0x18, 0x1000u);     /* runtime */
+    put32(bar + 0x24, 1u);          /* USBSTS.HCH at op 0x20 */
+    put32(bar + 0x28, 1u);          /* pagesize bit 0 */
+    memset(pbar, 0, sizeof pbar);
+    put32(pbar + 0x00, 0x10u); /* caplength too small: keyboard phase returns at once */
+    put32(pbar + 0x14, 1u);    /* USBSTS.HCH at op 0x10, so the pre-grant halt succeeds */
+    CHECK(ck_xhci_host_forget() == 0);
+    ck_host_plat_set("USB0", "PNP0D10", (uint64_t)(uintptr_t)pbar, sizeof pbar);
+    ck_host_try_map_ok = 1;
+    ck_host_try_map_fail = 0;
+    ck_host_confine_named_rc = 0;
+    ck_host_unconfine_fail = 1;
+    ck_host_unconfine_allow = 1; /* PCI abort succeeds; the platform abort is the one refused */
+    pthread_t watch;
+    int watching = 0;
+    xhci_watch_bar[0] = bar;
+    xhci_watch_bar[1] = pbar;
+    xhci_watch_on = 1;
+    watching = pthread_create(&watch, 0, xhci_watch, 0) == 0;
+    CHECK(watching);
+    grants = ck_host_confine_calls;
+    ck_host_capture_start();
+    rc = ck_xhci_fence(&s);
+    ck_host_capture_stop();
+    const char *x = ck_host_capture_text();
+    printf("  platform fallback rc=%d state=%s live=%d\n", rc, ck_xhci_state(), ck_xhci_live());
+    CHECK(rc == CK_XHCI_E_RELEASE);
+    CHECK(strcmp(ck_xhci_state(), "release-failed") == 0);
+    CHECK(ck_xhci_live() == 1);
+    CHECK(ck_host_confine_calls == grants + 2); /* PCI requester, then the ACPI name */
+    CHECK(has(x, "abort FAILED, stays confined"));
+    CHECK(has(x, "trying 1 ACPI platform controller"));
+    grants = ck_host_confine_calls;
+    CHECK(ck_xhci_fence(&s) == CK_XHCI_E_ARG && ck_host_confine_calls == grants);
+    ck_host_unconfine_fail = 0;
+    ck_host_unconfine_allow = 0;
+    ck_xhci_release();
+    CHECK(ck_xhci_live() == 0);
+
+    /* A platform controller that is denied never holds a stream. The PCI
+     * fence already succeeded, so that error stays CK_XHCI_OK / "fenced". */
+    printf("  [xHCI platform fallback denied, host, not hardware]\n");
+    if (watching) {
+        xhci_watch_on = 0;
+        pthread_join(watch, 0);
+        watching = 0;
+    }
+    memset(bar, 0, sizeof bar);
+    put32(bar + 0x00, 0x01000020u);
+    put32(bar + 0x10, 0x1u);
+    put32(bar + 0x14, 0x2000u);
+    put32(bar + 0x18, 0x1000u);
+    put32(bar + 0x24, 1u);
+    put32(bar + 0x28, 1u);
+    memset(pbar, 0, sizeof pbar);
+    put32(pbar + 0x00, 0x10u);
+    put32(pbar + 0x14, 1u);
+    xhci_watch_on = 1;
+    watching = pthread_create(&watch, 0, xhci_watch, 0) == 0;
+    CHECK(watching);
+    ck_host_confine_named_rc = CK_SMMU_ABSENT;
+    ck_host_capture_start();
+    rc = ck_xhci_fence(&s);
+    ck_host_capture_stop();
+    x = ck_host_capture_text();
+    CHECK(rc == CK_XHCI_OK && strcmp(ck_xhci_state(), "fenced") == 0 && ck_xhci_live() == 0);
+    CHECK(has(x, "denied (NoSmmu)"));
+    if (watching) {
+        xhci_watch_on = 0;
+        pthread_join(watch, 0);
+    }
+    xhci_watch_bar[0] = xhci_watch_bar[1] = 0;
+    ck_host_plat_clear();
+    CHECK(ck_xhci_host_forget() == 0);
+    ck_host_try_map_ok = 0;
+    ck_host_mmio_reset();
+    ck_host_confine_rc = CK_SMMU_ABSENT;
+    ck_host_confine_named_rc = CK_SMMU_ABSENT;
+    ck_host_unconfine_fail = 0;
+    ck_host_unconfine_allow = 0;
+}
+
+static void test_net_release_refused(void)
+{
+    printf("  [virtio-net release refused, host, not hardware]\n");
+    static uint8_t cfg[4096];
+    static uint8_t bar[0x4000] __attribute__((aligned(4096)));
+    static pci_func vf;
+    memset(cfg, 0, sizeof cfg);
+    memset(bar, 0, sizeof bar);
+    memset(&vf, 0, sizeof vf);
+    vf.vendor = 0x1af4;
+    vf.device = 0x1041;
+    vf.cfg = cfg;
+    vf.bar[4].addr = (uint64_t)(uintptr_t)bar;
+    vf.bar[4].size = sizeof bar;
+    virtio_pci_caps caps;
+    memset(&caps, 0, sizeof caps);
+    caps.common_cfg = (virtio_pci_region){1, 4, 0, 0x1000};
+    caps.isr_cfg = (virtio_pci_region){1, 4, 0x1000, 0x1000};
+    caps.device_cfg = (virtio_pci_region){1, 4, 0x2000, 0x1000};
+    caps.notify_cfg = (virtio_pci_region){1, 4, 0x3000, 0x1000};
+    caps.has_notify_off_multiplier = 1;
+    caps.notify_off_multiplier = 4;
+    ck_host_confine_rc = 0;
+    ck_host_unconfine_fail = 1;
+    unsigned grants = ck_host_confine_calls;
+    ck_host_capture_start();
+    int rc = ck_net_bind_selftest(&vf, &caps);
+    ck_host_capture_stop();
+    const char *x = ck_host_capture_text();
+    printf("  virtio-net release rc=%d live=%d\n", rc, ck_net_live());
+    CHECK(rc == CK_NET_E_SMMU);
+    CHECK(ck_net_live() == 1);
+    CHECK((pci_r16(cfg, 4) & 0x4u) == 0); /* bus master revoked even though the abort failed */
+    CHECK(ck_host_confine_calls == grants + 1);
+    CHECK(has(x, "abort FAILED, stays confined"));
+    CHECK(!has(x, "returned to abort"));
+    grants = ck_host_confine_calls;
+    CHECK(ck_net_bind_selftest(&vf, &caps) == CK_NET_E_ARG); /* still live: release it first */
+    CHECK(ck_host_confine_calls == grants && ck_net_live() == 1);
+    ck_host_unconfine_fail = 0;
+    ck_host_capture_start();
+    ck_net_release();
+    ck_host_capture_stop();
+    CHECK(ck_net_live() == 0 && has(ck_host_capture_text(), "returned to abort"));
+    grants = ck_host_confine_calls;
+    CHECK(ck_net_bind_selftest(&vf, &caps) == CK_NET_E_INIT && ck_net_live() == 0);
+    CHECK(ck_host_confine_calls == grants + 1);
+    ck_host_confine_rc = CK_SMMU_ABSENT;
+}
+
 int main(void)
 {
     setvbuf(stdout, NULL, _IOLBF, 0);
@@ -2735,6 +2950,8 @@ int main(void)
     test_net_udp();
     test_rtl8127_bind();
     test_xhci_fence();
+    test_xhci_release_refused();
+    test_net_release_refused();
     test_usb_hid();
     printf("CK_STAGE_HOST: %s checks=%d failures=%d\n", failures ? "FAIL" : "PASS", checks, failures);
     return failures ? 1 : 0;