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#272 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/0bdcde7e352e33da.bundle -o 0bdcde7e352e33da.bundle git fetch 0bdcde7e352e33da.bundle refs/pull/272/head
Provenance
github-import 1
aien-dev/aienux
272
00a75dd01e25a0a42b021fc3b6473f0725d61e10
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":272,"url":"https://github.com/aien-dev/aienux/pull/272","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:06Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index 04af6382..0e653aa6 100644 --- a/.crumb +++ b/.crumb @@ -27,14 +27,14 @@ "purpose": "Directory crates. Purpose not yet described by a human." }, { - "digest": "5e5be67d1fbe4c9cff1c82bc2771db42450873d04037ef608917e5167359df13", - "last_commit": "5836561", + "digest": "bf79b3f7eac22405088a596c95f8e29f02f09863be146ce4978f91aab618bda1", + "last_commit": "5e3634e", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "824c5b5926f18ffae7c3f46491ce3bd78758f79ca9fdcb4f6c59b1fadff785f2", - "last_commit": "3df181c", + "digest": "6927d3188791f1611d1451adc3998da13661a8a026a7d0b30c5d318e55fcdccd", + "last_commit": "2529de3", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, @@ -45,15 +45,15 @@ "purpose": "Directory scripts. Purpose not yet described by a human." } ], - "children_root": "sha256:f059835856e5f9c2aeb2f0a7266eaae5f072eafee9357045ae79d1209ac0f765", - "compiled_at": "2026-10-06T14:19:06Z", + "children_root": "sha256:82e3b069f9b1f4cd48ace284b1b959fcae8086a2afea69f70feeec997e7b6376", + "compiled_at": "2026-10-06T14:54:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:3a0361c7d2a632de8d1f78a7ee4b077313a8fae5a57131123428acf26b77d450", + "digest": "sha256:91071752742465e2bc2af5e46d6547f47eeae6a8b5b24a35119ce64583044294", "evidence_files": 152, "evidence_root": "sha256:a74ab9a4f344734b1737c5c8f029eeec57f10340cf251cf0484903f158c3f418", - "files": 2875, - "generated_at_commit": "58365612acf1272e4f3f39a91734b77e5fc53a95", - "source_tree": "sha256:033d106e89a54ecafc7d14de630ae5f34123e487f10ec5697009b0845401083a" + "files": 2876, + "generated_at_commit": "5e3634e05d693838e15b3a414be81c1017220f79", + "source_tree": "sha256:b63b6d203b75a29440d23e80b1bfac445e3b54b9a565a2b0fe237de542fe5e14" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index 848cc2ad..fd67c5fe 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -30,14 +30,14 @@ } ], "children_root": "sha256:25a2af14107c1c2ae96916dd5c4086195ebd4117975ea0ae458855ac21f46099", - "compiled_at": "2026-10-06T14:19:06Z", + "compiled_at": "2026-10-06T14:54:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:5e5be67d1fbe4c9cff1c82bc2771db42450873d04037ef608917e5167359df13", + "digest": "sha256:bf79b3f7eac22405088a596c95f8e29f02f09863be146ce4978f91aab618bda1", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 60, - "generated_at_commit": "58365612acf1272e4f3f39a91734b77e5fc53a95", - "source_tree": "sha256:b1267ad1031b76b866903c9ef09601ae0e88a946c1c619296e04144b2a1e9b78" + "files": 61, + "generated_at_commit": "5e3634e05d693838e15b3a414be81c1017220f79", + "source_tree": "sha256:402b3c5f575a0d309643621680452d5a799618907a908c24cd90d8c1ebbc4630" }, "owner_lane": "", "provenance": { diff --git a/docs/CAPABILITY_AUTHORITY_RESOURCE.md b/docs/CAPABILITY_AUTHORITY_RESOURCE.md new file mode 100644 index 00000000..15e36922 --- /dev/null +++ b/docs/CAPABILITY_AUTHORITY_RESOURCE.md @@ -0,0 +1,34 @@ +# Capability authority: privileged rights belong to the authority office (issue #266) + +Answers the known limit in omega `docs/r16-operator-control.md` ("the halt right is the epoch right"). + +## Rule + +In `native/capability/aienos_capability.c`, `auth_use` is the single gate for every privileged +authority operation: mint (root), revoke, reclaim, clock advance and epoch bump. It now also +requires the presented entry's resource to be `AIENOS_CAP_RES_AUTHORITY`. A refusal returns +`AIENOS_CAP_ERR_RESOURCE`. + +A capability may still carry a privileged right on another resource, for example the operator +CONTROL resource with the epoch right used as the halt right. `aienos_cap_validate` still accepts it +for that resource, so operator stop, status and resume keep working. The authority operations +simply no longer accept it, so it can never step the epoch, move the clock, revoke, reclaim or mint. + +## Why the resource and not a new right + +No accepted ADR or spec in this repository defines a distinct halt or stop right, and adding one +would change the rights layout the reaction world links against unchanged. The resource check closes +the hole at the one gate, with no ABI change. Delegation is untouched: privileged rights still +cannot be delegated. + +## Evidence + +`make test` in `native/capability`: `control_resource_capability_cannot_operate_the_authority` +(negative: epoch, clock, revoke, reclaim, mint refused; regression: CONTROL-resource validate and the +real office still work). `make mutants`: `privileged_right_ignores_resource` removes the check and +the tests must kill it. + +## Pin note + +The `aienos.lock` pin in other repositories moves only through a new named candidate, so omega keeps +its limit note until it adopts one. diff --git a/native/.crumb b/native/.crumb index a84faafc..e869a2dd 100644 --- a/native/.crumb +++ b/native/.crumb @@ -61,8 +61,8 @@ "purpose": "Directory native/boot. Purpose not yet described by a human." }, { - "digest": "77549724e1d580ea9df8accae4e5683cab8a5a6b3f9652d3594732fbc4a8ec60", - "last_commit": "098e9b6", + "digest": "9a4836747ec6db7bfb75218df75936070c35e3a51470f366687e156dc6ba8d71", + "last_commit": "2529de3", "name": "capability", "purpose": "Directory native/capability. Purpose not yet described by a human." }, @@ -80,7 +80,7 @@ }, { "digest": "772d89376f67bf1c8378f072b802ea2395d608ed6482b132cfc5a56fae6e1bd3", - "last_commit": "9e69692", + "last_commit": "3df181c", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, @@ -109,15 +109,15 @@ "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:a0c34acd926a971c12de81fab70875c0e721f00b968e7f3b196fab8f1f68e1e0", - "compiled_at": "2026-10-06T11:55:32Z", + "children_root": "sha256:24efd66c5c96a0853fb1c8db0b5314d1d470056d3ea82af760458b41aa43b028", + "compiled_at": "2026-10-06T14:20:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:824c5b5926f18ffae7c3f46491ce3bd78758f79ca9fdcb4f6c59b1fadff785f2", + "digest": "sha256:6927d3188791f1611d1451adc3998da13661a8a026a7d0b30c5d318e55fcdccd", "evidence_files": 4, "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335", "files": 317, - "generated_at_commit": "788425caf3125f809254efb433fd5bc036eb6a59", - "source_tree": "sha256:e8dd1e9d9f55a9600622d0d149fe5783ef50136f3ea322d471fd9cf2b6e5bf83" + "generated_at_commit": "2529de3fb99083fbf46e3b028806efd8b2789259", + "source_tree": "sha256:9f5aad72afbe6ef7bcc4cbee3504629bf387320e4d101b5348687aefad98f2a5" }, "owner_lane": "", "provenance": { diff --git a/native/capability/.crumb b/native/capability/.crumb index 2e2b8c57..c8cd726b 100644 --- a/native/capability/.crumb +++ b/native/capability/.crumb @@ -13,21 +13,21 @@ "generated": { "children": [ { - "digest": "96269f071dd30edbbaf1a52af28f696d46c966c3086aab662bf1c90f98927c92", - "last_commit": "098e9b6", + "digest": "78115cdbda04ee0b7568424dbdba2833bd201f01118cf01464cb17653fc26aee", + "last_commit": "2529de3", "name": "tests", "purpose": "Directory native/capability/tests. Purpose not yet described by a human." } ], - "children_root": "sha256:9fc6d0540f90bfac3b92ff08bc16d03c915ae1dd7854bfdb7e303ca42e8b893b", - "compiled_at": "2026-10-04T13:47:18Z", + "children_root": "sha256:0c70cfa122966e11065bca94434dcb159c75a4557cf6322bbc5256e28d49f2e5", + "compiled_at": "2026-10-06T14:20:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:77549724e1d580ea9df8accae4e5683cab8a5a6b3f9652d3594732fbc4a8ec60", + "digest": "sha256:9a4836747ec6db7bfb75218df75936070c35e3a51470f366687e156dc6ba8d71", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 8, - "generated_at_commit": "a863d5c1f5bd89c88c5f6671eecfd27b599ee512", - "source_tree": "sha256:a88026164287c5e89625ce399ee9fb9a0ea02295ea0ef196c0a90341af5af8e0" + "generated_at_commit": "2529de3fb99083fbf46e3b028806efd8b2789259", + "source_tree": "sha256:f1495160ac086d24628c729fdbe2b74985466e20ed8156db8656436753e4e859" }, "owner_lane": "", "provenance": { diff --git a/native/capability/Makefile b/native/capability/Makefile index 5dae6300..bd417897 100644 --- a/native/capability/Makefile +++ b/native/capability/Makefile @@ -3,7 +3,7 @@ # # make build out/libaienos_capability.a # make test build and run the rule tests (SEED=n picks the random-op seed) -# make mutants plant 17 known bugs one at a time; the existing tests must +# make mutants plant 18 known bugs one at a time; the existing tests must # catch every one (see the table near the end of this file) # make clean @@ -113,6 +113,7 @@ mint_depth_limit|aienos_capability.c|1|ancestor_hops(s, r->parent.cap_id) >= AIE revoke_no_cascade|aienos_capability.c|1|parent->state == AIENOS_CAP_STATE_REVOKED|0 generation_not_advanced|aienos_capability.c|1|*out = generation + 1|*out = generation authorize_epoch|aienos_capability.c|2|e->epoch != s->epoch) return AIENOS_CAP_ERR_EPOCH|0) return AIENOS_CAP_ERR_EPOCH +privileged_right_ignores_resource|aienos_capability.c|1|e->resource != AIENOS_CAP_RES_AUTHORITY)|0) contain_subject_mismatch|aienos_contain.c|1|e.subject != r->principal|0 contain_not_leaf|aienos_contain.c|1|has_live_child(g, r->target.cap_id, r->target.generation)|0 contain_protected_subject|aienos_contain.c|1|if (is_protected_subject(r->principal)) return true|if (0) return true diff --git a/native/capability/aienos_capability.c b/native/capability/aienos_capability.c index 302fb536..c4920a4e 100644 --- a/native/capability/aienos_capability.c +++ b/native/capability/aienos_capability.c @@ -201,7 +201,10 @@ static uint32_t ancestor_hops(const CapState *s, uint32_t entry_id) { } /* The caller must present a delivered, live, current reference that holds - * every right in `need`. */ + * every right in `need`. A privileged right is an authority-office right: + * it is honored only on an entry whose resource is AIENOS_CAP_RES_AUTHORITY, + * so a capability that carries (say) the epoch right on some other resource, + * such as an operator control resource, cannot step the authority (#266). */ static int auth_use(const CapState *s, AienosCapRef authority, uint32_t need, uint32_t *index) { if (authority.cap_id >= AIENOS_CAP_MAX) return AIENOS_CAP_ERR_UNAUTHORIZED; uint32_t i = authority.cap_id; @@ -214,6 +217,8 @@ static int auth_use(const CapState *s, AienosCapRef authority, uint32_t need, ui int rc = chain_ok(s, i); if (rc != AIENOS_CAP_OK) return rc; if ((e->rights & need) != need) return AIENOS_CAP_ERR_UNAUTHORIZED; + if ((need & AIENOS_CAP_RIGHT_PRIVILEGED) && e->resource != AIENOS_CAP_RES_AUTHORITY) + return AIENOS_CAP_ERR_RESOURCE; *index = i; return AIENOS_CAP_OK; } diff --git a/native/capability/tests/.crumb b/native/capability/tests/.crumb index 956b60cc..aab86d5f 100644 --- a/native/capability/tests/.crumb +++ b/native/capability/tests/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-04T13:47:18Z", + "compiled_at": "2026-10-06T14:20:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:96269f071dd30edbbaf1a52af28f696d46c966c3086aab662bf1c90f98927c92", + "digest": "sha256:78115cdbda04ee0b7568424dbdba2833bd201f01118cf01464cb17653fc26aee", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 2, - "generated_at_commit": "a863d5c1f5bd89c88c5f6671eecfd27b599ee512", - "source_tree": "sha256:bd798f0c277c7680040467b79fd1fe8e1a8ec986dcaa6b2535811b16f2ac6a6c" + "generated_at_commit": "2529de3fb99083fbf46e3b028806efd8b2789259", + "source_tree": "sha256:f9e15c7c882c1946001bb923ff71e3650d0bb777a187a228a21df8d21decb860" }, "owner_lane": "", "provenance": { diff --git a/native/capability/tests/capability_test.c b/native/capability/tests/capability_test.c index 4e2f06a9..7a9de35b 100644 --- a/native/capability/tests/capability_test.c +++ b/native/capability/tests/capability_test.c @@ -776,8 +776,50 @@ static void validate_refuses_child_of_non_live_parent_in_corrupt_table(void) { aienos_cap_stop(a.admin, a.view); } +/* #266: a privileged right is an authority-office right. A capability that + * carries privileged rights on another resource (the operator CONTROL + * resource) is honored by validate for that resource, but never accepted by + * the authority operations. */ +static void control_resource_capability_cannot_operate_the_authority(void) { + Auth a = boot(); + const uint64_t control = 0xC0DEull; + AienosCapRef halt, victim, ok; + const uint32_t all_priv = AIENOS_CAP_RIGHT_PRIVILEGED & ~AIENOS_CAP_RIGHT_PROMOTE; + EQ(root_mint(&a, 1, control, AIENOS_CAP_RIGHT_EPOCH | AIENOS_CAP_RIGHT_READ, &halt), + AIENOS_CAP_OK); + EQ(root_mint(&a, 1, control, all_priv, &ok), AIENOS_CAP_OK); + EQ(root_mint(&a, 2, 0x77, AIENOS_CAP_RIGHT_READ, &victim), AIENOS_CAP_OK); + /* Negative: no authority operation accepts a control-resource capability. */ + EQ(aienos_cap_bump_epoch(a.admin, halt), AIENOS_CAP_ERR_RESOURCE); + EQ(aienos_cap_bump_epoch(a.admin, ok), AIENOS_CAP_ERR_RESOURCE); + EQ(aienos_cap_advance_clock(a.admin, ok, 1), AIENOS_CAP_ERR_RESOURCE); + EQ(aienos_cap_revoke(a.admin, ok, victim), AIENOS_CAP_ERR_RESOURCE); + EQ(aienos_cap_reclaim(a.admin, ok, victim.cap_id), AIENOS_CAP_ERR_RESOURCE); + AienosCapMint m = {3, 2, 0x78, AIENOS_CAP_RIGHT_READ, 0, NONE, ok}; + AienosCapRef out; + EQ(aienos_cap_mint(a.admin, &m, &out), AIENOS_CAP_ERR_RESOURCE); + /* Nothing moved: victim still live, epoch unchanged (office still works). */ + EQ(validate(&a, victim, 2, 0x77, AIENOS_CAP_RIGHT_READ), AIENOS_CAP_OK); + /* Regression: operator stop/status/resume checks on CONTROL still pass. */ + EQ(validate(&a, halt, 1, control, AIENOS_CAP_RIGHT_EPOCH), AIENOS_CAP_OK); + EQ(validate(&a, halt, 1, control, AIENOS_CAP_RIGHT_READ), AIENOS_CAP_OK); + EQ(validate(&a, ok, 1, control, AIENOS_CAP_RIGHT_CLOCK), AIENOS_CAP_OK); + /* Regression: the real office still performs every operation. */ + EQ(aienos_cap_advance_clock(a.admin, office(&a), 1), AIENOS_CAP_OK); + EQ(aienos_cap_revoke(a.admin, office(&a), victim), AIENOS_CAP_OK); + EQ(aienos_cap_reclaim(a.admin, office(&a), victim.cap_id), AIENOS_CAP_OK); + /* Authority-resource privileged delegate-free caps still work too. */ + AienosCapRef reclaimer; + EQ(root_mint(&a, 1, AIENOS_CAP_RES_AUTHORITY, AIENOS_CAP_RIGHT_CLOCK, &reclaimer), + AIENOS_CAP_OK); + EQ(aienos_cap_advance_clock(a.admin, reclaimer, 1), AIENOS_CAP_OK); + EQ(aienos_cap_bump_epoch(a.admin, office(&a)), AIENOS_CAP_OK); + aienos_cap_stop(a.admin, a.view); +} + int main(int argc, char **argv) { uint64_t base_seed = argc > 1 ? strtoull(argv[1], NULL, 0) : 0x5eedull; + control_resource_capability_cannot_operate_the_authority(); high_half_resource_is_kept(); forged_stale_subject_resource_and_rights_fail_closed(); amplification_lease_epoch_and_revoked_ancestor_fail();