Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/patches/2978104c5c9cf573 # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## native/net: check the wrapped virtio used index merged `2978104c5c9cf573` #477 · opened 2026-10-30 11:55 UTC · closed 2026-10-30 12:14 UTC · merged 2026-10-30 12:14 UTC Imported from GitHub aien-dev/aienux#477, by drakestapleton Base `a525c405ea47e3fe91c19602a6bef6753599d726` · Head `dc9a99612b3ab63e82c7cd898d95a682a071144a` Merged on GitHub as `b00c728c2443d8931e8e697a25d67f5e20e408ca`; reachable from main `d01b2f19cccf3e173a6bdb3541813d467f537a76` (observed 2026-11-18T16:35:37Z) drakestapleton wrote on 2026-10-30 11:55 UTC Fixes #476 ## What broke `make -C native/net test` with clang 18 stops in `native/net/tests/vnet_test.c` on ``` CHECK(s.q[0].used_idx < 70000u); /* wrapped */ ``` `simq.used_idx` is a `uint16_t`. 70000 does not fit in 16 bits, so clang 18 reports `-Wtautological-constant-out-of-range-compare`. The net Makefile builds with `-Werror`. gcc 13 accepts the same line, which is why it has built since #200. ## What the assertion protects `test_datapath` exchanges 70,000 frames so the virtio split-virtqueue indices wrap. `push_used` increments `q->used_idx` once per RX completion and publishes that value as the 16-bit used-ring index. The comment on the check is `wrapped`: after 70000 RX completions, starting from 0, that index holds `70000 mod 65536` (4464). `< 70000u` cannot observe that. Every value of a `uint16_t` is below 70000, so the comparison stayed true even when the counter had not moved. ## Why the new form is the same check ``` EQ(s.q[0].used_idx, (uint16_t)70000u); /* wrapped */ ``` `(uint16_t)70000u` is that residue. The equality holds when the free-running index has advanced 70000 steps and wrapped at 16 bits. A counter that stayed put, wrapped at the queue size, or was widened and still held the raw count 70000, fails. The frame checks in the loop (`EQ(bad, 0)`) are unchanged. `make -C native/net test sanitize mutants` passes with clang 18.1.3 and with gcc 13.3.0. Both report `NET_SECURE_MUTANTS: 30/30 killed`. Crumbs were recompiled with the tool pinned in `crumb.lock` (`d0f0b95d`); `crumb verify` is current. — Grokbot
drakestapleton reviewed (COMMENTED) on 2026-10-30 12:05 UTC Review at head `0d73933a`. Verdict: the fix is correct. It is not merge-ready yet because the branch conflicts with main (mergeable_state `dirty`). Refresh it (merge main and regenerate the .crumb files), and then it is good to go. What I checked: - The only hand-written change is in `native/net/tests/vnet_test.c` (L476-477). It replaces `CHECK(s.q[0].used_idx < 70000u)`, which is always true on a 16-bit value and which clang 18 rejects under `-Werror`, with `EQ(s.q[0].used_idx, (uint16_t)70000u)` (= 4464). - The type is really 16-bit. `simq` declares `uint16_t last_avail, used_idx;` (L116). - The counter really runs 70000 times. The `test_datapath` loop (`for (unsigned i = 0; i < 70000; i++)`) calls `sim_rx` once per frame. `sim_rx` calls `push_used` (L216-225), which does `q->used_idx++` once per RX completion. The count starts from 0 after reset (L179), and the loop requires `bad == 0`, so each iteration does exactly one completion. A counter that did not wrap or was wider would read 70000 and fail this check. A counter that was stuck or skipped steps would also fail. The old check could never fail. - EQ makes the test fail. `EQ(a,b)` is `CHECK((long long)(a) == (long long)(b))`, which counts the miss in `failures`. `main` then returns 1 if `failures` is non-zero (L618), so the test exits non-zero. It does not abort right away, but the test run fails. The `(uint16_t)` cast makes the expected value 4464 even after the widening to `long long`. - Every other changed file is a regenerated `.crumb` (`.crumb`, `native/.crumb`, `native/net/.crumb`, `native/net/tests/.crumb`). The only fields that change are `digest`, `last_commit`, `children_root`, `compiled_at`, `generated_at_commit` and `source_tree`. There is no hand-written logic in them. - CI at `0d73933a`: CodeQL, Analyze (rust, c-cpp, actions, python), AIEN Checks and sbom all pass. AIEN Alpha was skipped. The one blocker is the conflict with main, most likely in the regenerated .crumb files since main has moved on. After the refresh, please re-run CI. I am not approving this; that call stays with the maintainer. — Grokbot ### Fetch it A git bundle of the pull request's head, 4930 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/aienux/patches/2978104c5c9cf573.bundle -o 2978104c5c9cf573.bundle git fetch 2978104c5c9cf573.bundle refs/pull/477/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 477 dc9a99612b3ab63e82c7cd898d95a682a071144a ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aienux","number":477,"url":"https://github.com/aien-dev/aienux/pull/477","export_sha256":"222ed873664c8b6770fec92487a3521a4b5f81629ee6399038e519facf854bee","imported_utc":"2026-11-18T16:35:37Z"} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 79b3041e..642bac8c 100644 --- a/.crumb +++ b/.crumb @@ -22,7 +22,7 @@ "children": [ { "digest": "d3ee44743ad3be0fc84adb2c6bd89e1050d3ca0955ed20b0edf8d869fba994eb", - "last_commit": "45d8f798", + "last_commit": "9f9b346c", "name": "crates", "purpose": "Directory crates. Purpose not yet described by a human." }, @@ -33,8 +33,8 @@ "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "c59ac05fd987af776ec27a9cf67a9514b9983c9e560e39d8aeab3fccd6735ca4", - "last_commit": "b5e72686", + "digest": "8b49afe04474e38715a657115cc9dfe46e6ed9231870ca991ff519aa55778cde", + "last_commit": "0d73933a", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, @@ -51,15 +51,15 @@ "purpose": "First-party host artifact preparation tools" } ], - "children_root": "sha256:d0d0d94152315fc45d1eded2d4897192ffef4bf4998b75f3453cc23d13546ea8", - "compiled_at": "2026-10-30T11:55:01Z", + "children_root": "sha256:bc8b97c442cfc3f61da2044286e1df80f74afcaeaa1a52828912e9999e5d53cd", + "compiled_at": "2026-10-30T12:07:40Z", "compiler": "crumb-compile/1", - "digest": "sha256:b69e71613bbe6b6b244ce9a46f3cebf349be3504437cd5e10498a2acf10d3600", + "digest": "sha256:2a53ce78ae85dee959428fbda4e5aa9504ae0cb2be959d7ca09ab674547b84d4", "evidence_files": 236, "evidence_root": "sha256:55ef5621f09577ce1ada90d990955aec996d15e16a9b0f6953ecb90f3ca499df", "files": 3583, - "generated_at_commit": "fd4ac5b5bdf13645e310e506c997ca18c39b7fe2", - "source_tree": "sha256:3713511ecbd265941842215b1e46d249575ca98b91d6fc0531e71343adf909b6" + "generated_at_commit": "0d73933a87160adb6a4e9987d647d19fa56cbb19", + "source_tree": "sha256:fb8893815c631f972d82e96b320765a21fc97428a90475f2f78ca86b1172af33" }, "owner_lane": "", "provenance": { diff --git a/native/.crumb b/native/.crumb index 7cadf6e5..cb193528 100644 --- a/native/.crumb +++ b/native/.crumb @@ -50,13 +50,13 @@ "children": [ { "digest": "72ee4e94f3dc99d79ea4eb3bf619ad645c0b76d7009d1883e59adfbfce9c8ac2", - "last_commit": "a4534fd2", + "last_commit": "d7012755", "name": "argus", "purpose": "Directory native/argus. Purpose not yet described by a human." }, { "digest": "5187cf88f03271fb2a89fd18d0a97212ae419491d9bd510732bdbe54a0ccf263", - "last_commit": "b5e72686", + "last_commit": "8182d6d3", "name": "boot", "purpose": "Directory native/boot. Purpose not yet described by a human." }, @@ -68,31 +68,31 @@ }, { "digest": "ec6a4295568339a6dea0df513d23cf7a28a90d07bee2cd8f93a7417b48ff7871", - "last_commit": "a4534fd2", + "last_commit": "f45d00ad", "name": "crypto", "purpose": "Directory native/crypto. Purpose not yet described by a human." }, { "digest": "43e1cf9e246a9cdfca6b1147381ad071e1cffaf408bb58d3e09b7001e7b0eb5c", - "last_commit": "b5e72686", + "last_commit": "aab6de6d", "name": "disk", "purpose": "Directory native/disk. Purpose not yet described by a human." }, { "digest": "b42be1f0641ee6f758ee7a75ce749d2c03f69027b6c5c5cd4473f88c2cfe1137", - "last_commit": "b5e72686", + "last_commit": "8182d6d3", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, { "digest": "b9588f7026aaa3fbf7777f5c10d90a1c915cc301be98be5081d3d66106cf77c8", - "last_commit": "a4534fd2", + "last_commit": "f45d00ad", "name": "m5", "purpose": "Directory native/m5. Purpose not yet described by a human." }, { - "digest": "90a001e7a27f698fa57efcbfd2a12ac58c4aedfc6700e6f701dbdb3341727fd5", - "last_commit": "b5e72686", + "digest": "b0c2410bb450a0bf6156e064185b024b622fd844e87d7acd476df10c7af63cf6", + "last_commit": "0d73933a", "name": "net", "purpose": "Directory native/net. Purpose not yet described by a human." }, @@ -104,26 +104,26 @@ }, { "digest": "6f0bf10c76df492d27ae642792476c1138bc73f0d897b3ddca04605ac07b4268", - "last_commit": "a4534fd2", + "last_commit": "f45d00ad", "name": "sig", "purpose": "Directory native/sig. Purpose not yet described by a human." }, { "digest": "e125172a18437b662edf303f4b9615bb791f5e7d2ed94192033823185e7d40e1", - "last_commit": "a4534fd2", + "last_commit": "f45d00ad", "name": "store", "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:a1601f68113afed2345c41382487f84ac0d196668e27f12b9e6d16d705e09a9e", - "compiled_at": "2026-10-30T11:55:01Z", + "children_root": "sha256:2fb1c462f8c24cd91ad839bb18c8dbc2c388f52f6fd61f4c8350449d696d2199", + "compiled_at": "2026-10-30T12:07:40Z", "compiler": "crumb-compile/1", - "digest": "sha256:c59ac05fd987af776ec27a9cf67a9514b9983c9e560e39d8aeab3fccd6735ca4", + "digest": "sha256:8b49afe04474e38715a657115cc9dfe46e6ed9231870ca991ff519aa55778cde", "evidence_files": 24, "evidence_root": "sha256:ecc7ccf2e924c221a5bac1d91e23b13d8f3c8d78c2a893a882ed7ca5e88d855d", "files": 676, - "generated_at_commit": "fd4ac5b5bdf13645e310e506c997ca18c39b7fe2", - "source_tree": "sha256:fd6780fa57fca46ef8aa6e05e0754177b0bd5655353f8c282a941572d034f5d1" + "generated_at_commit": "0d73933a87160adb6a4e9987d647d19fa56cbb19", + "source_tree": "sha256:1c68fa7c52131a5095fbceb4b5992b336dba1c16abec069d534ecb4c1e34e782" }, "owner_lane": "", "provenance": { diff --git a/native/net/.crumb b/native/net/.crumb index 06e6e0e5..b1ca27cd 100644 --- a/native/net/.crumb +++ b/native/net/.crumb @@ -23,21 +23,21 @@ "purpose": "Directory native/net/receipts. Purpose not yet described by a human." }, { - "digest": "3550bd98277807014c71f67c99e2c542022f47aad10d511cbb6d35528bfac847", - "last_commit": "f45d00ad", + "digest": "85199fc938a1d477d1a669228b195244b7a67cd9ce84a0b93b7ee0e54eb64fe8", + "last_commit": "0d73933a", "name": "tests", "purpose": "Directory native/net/tests. Purpose not yet described by a human." } ], - "children_root": "sha256:6ea9dbff02f79c8d26aa7dd053c138ad5b9137d18a347eab9bdeea81171491af", - "compiled_at": "2026-10-30T11:26:28Z", + "children_root": "sha256:3983f6ecd8304e074d6aedb2db2b60e929ef7b4ce80432cd715a4afd5034cfa0", + "compiled_at": "2026-10-30T12:07:40Z", "compiler": "crumb-compile/1", - "digest": "sha256:90a001e7a27f698fa57efcbfd2a12ac58c4aedfc6700e6f701dbdb3341727fd5", + "digest": "sha256:b0c2410bb450a0bf6156e064185b024b622fd844e87d7acd476df10c7af63cf6", "evidence_files": 4, "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335", "files": 35, - "generated_at_commit": "32c1fa8bf81fd890c0313699e6254d06676695bf", - "source_tree": "sha256:09b2b79fd536d500e84139e0e51d951a09d2282b3dcdfed01bad8b12b58a0d0d" + "generated_at_commit": "0d73933a87160adb6a4e9987d647d19fa56cbb19", + "source_tree": "sha256:4a9c3575c69191965ee1f9bd230c208cfd832930c5e84a5f0236420c1f463f18" }, "owner_lane": "", "provenance": { diff --git a/native/net/tests/.crumb b/native/net/tests/.crumb index 2d8bdc9b..4d9b1bfb 100644 --- a/native/net/tests/.crumb +++ b/native/net/tests/.crumb @@ -20,14 +20,14 @@ } ], "children_root": "sha256:eefad7996e552393c5e8e30abc9d90b9ec8f10e51bef5b788e6131b1c76c0907", - "compiled_at": "2026-10-24T23:41:02Z", + "compiled_at": "2026-10-30T11:50:12Z", "compiler": "crumb-compile/1", - "digest": "sha256:3550bd98277807014c71f67c99e2c542022f47aad10d511cbb6d35528bfac847", + "digest": "sha256:85199fc938a1d477d1a669228b195244b7a67cd9ce84a0b93b7ee0e54eb64fe8", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 11, - "generated_at_commit": "87edb053b2f5ba274bb5ac73017266926da77846", - "source_tree": "sha256:4031a0cf2731bf60760cfb71d1d796a8d27bdf4cf79f68b9de36cfee91373a03" + "generated_at_commit": "7ef0ea446bba91d78f5cca04dccf4cacbac985e3", + "source_tree": "sha256:bb694407183db7a804275b95877e4b6235d9c8d014248cf1f8dd52deb6f91778" }, "owner_lane": "", "provenance": { diff --git a/native/net/tests/vnet_test.c b/native/net/tests/vnet_test.c index da7096dc..dfda5bac 100644 --- a/native/net/tests/vnet_test.c +++ b/native/net/tests/vnet_test.c @@ -471,7 +471,8 @@ static void test_datapath(void) if (s.wire_len[(s.nwire - 1) % 8] != len || memcmp(s.wire[(s.nwire - 1) % 8], f, len)) bad++; } EQ(bad, 0); - CHECK(s.q[0].used_idx < 70000u); /* wrapped */ + /* 16-bit used index: 70000 completions wrap once, residue 70000 mod 2^16. */ + EQ(s.q[0].used_idx, (uint16_t)70000u); /* wrapped */ EQ(s.faults, 0); check_descs(&d); } ```