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#211 (code only)

closed derived ba3972029d3b4cc9 #211

Imported from GitHub aien-dev/aienux#211 (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 33927b1fb8a67eb9f2758b19add337f1c2a18bdb · Head 59e46b12d304d7053804f16eb24dd4d4c565d11c

Apply it

git checkout -b patch-ba3972029d3b4cc9 33927b1fb8a67eb9f2758b19add337f1c2a18bdb
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/ba3972029d3b4cc9.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/aienux
211
59e46b12d304d7053804f16eb24dd4d4c565d11c
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":211,"url":"https://github.com/aien-dev/aienux/pull/211","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:35:57Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json b/evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json
new file mode 100644
index 00000000..4757ff57
--- /dev/null
+++ b/evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json
@@ -0,0 +1,42 @@
+{
+  "schema": "aienos.ck_gates.v1",
+  "started_utc": "2026-10-01T16:48:55Z",
+  "finished_utc": "2026-10-01T16:51:13Z",
+  "commit": "41aa0e6d47663e34fbec6890080e45983283dfa7",
+  "commit_subject": "ck: kernel entropy is RNDR or a hard refusal; no timer-WEAK fallback",
+  "tree_clean_before": true,
+  "tree_clean_after": true,
+  "quiet_flag": "/home/drakestapleton/workspace/.spark-quiet",
+  "quiet_flag_present_at_start": false,
+  "host": {"hostname": "spark-b87b", "arch": "aarch64", "kernel": "7.0.0-1019-nvidia", "cpu_model": "Cortex-A725;Cortex-X925"},
+  "qemu": {"binary": "/usr/bin/qemu-system-aarch64", "version": "QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18)"},
+  "firmware": {"aavmf_code": "/usr/share/AAVMF/AAVMF_CODE.no-secboot.fd", "aavmf_code_sha256": "4a4cb7f6d8106bb2a7dd8c763fab14b1810152136fc4304e5b728f0043e84f12", "aavmf_vars": "/usr/share/AAVMF/AAVMF_VARS.fd", "aavmf_vars_sha256": "b3b855c5a80310168051164986855692d1bdb06e67619856177965cd87c6774f"},
+  "nvme_dma_mode": "Confined (QEMU SMMUv3 stage 1, out-of-window DMA faulted); no-SMMU boot denied (NoSmmu); TEST-ONLY bypass image checked separately",
+  "children": [
+    {"name": "boot", "script": "scripts/qemu_ck_boot_test.sh", "present": true, "script_sha256": "d17a7e0f00081e935a804c092c9b05c0bd1f319f5dd5c8bd90f3982e8939c3c8", "exit": "0", "seconds": 6, "log_sha256": "447ecd4b53a12c9b8d747955f23a6c487f799e84e4573e6fd7ff3f2e7efe0e69", "log_lines": 24},
+    {"name": "store", "script": "scripts/qemu_ck_store_test.sh", "present": true, "script_sha256": "6fb846356c9895472600bfce6f5b4daec03c0cdde464f8d0558238cc4d2da947", "exit": "0", "seconds": 87, "log_sha256": "43b52ce4b0444704e7f2b232e0c313e1332ae279dc9a773655de819e6910470a", "log_lines": 582},
+    {"name": "net", "script": "scripts/qemu_ck_net_test.sh", "present": true, "script_sha256": "ff5bdf5246950bc9e825c76ecc541f39460b88c181a948225a7a393f25a71b25", "exit": "0", "seconds": 13, "log_sha256": "0c989d83e336a6989a0b89a4ebf555f4283b0e7a12e46a4ba3efebcc1adea948", "log_lines": 63},
+    {"name": "artifact", "script": "scripts/qemu_ck_artifact_test.sh", "present": true, "script_sha256": "5e2b6d1cdaef908ac3711b88963435c757b7321876278fe3697bdbd450adbd69", "exit": "0", "seconds": 32, "log_sha256": "83ae7d40643232aeffce7cdf9e6d4b7812f7b5367a7e7fbb7dc797c5fd58a420", "log_lines": 215}
+  ],
+  "gates": [
+    {"id": "M1", "marker": "AIENOS_CK_M1", "source": "boot", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M3", "marker": "AIENOS_CK_M3", "source": "boot", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "SMMU", "marker": "AIENOS_CK_SMMU", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "NVME_SHUTDOWN", "marker": "AIENOS_CK_NVME_SHUTDOWN", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "P2_ARTIFACT", "marker": "AIENOS_CK_P2_ARTIFACT", "source": "artifact", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M0_ROLLBACK", "marker": "AIENOS_CK_M0_ROLLBACK", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: C loader signatures, A/B, BootNext and rollback are parked (native/boot/README.md)"},
+    {"id": "M4_NVME", "marker": "AIENOS_CK_M4_NVME", "source": "store", "verdict": "PASS", "reason": "SMMU-confined NVMe DMA in QEMU (iommu=smmuv3, default build); TEST-ONLY bypass build boot-checked separately"},
+    {"id": "M4_STORE", "marker": "AIENOS_CK_M4_STORE", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M4_STORE_CRASH", "marker": "AIENOS_CK_M4_STORE_CRASH", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no C Store crash/kill campaign (4 KiB or 512 B) and no slot reuse (C Store is append-only)"},
+    {"id": "M4_CONTINUITY", "marker": "AIENOS_CK_M4_CONTINUITY", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no continuity core (ADR 0016 agent identity and memory) in the C kernel"},
+    {"id": "M4_RECOVERY", "marker": "AIENOS_CK_M4_RECOVERY", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no Recovery Core (ADR 0006) in the C kernel"},
+    {"id": "ARGUS1_REVOKE", "marker": "AIENOS_CK_ARGUS1_REVOKE", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "KEYBOARD", "marker": "AIENOS_CK_KEYBOARD", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no xHCI/USB HID keyboard driver in the C kernel"},
+    {"id": "NET", "marker": "AIENOS_CK_NET", "source": "net", "verdict": "PASS", "reason": "QEMU user networking (slirp): attach, UDP TX seen by the host helper, UDP reply RX parsed by M6-A; QEMU does not route virtio-net DMA through the SMMU (no ACCESS_PLATFORM), so confinement is not proven for it"}
+  ],
+  "counts": {"total": 14, "pass": 9, "fail": 0, "not_run": 5},
+  "verdict": "NOT_ALL_GATES_PASS",
+  "parity": "native/kernel/GATES.md",
+  "physical": "NOT_RUN",
+  "physical_statement": "QEMU emulator runs only. Nothing here was run on Machine 1 or any GB10; no physical qualification is claimed."
+}
diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md
index 995ed96e..a2a5a7c8 100644
--- a/native/kernel/GATES.md
+++ b/native/kernel/GATES.md
@@ -22,7 +22,7 @@ C gates (one line each from `ck_gates.sh`): `M1` and `M3` (from
 `SMMU`, `NVME_SHUTDOWN` (from `scripts/qemu_ck_store_test.sh`; rows 21-24b, 47-72, 76 and
 96-101 were checked against its exact grep patterns), `P2_ARTIFACT` (from
 `scripts/qemu_ck_artifact_test.sh`, rows 33-41), `NET` (C-only, from
-`scripts/qemu_ck_net_test.sh`; rows 102-106), and the NOT_RUN gates
+`scripts/qemu_ck_net_test.sh`; rows 102-106), the kernel entropy rows 107-109 (M1 via `scripts/lib_ck_m1_checks.sh`, ARGUS1_REVOKE and M4_STORE via the Store gate boot 7), and the NOT_RUN gates
 `M0_ROLLBACK`, `M4_STORE_CRASH`,
 `M4_CONTINUITY`, `M4_RECOVERY`, `KEYBOARD`.
 
@@ -331,12 +331,15 @@ complete.
 | 104 | one UDP frame received (RX) and parsed by M6-A | NET | DIFFERS (C-only: guest `net: udp rx 10.0.2.2:47029 -> 10.0.2.15:47030 .. udp_csum=verified parsed=m6a echo_of_ours=yes payload="AIENOS-CK-NET pong token=<per-run random token> echo=<the guest's own ping>"`; the token is generated by the script per run, so the line cannot pass without the helper's reply reaching the guest; plus `net: udp round trip ok`, `net: selftest PASS (rc=0)` and `devices: pci=ok nvme=bound virtio_net=selftest-ok`) |
 | 105 | virtio-net released after the round trip | NET | DIFFERS (C-only: `virtio_net: device reset status=0x00 (stopped)`, `dma_gate: virtio_net bus master revoked`, `smmu: virtio_net stream 0x.. returned to abort (rc=0)`; line order grant < round trip < reset < revoke < abort) |
 | 106 | virtio-net fails closed without an SMMU | NET | DIFFERS (C-only: boot 2 without `iommu=smmuv3`: `dma_gate: virtio_net denied (NoSmmu rc=-1), bus master stays off`, `virtio_net: not bound (SMMU DMA isolation not active)`, absent `dma_gate: virtio_net granted` and `net: udp tx`, and the host helper receives nothing. Host test `stage_test` also checks the fail-closed bind leaves the command register without MEM/BME) |
+| 107 | kernel entropy is the RNDR instruction or nothing: FEAT_RNG checked first (ID_AA64ISAR0_EL1.RNDR), each 64-bit word retried at most 64 times (NZCV.Z = failure), stuck-output test, refusal latched and the buffer zeroed; no timer or other fallback source exists (`entropy: rndr feat_rng=yes probe_words=2 retries=N stuck_test=ok$`, absent `entropy: unavailable` and `entropy: refused`) | M1 (and every M1-checked boot of the Store and NET gates, via scripts/lib_ck_m1_checks.sh) | DIFFERS (C-only addition; no Rust M1 counterpart. Host test `tests/test_entropy.c` drives the selection logic with a mocked RNDR: absent, always failing, failing 63 then succeeding, failing exactly 64 (refused), dying mid-fill, stuck, never probed, latched refusal. QEMU -cpu max has FEAT_RNG; GB10 RNDR availability is UNVERIFIED) |
+| 108 | without RNDR the security services fail closed: the office token read is refused, caps and ARGUS never start, `stage security: FAIL` | ARGUS1_REVOKE (and M1 for that boot, with the refusal expected instead of `entropy: rndr`) | DIFFERS (C-only, Store gate boot 7 on QEMU `-cpu neoverse-n1` (no FEAT_RNG): `entropy: unavailable reason=absent (ID_AA64ISAR0_EL1.RNDR=0, no FEAT_RNG); ...`, `entropy: refused consumer=/dev/urandom (capability office token) reason=absent; service fails closed`, `security: REFUSED kernel entropy absent ...`, `caps: failed ... office_token=none`, `argus: FAIL step=cap_start`, `stage security: FAIL`, absent `caps: ok` and `argus: ok`. ARGUS1_REVOKE cannot PASS unless this boot refuses) |
+| 109 | the Store needs no entropy (its envelope ids and nonces are keyed functions, native/store/store_sealed.h) and still opens without RNDR | M4_STORE | DIFFERS (C-only, Store gate boot 7: `stage store: ok`) |
 
 ## Summary counts
 
-**C kernel receipt tally (QEMU only, no physical run):** 9 of 14 CK gates PASS, 5 NOT_RUN (M0_ROLLBACK, M4_STORE_CRASH, M4_CONTINUITY, M4_RECOVERY, KEYBOARD), 0 FAIL, matching `evidence/ck_gates_bb4040322b026f5f561733fdcaf900770070f2281800b0e3603c2aa2c670b7ff.json` (run at 4f56a96). The row counts below are per Rust-parity row, not per gate.
+**C kernel receipt tally (QEMU only, no physical run):** 9 of 14 CK gates PASS, 5 NOT_RUN (M0_ROLLBACK, M4_STORE_CRASH, M4_CONTINUITY, M4_RECOVERY, KEYBOARD), 0 FAIL, matching `evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json` (run at 41aa0e6, which adds the kernel entropy rows 107-109; that commit was then rebased onto #210, which changed only README.md and CONTRIBUTING.md). The row counts below are per Rust-parity row, not per gate.
 
-Rows 1-106: IDENTICAL 28, DIFFERS 37, NOT_RUN 41, counted from the table; rows 34 and 39 now also cover the NVMe boot-disk source and its hostile disk cases (statuses unchanged) (the previous summary, 20/30/56, was miscounted: the table on main had 21/35/50; rows 33-41 then moved from NOT_RUN to 7 IDENTICAL + 2 DIFFERS with the C artifact loader; rows 92-95 have no CK gate at all; rows 96-106 are C-only). Rows 33-41 were checked against scripts/qemu_ck_artifact_test.sh. Rows 102-106 were checked against scripts/qemu_ck_net_test.sh. Rows 13, 24, 47-72, 76 and 96-101 were re-verified against scripts/qemu_ck_store_test.sh and scripts/lib_ck_m1_checks.sh at the commit that adds this line.
+Rows 1-109: IDENTICAL 28, DIFFERS 40, NOT_RUN 41, counted from the table (rows 107-109, kernel entropy, are C-only and DIFFERS); rows 34 and 39 now also cover the NVMe boot-disk source and its hostile disk cases (statuses unchanged) (the previous summary, 20/30/56, was miscounted: the table on main had 21/35/50; rows 33-41 then moved from NOT_RUN to 7 IDENTICAL + 2 DIFFERS with the C artifact loader; rows 92-95 have no CK gate at all; rows 96-106 are C-only). Rows 33-41 were checked against scripts/qemu_ck_artifact_test.sh. Rows 102-106 were checked against scripts/qemu_ck_net_test.sh. Rows 13, 24, 47-72, 76 and 96-101 were re-verified against scripts/qemu_ck_store_test.sh and scripts/lib_ck_m1_checks.sh at the commit that adds this line.
 
 `scripts/trust1_m5_qualify.sh --with-qemu` also runs three of these gates as
 qemu rows: `ck_m1_boot_qemu` (M1), `ck_store_kernel_qemu` (M4_STORE) and
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index 438c30a6..2f880bb9 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -119,7 +119,7 @@ CORE_C := $(BOOT)/efi_main.c \
 	$(KDIR)/core/acpi.c $(KDIR)/core/console.c $(KDIR)/core/fmt.c \
 	$(KDIR)/core/kmain.c $(KDIR)/core/libc_min.c $(KDIR)/core/report.c \
 	$(KDIR)/core/smmu.c $(KDIR)/core/smmu_svc.c $(KDIR)/core/sched.c $(KDIR)/core/ipc.c \
-	$(KDIR)/core/m3.c \
+	$(KDIR)/core/m3.c $(KDIR)/core/entropy.c $(KDIR)/arch/rndr.c \
 	$(KDIR)/mm/frames.c $(KDIR)/mm/heap.c $(KDIR)/mm/mmu.c $(KDIR)/mm/pt.c
 # P2 sealed-artifact loader: format/admission/receipt (artifact/), SHA-256
 # (argus), Ed25519/SHA-512 (sig). Built into the core so every image carries
@@ -259,8 +259,8 @@ $(FULL_EFI): $(FULL_ELF)
 
 # ---- host unit tests ----
 HOST_SRCS := $(KDIR)/core/fmt.c $(KDIR)/core/acpi.c $(KDIR)/core/smmu.c $(KDIR)/mm/frames.c \
-	$(KDIR)/mm/pt.c $(KDIR)/mm/heap.c $(KDIR)/core/sched.c $(KDIR)/core/ipc.c
-TESTS := test_fmt test_frames test_pt test_acpi test_heap test_smmu test_sched test_ipc test_artifact
+	$(KDIR)/mm/pt.c $(KDIR)/mm/heap.c $(KDIR)/core/sched.c $(KDIR)/core/ipc.c $(KDIR)/core/entropy.c
+TESTS := test_fmt test_frames test_pt test_acpi test_heap test_smmu test_sched test_ipc test_artifact test_entropy
 HCFLAGS := -std=gnu11 -O1 -g -Wall -Wextra -Werror -I$(KDIR)/core -I$(KDIR)/mm -I$(KDIR)/tests
 SANFLAGS := -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer
 
diff --git a/native/kernel/arch/rndr.c b/native/kernel/arch/rndr.c
new file mode 100644
index 00000000..ceedd019
--- /dev/null
+++ b/native/kernel/arch/rndr.c
@@ -0,0 +1,55 @@
+/* rndr.c -- kernel glue for core/entropy.c: the real FEAT_RNG check
+ * (ID_AA64ISAR0_EL1.RNDR, bits [63:60]) and the RNDR read (NZCV.Z set means
+ * no random number was returned). Implements the ck.h entropy services.
+ * There is no other source: without RNDR every request is refused and the
+ * consumer fails closed. Not covered here: firmware that traps RNDR to EL3
+ * (FEAT_RNG_TRAP) and answers with an UNDEFINED exception would fault the
+ * read; that shows as a kernel fault, never as weak bytes.
+ * QEMU is not hardware: GB10 RNDR availability is UNVERIFIED. */
+#include "arch.h"
+#include "ck_internal.h"
+#include "entropy.h"
+
+static int hw_present(void *ctx)
+{
+    (void)ctx;
+    return ((ck_rd(id_aa64isar0_el1) >> 60) & 0xfu) >= 1u;
+}
+
+static int hw_read(void *ctx, uint64_t *out)
+{
+    (void)ctx;
+    uint64_t v, nzcv;
+    /* s3_3_c2_c4_0 = RNDR; read NZCV straight after it. */
+    __asm__ volatile("mrs %0, s3_3_c2_c4_0\n\tmrs %1, nzcv" : "=r"(v), "=r"(nzcv)::"cc");
+    *out = v;
+    return (nzcv & (1ull << 30)) == 0;
+}
+
+static const struct ck_rng_ops hw_ops = { hw_present, hw_read, 0 };
+static struct ck_rng rng = { 0, CK_RNG_UNPROBED, 0, 0, 0 };
+
+int ck_entropy_init(void)
+{
+    return ck_rng_probe(&rng, &hw_ops);
+}
+
+int ck_entropy_fill(void *buf, size_t len)
+{
+    return ck_rng_fill(&rng, buf, len);
+}
+
+int ck_entropy_status(void)
+{
+    return rng.state;
+}
+
+const char *ck_entropy_reason(void)
+{
+    return ck_rng_reason(rng.state);
+}
+
+uint64_t ck_entropy_retries(void)
+{
+    return rng.retries;
+}
diff --git a/native/kernel/core/ck_internal.h b/native/kernel/core/ck_internal.h
index fdd70461..1e900e77 100644
--- a/native/kernel/core/ck_internal.h
+++ b/native/kernel/core/ck_internal.h
@@ -90,5 +90,9 @@ uint64_t ck_counter_to_us(uint64_t counter, uint64_t freq);
 void ck_timer_tick(void); /* IRQ dispatcher: INTID 30 */
 /* M3 isolation checks: threads, el0, preempt, placement, ipc (core/m3.c). */
 void ck_m3_run(void);
+/* arch/rndr.c: probe FEAT_RNG + two RNDR words once, before any consumer.
+ * Returns CK_RNG_OK or the refusal (see core/entropy.h). */
+int ck_entropy_init(void);
+uint64_t ck_entropy_retries(void);
 
 #endif
diff --git a/native/kernel/core/entropy.c b/native/kernel/core/entropy.c
new file mode 100644
index 00000000..c44eb7db
--- /dev/null
+++ b/native/kernel/core/entropy.c
@@ -0,0 +1,77 @@
+/* entropy.c -- RNDR-or-refuse selection logic (see entropy.h). Pure C, no
+ * ck.h services, so the host tests (tests/test_entropy.c) run it against a
+ * mocked RNDR. */
+#include "entropy.h"
+
+static void wipe(uint8_t *p, size_t n)
+{
+    volatile uint8_t *v = p;
+    while (n--) *v++ = 0;
+}
+
+/* One word with the architected bounded retry. 0 ok, else refusal. */
+static int draw(struct ck_rng *r, uint64_t *out)
+{
+    for (uint32_t t = 0; t < CK_RNG_RETRIES; t++) {
+        uint64_t v = 0;
+        if (r->ops->read(r->ops->ctx, &v)) {
+            r->retries += t;
+            if (r->words && v == r->last) return CK_RNG_STUCK;
+            r->last = v;
+            r->words++;
+            *out = v;
+            return CK_RNG_OK;
+        }
+    }
+    return CK_RNG_FAILED;
+}
+
+int ck_rng_probe(struct ck_rng *r, const struct ck_rng_ops *ops)
+{
+    if (!r || !ops || !ops->present || !ops->read) return CK_RNG_EARG;
+    r->ops = ops;
+    r->last = 0;
+    r->words = 0;
+    r->retries = 0;
+    if (!ops->present(ops->ctx)) return r->state = CK_RNG_ABSENT;
+    uint64_t a, b;
+    int rc = draw(r, &a);
+    if (rc == CK_RNG_OK) rc = draw(r, &b);
+    return r->state = rc;
+}
+
+int ck_rng_fill(struct ck_rng *r, void *buf, size_t len)
+{
+    if (!r || (!buf && len)) return CK_RNG_EARG;
+    uint8_t *p = buf;
+    if (r->state != CK_RNG_OK || !r->ops) {
+        if (r->state == CK_RNG_OK) r->state = CK_RNG_UNPROBED;
+        wipe(p, len);
+        return r->state;
+    }
+    size_t i = 0;
+    while (i < len) {
+        uint64_t v;
+        int rc = draw(r, &v);
+        if (rc != CK_RNG_OK) {
+            r->state = rc;
+            wipe(p, len);
+            return rc;
+        }
+        for (unsigned k = 0; k < 8 && i < len; k++) p[i++] = (uint8_t)(v >> (8 * k));
+        v = 0;
+    }
+    return CK_RNG_OK;
+}
+
+const char *ck_rng_reason(int state)
+{
+    switch (state) {
+    case CK_RNG_OK: return "rndr";
+    case CK_RNG_UNPROBED: return "unprobed";
+    case CK_RNG_ABSENT: return "absent";
+    case CK_RNG_FAILED: return "failed";
+    case CK_RNG_STUCK: return "stuck";
+    default: return "bad-argument";
+    }
+}
diff --git a/native/kernel/core/entropy.h b/native/kernel/core/entropy.h
new file mode 100644
index 00000000..e9d39b01
--- /dev/null
+++ b/native/kernel/core/entropy.h
@@ -0,0 +1,57 @@
+/* entropy.h -- kernel entropy: the Arm RNDR instruction or a refusal.
+ *
+ * Pure selection logic over two callbacks (is FEAT_RNG present, read one
+ * RNDR word), so host tests drive it with a mocked RNDR. The kernel glue
+ * (arch/rndr.c) supplies the real ID_AA64ISAR0_EL1 / RNDR accessors.
+ *
+ * There is no fallback source. Rules:
+ *  - FEAT_RNG is checked first (ID_AA64ISAR0_EL1.RNDR >= 1); absent means
+ *    every request is refused.
+ *  - RNDR reports failure by setting NZCV.Z; each 64-bit word is retried at
+ *    most CK_RNG_RETRIES times, then the source is refused.
+ *  - Stuck-output test: a word equal to the previous word refuses the source
+ *    (FIPS-style continuous test; false-positive odds 2^-64 per word).
+ *  - A refusal is latched for the rest of the boot and the caller's buffer
+ *    is zeroed, so no partial or stale bytes ever leave as "random".
+ * QEMU is not hardware: nothing built on this is physically qualified. */
+#ifndef AIENOS_CK_ENTROPY_H
+#define AIENOS_CK_ENTROPY_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define CK_RNG_RETRIES 64u
+
+enum {
+    CK_RNG_OK = 0,
+    CK_RNG_UNPROBED = -1, /* ck_rng_probe not called yet */
+    CK_RNG_ABSENT = -2,   /* ID_AA64ISAR0_EL1.RNDR == 0 */
+    CK_RNG_FAILED = -3,   /* RNDR failed CK_RNG_RETRIES times in a row */
+    CK_RNG_STUCK = -4,    /* two consecutive words were equal */
+    CK_RNG_EARG = -5,     /* bad arguments (state unchanged) */
+};
+
+struct ck_rng_ops {
+    int (*present)(void *ctx);              /* 1 if FEAT_RNG is implemented */
+    int (*read)(void *ctx, uint64_t *out);  /* 1 = valid word; 0 = RNDR failed (Z set) */
+    void *ctx;
+};
+
+struct ck_rng {
+    const struct ck_rng_ops *ops;
+    int state;           /* CK_RNG_OK or the latched refusal */
+    uint64_t last;       /* previous word, for the stuck-output test */
+    uint64_t words;      /* words delivered (probe included) */
+    uint64_t retries;    /* failed RNDR reads that a retry recovered */
+};
+
+/* Check FEAT_RNG, then draw two words (retry + stuck test). Returns the new
+ * state: CK_RNG_OK or a refusal. */
+int ck_rng_probe(struct ck_rng *r, const struct ck_rng_ops *ops);
+/* Fill buf with RNDR output. 0 on success; otherwise the (latched) refusal
+ * and buf is zeroed. */
+int ck_rng_fill(struct ck_rng *r, void *buf, size_t len);
+/* Short reason word for a state: "rndr", "absent", "failed", "stuck", ... */
+const char *ck_rng_reason(int state);
+
+#endif
diff --git a/native/kernel/core/kmain.c b/native/kernel/core/kmain.c
index be510376..005387a2 100644
--- a/native/kernel/core/kmain.c
+++ b/native/kernel/core/kmain.c
@@ -9,6 +9,7 @@
  * qualify nothing physical. */
 #include "arch.h"
 #include "ck_internal.h"
+#include "entropy.h"
 
 #define TTBR_BADDR_MASK 0x0000fffffffffffeull
 
@@ -115,6 +116,21 @@ static __attribute__((noreturn)) void ck_el1_main(void *arg)
     ck_puts("kernel: alive\n");
     ck_printf("kernel_el: EL%u%s\n", el, (spsel & 1) ? "h" : "t");
 
+    /* Kernel entropy (arch/rndr.c): RNDR or a latched refusal, no fallback.
+     * Probed once here, before the artifact loader and the stages. */
+    ck_set_stage("entropy");
+    int ent = ck_entropy_init();
+    if (ent == CK_RNG_OK)
+        ck_printf("entropy: rndr feat_rng=yes probe_words=2 retries=%llu stuck_test=ok\n",
+                  (unsigned long long)ck_entropy_retries());
+    else
+        ck_printf("entropy: unavailable reason=%s (%s); security consumers refuse, fail closed\n",
+                  ck_entropy_reason(),
+                  ent == CK_RNG_ABSENT ? "ID_AA64ISAR0_EL1.RNDR=0, no FEAT_RNG"
+                  : ent == CK_RNG_FAILED ? "RNDR returned no number within the retry bound"
+                  : ent == CK_RNG_STUCK ? "RNDR repeated a 64-bit word"
+                                        : "probe error");
+
     /* M3 isolation checks (core/m3.c), before any stage registers an IRQ. */
     ck_m3_run();
 
diff --git a/native/kernel/include/ck.h b/native/kernel/include/ck.h
index ca156939..4bcbb767 100644
--- a/native/kernel/include/ck.h
+++ b/native/kernel/include/ck.h
@@ -109,6 +109,16 @@ struct ck_dma_fault {
 };
 int ck_dma_faults(uint32_t stream_id, struct ck_dma_fault *first);
 
+/* Entropy (arch/rndr.c over core/entropy.c): the Arm RNDR instruction or a
+ * refusal; there is no fallback source. ck_entropy_fill returns 0 with len
+ * bytes of RNDR output, or a negative CK_RNG_* refusal (absent, failed,
+ * stuck) with buf zeroed; a refusal is latched for the rest of the boot.
+ * Every security consumer must fail closed on a refusal. ck_entropy_reason
+ * names the current state ("rndr" when usable). */
+int ck_entropy_fill(void *buf, size_t len);
+int ck_entropy_status(void);
+const char *ck_entropy_reason(void);
+
 /* ---- boot stages (implemented by the stage worker, all optional) -------- */
 /* Each returns 0 on success, negative on failure; core prints the result.
  * Declared weak so the core links and boots without them. */
diff --git a/native/kernel/stage.mk b/native/kernel/stage.mk
index d59b824a..dc904dcc 100644
--- a/native/kernel/stage.mk
+++ b/native/kernel/stage.mk
@@ -54,7 +54,8 @@ STAGE_FREE_FLAGS := -std=gnu11 -O2 -Wall -Wextra -Werror -ffreestanding -nostdli
 # The only undefined symbols the stages may leave for the core: ck.h services.
 STAGE_ALLOWED_U := ck_puts ck_printf ck_vprintf ck_panic ck_alloc ck_free ck_dma_alloc ck_mmio_map \
   ck_dma_confine ck_dma_unconfine ck_dma_faults \
-  ck_mb ck_acpi_find ck_time_us ck_udelay ck_commit
+  ck_mb ck_acpi_find ck_time_us ck_udelay ck_commit \
+  ck_entropy_fill ck_entropy_status ck_entropy_reason
 
 STAGE_FREE_OBJS := $(foreach s,$(STAGE_SRCS),$(STAGE_OUT)/free/$(subst /,_,$(subst $(STAGE_NATIVE)/,,$(s:.c=.o))))
 
diff --git a/native/kernel/svc/ck_compat.c b/native/kernel/svc/ck_compat.c
index 1092d683..daefff32 100644
--- a/native/kernel/svc/ck_compat.c
+++ b/native/kernel/svc/ck_compat.c
@@ -8,7 +8,6 @@
 #include "compat/pthread.h"
 #include "compat/stdio.h"
 #include "compat/time.h"
-#include "sha256.h"
 
 /* ---- memory routines: weak, so a core copy wins at link time ---------- */
 __attribute__((weak)) void *memcpy(void *restrict d, const void *restrict s, size_t n)
@@ -71,66 +70,15 @@ void ck_compat_mutex_lock(pthread_mutex_t *m)
 }
 
 /* ---- entropy for "/dev/urandom" --------------------------------------- */
+/* The only kernel consumer is the capability office token
+ * (native/capability fill_token). Bytes come from ck_entropy_fill (RNDR,
+ * bounded retry, stuck test) or the read is refused: fread returns 0, the
+ * capability library fails closed (aienos_cap_start refuses) and the
+ * security stage (capability office + ARGUS) reports FAIL. There is no
+ * fallback source of any kind. */
 static int g_entropy = CK_ENTROPY_NONE;
 int ck_compat_entropy_source(void) { return g_entropy; }
 
-#if defined(__aarch64__)
-static int have_rndr(void)
-{
-    uint64_t isar0;
-    __asm__ volatile("mrs %0, id_aa64isar0_el1" : "=r"(isar0));
-    return ((isar0 >> 60) & 0xfu) >= 1u;
-}
-static int rndr(uint64_t *out)
-{
-    uint64_t v, nzcv;
-    __asm__ volatile("mrs %0, s3_3_c2_c4_0\n\tmrs %1, nzcv" : "=r"(v), "=r"(nzcv)::"cc");
-    *out = v;
-    return (nzcv & (1ull << 30)) == 0; /* Z set = failure */
-}
-static uint64_t cntvct(void)
-{
-    uint64_t v;
-    __asm__ volatile("isb\n\tmrs %0, cntvct_el0" : "=r"(v));
-    return v;
-}
-#else
-static int have_rndr(void) { return 0; }
-static int rndr(uint64_t *out) { *out = 0; return 0; }
-static uint64_t cntvct(void) { return ck_time_us(); }
-#endif
-
-static void fill_entropy(uint8_t *buf, size_t len)
-{
-    size_t i = 0;
-    if (have_rndr()) {
-        while (i < len) {
-            uint64_t v;
-            int tries = 0;
-            while (!rndr(&v)) {
-                if (++tries > 64) goto fallback;
-            }
-            for (int k = 0; k < 8 && i < len; k++) buf[i++] = (uint8_t)(v >> (8 * k));
-        }
-        g_entropy = CK_ENTROPY_RNDR;
-        return;
-    }
-fallback:
-    /* Timer jitter: hash 256 counter samples taken around short delays.
-     * WEAK: an observer of boot timing could narrow it down. */
-    {
-        uint64_t s[256];
-        for (int k = 0; k < 256; k++) {
-            s[k] = cntvct() ^ (ck_time_us() << 17);
-            ck_udelay((uint32_t)(s[k] & 3u) + 1u);
-        }
-        uint8_t d[32];
-        sha256_hash((const uint8_t *)s, sizeof s, d);
-        for (i = 0; i < len; i++) buf[i] = d[i % 32] ^ (uint8_t)(i * 151u);
-        g_entropy = CK_ENTROPY_TIMER_WEAK;
-    }
-}
-
 struct ck_compat_file { int open; };
 static struct ck_compat_file urandom_file;
 
@@ -148,7 +96,13 @@ FILE *ck_compat_fopen(const char *path, const char *mode)
 size_t ck_compat_fread(void *buf, size_t sz, size_t n, FILE *f)
 {
     if (!f || !f->open || sz == 0 || n == 0 || n > (size_t)-1 / sz) return 0;
-    fill_entropy(buf, sz * n);
+    if (ck_entropy_fill(buf, sz * n) != 0) {
+        g_entropy = CK_ENTROPY_NONE;
+        ck_printf("entropy: refused consumer=/dev/urandom (capability office token) reason=%s; "
+                  "service fails closed\n", ck_entropy_reason());
+        return 0;
+    }
+    g_entropy = CK_ENTROPY_RNDR;
     return n;
 }
 int ck_compat_fclose(FILE *f)
diff --git a/native/kernel/svc/ck_compat.h b/native/kernel/svc/ck_compat.h
index 383901f6..de30b724 100644
--- a/native/kernel/svc/ck_compat.h
+++ b/native/kernel/svc/ck_compat.h
@@ -1,7 +1,8 @@
 /* ck_compat.h -- what the kernel-build compat layer reports back. */
 #ifndef AIENOS_CK_COMPAT_H
 #define AIENOS_CK_COMPAT_H
-enum { CK_ENTROPY_NONE = 0, CK_ENTROPY_RNDR = 1, CK_ENTROPY_TIMER_WEAK = 2, CK_ENTROPY_HOST = 3 };
+/* No weak or timer source exists: NONE means the read was refused. */
+enum { CK_ENTROPY_NONE = 0, CK_ENTROPY_RNDR = 1, CK_ENTROPY_HOST = 3 };
 /* Source used for the last "/dev/urandom" read (kernel build). */
 int ck_compat_entropy_source(void);
 #endif
diff --git a/native/kernel/svc/compat/README b/native/kernel/svc/compat/README
index a78af4e5..c36945d9 100644
--- a/native/kernel/svc/compat/README
+++ b/native/kernel/svc/compat/README
@@ -7,9 +7,11 @@ libc and pthreads. Every name is redirected to a ck_compat_* function in
 ../ck_compat.c, built on ck.h services:
   malloc/calloc/free  -> ck_alloc / ck_free
   clock_gettime       -> ck_time_us
-  fopen("/dev/urandom") + fread -> the CPU RNDR instruction when present,
-                         else a timer-jitter fallback that is announced on the
-                         console as WEAK (the capability office token)
+  fopen("/dev/urandom") + fread -> ck_entropy_fill (arch/rndr.c over
+                         core/entropy.c): the CPU RNDR instruction (FEAT_RNG
+                         checked, bounded retry, stuck test) or a refusal:
+                         fread returns 0 and the capability office token
+                         fails closed. There is no fallback source.
   pthread_mutex_*     -> single-core flag; contention means a bug (re-entry)
                          and panics instead of deadlocking.
 The native/* sources are compiled unmodified.
diff --git a/native/kernel/svc/security.c b/native/kernel/svc/security.c
index aa782d74..e8ab34de 100644
--- a/native/kernel/svc/security.c
+++ b/native/kernel/svc/security.c
@@ -272,8 +272,10 @@ int ck_stage_security(void)
               pick(r.caps_ok, "ok", "failed"), pick(r.caps_granted, "yes", "no"), pick(r.caps_attenuated, "yes", "no"),
               pick(r.caps_amplify_denied, "denied", "ALLOWED"), pick(r.caps_forged_denied, "denied", "ALLOWED"),
               pick(r.caps_revoked_denied, "denied", "ALLOWED"),
-              ent == CK_ENTROPY_RNDR ? "rndr" : ent == CK_ENTROPY_TIMER_WEAK ? "timer-WEAK" :
-              ent == CK_ENTROPY_HOST ? "host-urandom" : "none");
+              ent == CK_ENTROPY_RNDR ? "rndr" : ent == CK_ENTROPY_HOST ? "host-urandom" : "none");
+    if (ck_entropy_status() != 0)
+        ck_printf("security: REFUSED kernel entropy %s (office token needs RNDR); capability office and ARGUS fail closed\n",
+                  ck_entropy_reason());
     if (r.argus_ok) {
         ck_printf("argus: ok narrow_revoke=1 revoked=denied unrelated=granted authority=unchanged\n");
     } else {
diff --git a/native/kernel/svc/tests/ck_host.c b/native/kernel/svc/tests/ck_host.c
index 459d4351..9c8e4975 100644
--- a/native/kernel/svc/tests/ck_host.c
+++ b/native/kernel/svc/tests/ck_host.c
@@ -75,6 +75,9 @@ uint32_t ck_boot_count_hint(void) { return 0; }
 
 /* Host: the capability library reads the real /dev/urandom. */
 int ck_compat_entropy_source(void) { return CK_ENTROPY_HOST; }
+/* Host: the kernel RNDR service is not in play (libc /dev/urandom above). */
+int ck_entropy_status(void) { return 0; }
+const char *ck_entropy_reason(void) { return "host-urandom"; }
 
 /* Host: no IORT, so no SMMU (the NVMe gate stays fail-closed). */
 int ck_dma_confine(uint32_t rid, uint64_t phys, uint64_t len, struct ck_dma_confinement *out)
diff --git a/native/kernel/tests/test_entropy.c b/native/kernel/tests/test_entropy.c
new file mode 100644
index 00000000..5b119590
--- /dev/null
+++ b/native/kernel/tests/test_entropy.c
@@ -0,0 +1,167 @@
+/* test_entropy.c -- host tests of core/entropy.c (RNDR-or-refuse) against a
+ * mocked RNDR: FEAT_RNG absent, RNDR always failing, failing then
+ * succeeding (inside and at the retry bound), failing mid-fill, a stuck
+ * (repeating) source, and the latched refusal. */
+#include <string.h>
+#include "ck_test.h"
+#include "entropy.h"
+
+struct mock {
+    int present;
+    int fail_next;      /* fail this many reads, then succeed */
+    long ok_left;       /* successes before failing forever (-1 = never) */
+    int constant;       /* return the same word every time */
+    uint64_t ctr;
+    unsigned reads, present_calls;
+};
+
+static int m_present(void *c)
+{
+    struct mock *m = c;
+    m->present_calls++;
+    return m->present;
+}
+
+static int m_read(void *c, uint64_t *out)
+{
+    struct mock *m = c;
+    m->reads++;
+    *out = 0x1111111111111111ull; /* what a failed RNDR leaves (Arm: 0) */
+    if (m->fail_next > 0) {
+        m->fail_next--;
+        *out = 0;
+        return 0;
+    }
+    if (m->ok_left == 0) {
+        *out = 0;
+        return 0;
+    }
+    if (m->ok_left > 0) m->ok_left--;
+    *out = m->constant ? 0x0123456789abcdefull : (0x9e3779b97f4a7c15ull * ++m->ctr);
+    return 1;
+}
+
+static int all(const uint8_t *p, size_t n, uint8_t v)
+{
+    for (size_t i = 0; i < n; i++)
+        if (p[i] != v) return 0;
+    return 1;
+}
+
+static void setup(struct mock *m, struct ck_rng_ops *ops)
+{
+    memset(m, 0, sizeof *m);
+    m->present = 1;
+    m->ok_left = -1;
+    ops->present = m_present;
+    ops->read = m_read;
+    ops->ctx = m;
+}
+
+int main(void)
+{
+    struct mock m;
+    struct ck_rng_ops ops;
+    struct ck_rng r;
+    uint8_t buf[40];
+
+    /* Never probed (zeroed state): refuse, zero the buffer. */
+    memset(&r, 0, sizeof r);
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, sizeof buf) == CK_RNG_UNPROBED);
+    CHECK(all(buf, sizeof buf, 0));
+    CHECK(ck_rng_probe(&r, NULL) == CK_RNG_EARG);
+
+    /* 1. FEAT_RNG absent: refused without a single RNDR read. */
+    setup(&m, &ops);
+    m.present = 0;
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_ABSENT);
+    CHECK(m.reads == 0);
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, sizeof buf) == CK_RNG_ABSENT);
+    CHECK(all(buf, sizeof buf, 0));
+    CHECK(m.reads == 0);
+    CHECK(strcmp(ck_rng_reason(r.state), "absent") == 0);
+
+    /* 2. RNDR always fails: exactly CK_RNG_RETRIES reads, then refused and
+     * latched (no further reads). */
+    setup(&m, &ops);
+    m.ok_left = 0;
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_FAILED);
+    CHECK(m.reads == CK_RNG_RETRIES);
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, sizeof buf) == CK_RNG_FAILED);
+    CHECK(all(buf, sizeof buf, 0));
+    CHECK(m.reads == CK_RNG_RETRIES);
+    CHECK(strcmp(ck_rng_reason(r.state), "failed") == 0);
+
+    /* 3a. Fails CK_RNG_RETRIES - 1 times, then succeeds: usable. */
+    setup(&m, &ops);
+    m.fail_next = (int)CK_RNG_RETRIES - 1;
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_OK);
+    CHECK(r.retries == CK_RNG_RETRIES - 1);
+    CHECK(strcmp(ck_rng_reason(r.state), "rndr") == 0);
+    /* 3b. Fails exactly CK_RNG_RETRIES times: refused (bound is inclusive). */
+    setup(&m, &ops);
+    m.fail_next = (int)CK_RNG_RETRIES;
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_FAILED);
+
+    /* 4. Normal fill, length not a multiple of 8: little-endian words, in order. */
+    setup(&m, &ops);
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_OK);
+    CHECK(r.words == 2 && m.reads == 2);
+    memset(buf, 0, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, 13) == CK_RNG_OK);
+    uint64_t w3 = 0x9e3779b97f4a7c15ull * 3, w4 = 0x9e3779b97f4a7c15ull * 4;
+    int match = 1;
+    for (int k = 0; k < 8; k++) match &= buf[k] == (uint8_t)(w3 >> (8 * k));
+    for (int k = 0; k < 5; k++) match &= buf[8 + k] == (uint8_t)(w4 >> (8 * k));
+    CHECK(match);
+    CHECK(all(buf + 13, sizeof buf - 13, 0));
+    CHECK(ck_rng_fill(&r, buf, 0) == CK_RNG_OK);
+
+    /* 5. Transient failure during a fill is retried and recovered. */
+    m.fail_next = 5;
+    uint64_t before = r.retries;
+    CHECK(ck_rng_fill(&r, buf, 16) == CK_RNG_OK);
+    CHECK(r.retries == before + 5);
+
+    /* 6. Source dies mid-fill: whole buffer zeroed (no partial bytes),
+     * refusal latched even after RNDR would recover. */
+    setup(&m, &ops);
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_OK);
+    m.ok_left = 2; /* two more words, then dead */
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, sizeof buf) == CK_RNG_FAILED);
+    CHECK(all(buf, sizeof buf, 0));
+    m.ok_left = -1;
+    unsigned reads = m.reads;
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, 8) == CK_RNG_FAILED);
+    CHECK(all(buf, 8, 0));
+    CHECK(m.reads == reads);
+
+    /* 7. Stuck source: two equal words refuse at probe. */
+    setup(&m, &ops);
+    m.constant = 1;
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_STUCK);
+    CHECK(strcmp(ck_rng_reason(r.state), "stuck") == 0);
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, sizeof buf) == CK_RNG_STUCK);
+    CHECK(all(buf, sizeof buf, 0));
+    /* 7b. Source sticks mid-fill: refused, buffer zeroed. */
+    setup(&m, &ops);
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_OK);
+    m.constant = 1; /* next word 0x0123.. differs from the last; the one after repeats */
+    memset(buf, 0xaa, sizeof buf);
+    CHECK(ck_rng_fill(&r, buf, 24) == CK_RNG_STUCK);
+    CHECK(all(buf, 24, 0));
+
+    /* 8. Re-probe after a refusal starts fresh (a new boot). */
+    setup(&m, &ops);
+    CHECK(ck_rng_probe(&r, &ops) == CK_RNG_OK);
+    CHECK(ck_rng_fill(NULL, buf, 1) == CK_RNG_EARG);
+    CHECK(ck_rng_fill(&r, NULL, 1) == CK_RNG_EARG);
+
+    return ck_t_verdict("test_entropy");
+}
diff --git a/scripts/ck_gates.sh b/scripts/ck_gates.sh
index 21bbf84b..0b4dfd12 100755
--- a/scripts/ck_gates.sh
+++ b/scripts/ck_gates.sh
@@ -62,6 +62,9 @@ CHILDREN=(boot store net artifact)
 # ===========================================================================
 
 repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+# Receipts always boot QEMU -cpu max (FEAT_RNG present): the manual negative
+# override AIENOS_QEMU_CPU of the child scripts never reaches a receipt run.
+unset AIENOS_QEMU_CPU
 QUIET_FLAG="${AIENOS_QUIET_FLAG:-${HOME}/workspace/.spark-quiet}"
 AAVMF_CODE_FD="${AAVMF_CODE:-/usr/share/AAVMF/AAVMF_CODE.no-secboot.fd}"
 AAVMF_VARS_FD="${AAVMF_VARS:-/usr/share/AAVMF/AAVMF_VARS.fd}"
diff --git a/scripts/lib_ck_m1_checks.sh b/scripts/lib_ck_m1_checks.sh
index d61e34da..e2778bf7 100644
--- a/scripts/lib_ck_m1_checks.sh
+++ b/scripts/lib_ck_m1_checks.sh
@@ -7,6 +7,14 @@
 # failure and never resets it. ck_m3_checks (Lane 25) runs the five M3 checks
 # of qemu_boot_test.sh with the same patterns and sets m3_failed=1 on any
 # failure; it does not touch failed, so the M1 verdict is unchanged.
+#
+# Kernel entropy (Lane 31, C kernel addition): every boot must print
+# "entropy: rndr feat_rng=yes ..." (RNDR present, bounded retry, stuck test)
+# and no refusal. There is no fallback source, so a CPU without FEAT_RNG
+# fails M1. ck_m1_entropy=absent is set only by qemu_ck_store_test.sh for its
+# one negative boot on a CPU model without FEAT_RNG: that boot must print the
+# refusal instead (and cannot pass on a CPU that has RNDR).
+ck_m1_entropy=rndr
 
 check() { # description, pattern
     if grep -q -- "$2" "${work}/serial.txt"; then
@@ -77,6 +85,15 @@ ck_m1_checks() {
     # Added for the C kernel (the Rust kernel has no such test): every guard page
     # faulted and the fault was contained.
     check "guard pages fault and the fault is contained (C kernel addition)" "guard_page: ok fault=contained"
+    if [[ "${ck_m1_entropy}" == absent ]]; then
+        check "kernel entropy refused without FEAT_RNG (negative boot, C kernel addition)" \
+            "^entropy: unavailable reason=absent (ID_AA64ISAR0_EL1.RNDR=0, no FEAT_RNG); security consumers refuse, fail closed$"
+        check_absent "no RNDR entropy claimed without FEAT_RNG (negative boot)" "^entropy: rndr"
+    else
+        check "kernel entropy from RNDR: FEAT_RNG present, bounded retry, stuck test (C kernel addition)" \
+            "^entropy: rndr feat_rng=yes probe_words=2 retries=[0-9]* stuck_test=ok$"
+        check_absent "no kernel entropy refusal (C kernel addition)" "^entropy: \(unavailable\|refused\)"
+    fi
     check "final report on the SPCR console" "report_kind: final"
     check "no panic or fault" "report_kind: final"
     if grep -qE "report_kind: (panic|fault)" "${work}/serial.txt"; then
diff --git a/scripts/qemu_ck_boot_test.sh b/scripts/qemu_ck_boot_test.sh
index 88b85cb9..199f2667 100755
--- a/scripts/qemu_ck_boot_test.sh
+++ b/scripts/qemu_ck_boot_test.sh
@@ -18,11 +18,15 @@
 #    panic, QEMU exit 0); the C kernel prints one extra line, ipc_detail,
 #    which no check reads (native/kernel/GATES.md rows 16-20 list the
 #    differences in how the C kernel does the work);
-#  - one added check: guard_page (the C kernel's guard-page fault self test);
+#  - two added checks: guard_page (the C kernel's guard-page fault self test)
+#    and kernel entropy ("entropy: rndr ..."; no fallback source exists);
 #  - stricter: any QEMU exit status other than 0 fails (the Rust script fails
 #    only on the timeout status 124); PSCI reset with -no-reboot exits 0;
 #  - the checks live in scripts/lib_ck_m1_checks.sh (shared with the Store gate);
-#  - last two lines are AIENOS_CK_M3: and AIENOS_CK_M1: PASS|FAIL|NOT_RUN.
+#  - last two lines are AIENOS_CK_M3: and AIENOS_CK_M1: PASS|FAIL|NOT_RUN;
+#  - AIENOS_QEMU_CPU overrides "-cpu max" for a manual negative run (e.g.
+#    neoverse-n1, which has no FEAT_RNG/RNDR: M1 must FAIL on the entropy
+#    row). scripts/ck_gates.sh unsets it, so receipts always use -cpu max.
 # Needs qemu-system-aarch64 and AAVMF (Ubuntu: qemu-system-arm qemu-efi-aarch64).
 set -euo pipefail
 
@@ -73,11 +77,12 @@ log="${work}/serial.log"
 
 # Issue #61: single-threaded TCG completed 120/120 soak boots; MTTCG hung in 1/40.
 qemu_accel=(-accel tcg,thread=single)
+qemu_cpu="${AIENOS_QEMU_CPU:-max}"
 
 started=$(date +%s)
 set +e
 timeout "${AIENOS_QEMU_TIMEOUT:-180}" qemu-system-aarch64 \
-    -M virt,virtualization=on,gic-version=3 "${qemu_accel[@]}" -cpu max -smp 4 -m 2048 \
+    -M virt,virtualization=on,gic-version=3 "${qemu_accel[@]}" -cpu "${qemu_cpu}" -smp 4 -m 2048 \
     -drive if=pflash,format=raw,readonly=on,file="${code_fd}" \
     -drive if=pflash,format=raw,file="${work}/vars.fd" \
     -drive if=none,id=esp,format=raw,file=fat:rw:"${work}/esp" \
@@ -95,7 +100,7 @@ tr -d '\r' <"${log}" >"${work}/serial.txt"
 failed=0
 # shellcheck source=scripts/lib_ck_m1_checks.sh
 source "${repo_root}/scripts/lib_ck_m1_checks.sh"
-echo "qemu exit ${qemu_status} after ${elapsed} s (commit ${commit:0:12})"
+echo "qemu exit ${qemu_status} after ${elapsed} s (commit ${commit:0:12}, -cpu ${qemu_cpu})"
 ck_m1_checks
 m3_failed=0
 ck_m3_checks
diff --git a/scripts/qemu_ck_store_test.sh b/scripts/qemu_ck_store_test.sh
index f675e71a..c26e839e 100755
--- a/scripts/qemu_ck_store_test.sh
+++ b/scripts/qemu_ck_store_test.sh
@@ -31,6 +31,16 @@
 #  boot 6     TEST-ONLY bypass image, no SMMU, same (corrupt) disk: the bypass
 #             warnings and grant are printed, the Store is still refused as
 #             structural and the image is unchanged.
+# Once, after both geometries:
+#  boot 7     default image, SMMU, fresh 512 B disk, on QEMU -cpu neoverse-n1
+#             (no FEAT_RNG, so no RNDR). The kernel has no fallback entropy:
+#             M1 must show "entropy: unavailable reason=absent" instead of
+#             "entropy: rndr", the capability office token read must be
+#             refused, caps/ARGUS must fail closed and "stage security: FAIL"
+#             must print (into ARGUS1_REVOKE: that gate cannot PASS unless the
+#             no-RNDR boot refuses); the Store still opens (its nonces are
+#             keyed, not random). AIENOS_QEMU_CPU overrides "-cpu max" on boots
+#             1-6 only for manual negative runs; scripts/ck_gates.sh unsets it.
 # SMMU observables (boots 1-4; patterns of qemu_nvme_test.sh where the Rust
 # kernel has them): "smmu: enabled", "smmu_dma_window: nvme only, translation
 # active", "dma_gate: nvme granted (Confined), bus master on", absent
@@ -133,6 +143,8 @@ fail_into() { # bucket variable name: move the current failed flag into it
 }
 sha() { sha256sum "$1" | cut -d' ' -f1; }
 
+qemu_cpu="${AIENOS_QEMU_CPU:-max}"
+boot_cpu="${qemu_cpu}"
 # boot <name> <efi> <disk image> <block bytes> <serial> [smmu]: one QEMU boot
 # (with "smmu" the machine gets an SMMUv3); leaves
 # the serial text in ${work}/serial.txt and the exit status in qemu_status.
@@ -149,7 +161,7 @@ boot() {
     set +e
     # Issue #61: single-threaded TCG (see qemu_boot_test.sh).
     timeout "${AIENOS_QEMU_TIMEOUT:-180}" qemu-system-aarch64 \
-        -M "${machine}" -accel tcg,thread=single -cpu max -smp 4 -m 2048 \
+        -M "${machine}" -accel tcg,thread=single -cpu "${boot_cpu}" -smp 4 -m 2048 \
         -drive if=pflash,format=raw,readonly=on,file="${code_fd}" \
         -drive if=pflash,format=raw,file="${work}/vars.fd" \
         -drive if=none,id=esp,format=raw,file=fat:rw:"${work}/esp" \
@@ -163,7 +175,7 @@ boot() {
     set -e
     tr -d '\r' <"${work}/serial.log" >"${work}/serial.txt"
     [[ -z "${AIENOS_LOG_DIR:-}" ]] || cp "${work}/serial.txt" "${AIENOS_LOG_DIR}/qemu_ck_store_$1.log"
-    echo "== boot $1: qemu exit ${qemu_status}"
+    echo "== boot $1: qemu exit ${qemu_status} (-cpu ${boot_cpu})"
     failed=0
     ck_m1_checks
     fail_into m1_fail
@@ -370,12 +382,35 @@ for bs in 512 4096; do
     [[ "${sha_bypass}" == "${sha_corrupt}" ]] && echo "PASS  image sha256 unchanged by the bypass boot" \
         || store_fail_msg "image changed by the bypass boot"
 done
+
+# Boot 7: no FEAT_RNG (QEMU -cpu neoverse-n1 has no RNDR). The kernel has no
+# fallback entropy source, so the office token must be refused and the
+# security stage must fail closed; the Store still opens (keyed nonces).
+image="${top}/nvme-nornd.img"
+truncate -s "${img_bytes}" "${image}"
+boot_cpu=neoverse-n1
+ck_m1_entropy=absent
+boot "boot7-no-rndr" "${safe_efi}" "${image}" 512 aienos-nvme-test smmu
+boot_cpu="${qemu_cpu}"
+ck_m1_entropy=rndr
+check "office token read refused without RNDR, service fails closed (C only)" \
+    "^entropy: refused consumer=/dev/urandom (capability office token) reason=absent; service fails closed$"
+check "security stage refuses without kernel entropy (C only)" \
+    "^security: REFUSED kernel entropy absent (office token needs RNDR); capability office and ARGUS fail closed$"
+check "capabilities not started, no office token (C only)" "^caps: failed .* office_token=none$"
+check "ARGUS not started: capability office refused (C only)" "^argus: FAIL step=cap_start "
+check "stage security failed (C only)" "^stage security: FAIL"
+check_absent "no capability grant without entropy (C only)" "^caps: ok"
+check_absent "no ARGUS narrow revoke without entropy (C only)" "^argus: ok"
+fail_into argus_fail
+check "Store still opens without RNDR: its nonces are keyed, not random (C only)" "^stage store: ok"
+fail_into store_fail
 release_flag
 
 if [[ "${m1_fail}${nvme_fail}${store_fail}${argus_fail}${smmu_fail}${shut_fail}" != 000000 || -n "${AIENOS_QEMU_VERBOSE:-}" ]]; then
     for s in "${top}"/*/serial.txt; do
         echo "---- serial console $(basename "$(dirname "${s}")") (stage lines) ----"
-        grep -E '^(stage |smmu|nvme:|dma_gate:|WARNING|devices:|store:|caps:|argus:|report_kind:|pci_nvme_mmio_shutdown)' "${s}" | head -60 || true
+        grep -E '^(stage |smmu|nvme:|dma_gate:|WARNING|devices:|store:|caps:|argus:|entropy:|security:|report_kind:|pci_nvme_mmio_shutdown)' "${s}" | head -60 || true
     done
 fi
 [[ "${m1_fail}" != 0 ]] && echo "M1 checks failed on at least one boot: no verdict can pass"