omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
GitHub aien-dev/omega-mv#322 (code only)
Apply it
git checkout -b patch-94cbaa519f62a7f1 a9ef42abf6d4d1021436e4d48c4c2311e2d26e8e curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/94cbaa519f62a7f1.patch | git am
Provenance
github-import 1
aien-dev/omega-mv
322
2ebe9fda8bcf2138c616400d9a1e57dbe94fcfeb
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":322,"url":"https://github.com/aien-dev/omega-mv/pull/322","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:19Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index 31082ea69..e3af66e3c 100644 --- a/.crumb +++ b/.crumb @@ -51,8 +51,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "bb89b5d99f5816b19958cdca790ea2f2066d87c00a0d78f4db6955f1540ed821", - "last_commit": "2041f24", + "digest": "acb4b39846f70c6ed1388aed49c2be8e94bacc05c56e1ac4c5d596717882c1f3", + "last_commit": "21baec6", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -87,33 +87,33 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "e3f161b4058818a7618cafd193f7991475b5e7888e290d0d0147641e16e735f7", - "last_commit": "62b6a28", + "digest": "48c4ef0ed53e3daac0f20dab1d5534e8288398c9d89a6fe4cadb99325372efb3", + "last_commit": "21baec6", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "c2187196e3d4e2a28000d45435ca7fc73e5af9966aa3ce3e9094b84973971db8", - "last_commit": "a76a010", + "digest": "48a04fe5705d3aa90132af9e80604e233dcbb29adfa9ebeeb1c0ef960acb01d8", + "last_commit": "21baec6", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { "digest": "ff24f7b12ceb0448c4da80d43e8ff249a3176ad3b374c3c27cc71e537ba66a00", - "last_commit": "a76a010", + "last_commit": "a9ef42a", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:65ac921169f731711e240dc032e28191d46fd298aaf54aeb76d961bac7bbf390", - "compiled_at": "2026-10-06T18:54:05Z", + "children_root": "sha256:4d78d3bf3efba57eb7348576f91dd88cdc6765c91f69c86bdcff69a8ebcf7c11", + "compiled_at": "2026-10-06T19:14:24Z", "compiler": "crumb-compile/1", - "digest": "sha256:3e3aca21865587866509da09ce3f67d9a1dda87a71640cba0095467077eafeff", + "digest": "sha256:42ebf3db0a3abb954904fc66d5c6ffbfdf36c16b935eebd1a6931efc33110568", "evidence_files": 4743, "evidence_root": "sha256:34547c38b5669eb80fad819b39b679c1b425c66bc3e69d11431d684390b900e9", - "files": 6579, - "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", - "source_tree": "sha256:0ba2f92be88283d807dea7027c98c8c98720ae7e41f77fc492a40733a745444a" + "files": 6580, + "generated_at_commit": "aa2d134f49ce50c441da54ddd8292ccacfdc86e4", + "source_tree": "sha256:02a300da6607c023cd282e97a1ccd1bfa6a2ddd9f63c7c1ff7b622699f4f561c" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/rx-host.yml b/.github/workflows/rx-host.yml index 9427d5721..4db1e9439 100644 --- a/.github/workflows/rx-host.yml +++ b/.github/workflows/rx-host.yml @@ -82,7 +82,7 @@ jobs: PHYSICS_DIR: ${{ github.workspace }}/physics-src AIENOS_R7_DIR: ${{ github.workspace }}/aienos-src AIENOS_COMMIT: ${{ steps.aienos.outputs.sha }} - run: make test-r3 test-r7 test-r8 test-r9 test-r12 test-rx-emergency test-action-graph test-state-projection test-capability-query test-capability-graph test-skillroute-compose test-semantic-comm test-cognitive-routing test-sem-incremental test-cortex test-jspace-prod test-composition test-composition-attach-asan test-composition-gate test-fabric test-fabric-living + run: make test-r3 test-r7 test-r16-operator-authority-misuse test-r8 test-r9 test-r12 test-rx-emergency test-action-graph test-state-projection test-capability-query test-capability-graph test-skillroute-compose test-semantic-comm test-cognitive-routing test-sem-incremental test-cortex test-jspace-prod test-composition test-composition-attach-asan test-composition-gate test-fabric test-fabric-living - name: Canonical machine identity (M20) run: make test-machine-identity - name: Effect capability generations are 64-bit end to end (OMEGA_EFFECT_CAP64) diff --git a/Makefile b/Makefile index f78e92fc8..d9bea8ed0 100644 --- a/Makefile +++ b/Makefile @@ -428,6 +428,22 @@ $(RX_R7_TEST): $(RX_R7_SRCS) src/runtime/rx_caproot.h src/runtime/rx_world.h \ test-r7: $(RX_R7_TEST) ./$(RX_R7_TEST) +# aienos#266/#272 at aienos.lock: the R16 operator control capability (the epoch +# right on RX_WORLD_RES_CONTROL) is refused by every authority operation, the office +# still operates the authority, and the world still accepts the capability for the halt +# check. Host only. +RX_OP_AUTH_MISUSE_SRCS = src/runtime/rx_caproot.c src/runtime/rx_world.c src/runtime/rx_coherent.c \ + src/runtime/rx_native_bind.c src/sha256.c src/omega_evidence.c \ + tests/runtime/rx_operator_authority_misuse.c +RX_OP_AUTH_MISUSE_TEST = $(OUT_DIR)/rx_operator_authority_misuse_test +$(RX_OP_AUTH_MISUSE_TEST): $(RX_OP_AUTH_MISUSE_SRCS) src/runtime/rx_caproot.h src/runtime/rx_world.h \ + src/runtime/rx_operator.h src/runtime/aienos_cap.h $(AIENOS_CAP_LIB) | $(OUT_DIR) + $(CC) $(CFLAGS) -pthread -o $@ $(RX_OP_AUTH_MISUSE_SRCS) $(AIENOS_CAP_LIB) -lm + +.PHONY: test-r16-operator-authority-misuse +test-r16-operator-authority-misuse: $(RX_OP_AUTH_MISUSE_TEST) + ./$(RX_OP_AUTH_MISUSE_TEST) + # R9: generation barrier. The candidate is prepared beside the live world. # A stop after each persistence step must recover one whole generation. RX_R9_SRCS = src/runtime/rx_caproot.c src/runtime/rx_world.c src/runtime/rx_coherent.c \ diff --git a/aienos.lock b/aienos.lock index 5641753a9..e8decdf5e 100644 --- a/aienos.lock +++ b/aienos.lock @@ -1 +1 @@ -bbad5e4250e57f8cbd1be4cf1390109aa65ef92c +b84c0a67590a934f3f3e001b12ec85ebc086a9eb diff --git a/docs/.crumb b/docs/.crumb index fdf65c8f2..8849404bb 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -118,14 +118,14 @@ } ], "children_root": "sha256:ce53c9c7f75a7d122d6a926bb304b2df1bd0730693b54887b842ad3559bafe83", - "compiled_at": "2026-10-06T01:57:59Z", + "compiled_at": "2026-10-06T18:55:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:bb89b5d99f5816b19958cdca790ea2f2066d87c00a0d78f4db6955f1540ed821", + "digest": "sha256:acb4b39846f70c6ed1388aed49c2be8e94bacc05c56e1ac4c5d596717882c1f3", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 114, - "generated_at_commit": "1f4a3c7821d769a99ce1fcc896ac8ee30a33ea69", - "source_tree": "sha256:c1905c7445c800667d356e7bd34b303d6decbacc3630effc2ad13e48f5ae4fc7" + "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", + "source_tree": "sha256:c764d5e8d30422555a58660b8a2876f48beabdb795bd7ff261ca635127e98e0b" }, "owner_lane": "", "provenance": { diff --git a/docs/r16-operator-control.md b/docs/r16-operator-control.md index 597a69a9f..9a2b985a2 100644 --- a/docs/r16-operator-control.md +++ b/docs/r16-operator-control.md @@ -206,7 +206,17 @@ earlier world or an earlier program start fails the constant-time caller check does not stop the process, its threads, ARGUS observation or the authority; it is not a kill switch and not a rollback. -### 6.1 Known limit: the halt right is the epoch right +### 6.1 Closed limit: the halt right is the epoch right + +**Closed at aienos.lock `b84c0a67590a934f3f3e001b12ec85ebc086a9eb` (aienos#272, closing +aienos#266).** The native `auth_use` now honors a privileged right only on an entry whose +resource is `AIENOS_CAP_RES_AUTHORITY`, else `AIENOS_CAP_ERR_RESOURCE`. omega's Linux +oracle (`src/runtime/rx_caproot.c` `auth_use`) carries the same rule so R7 parity holds. +Proof: `make test-r16-operator-authority-misuse` mints the operator capability as R13 does and +requires every authority operation to refuse it (and one holding every privileged right on +the control resource), the halt check to accept it, and the office to still operate; against +bbad5e4 the halt capability bumps the epoch and the test fails. `make test-r7` compares the +two authorities on the same case. The text below is the record at bbad5e4. The spec gives the stop the privileged epoch right (`spec/r16-operator-emergency-stop.md` ยง2 lines 44-45: "The right is `RX_RIGHT_EPOCH` ... The right that may void every @@ -246,7 +256,7 @@ What keeps it closed today is omega's own code, shown here and tested: `tests/runtime/rx_r7_native.c` 217 only). A future omega change that hands the control capability to any other authority entry -point reopens this; it stays a known limit until aienos#266 is closed. +point reopened this while it was a known limit (until aienos#266 closed; see the note above). ## 7. Proof (G6 by execution) diff --git a/src/.crumb b/src/.crumb index 2cba9a017..da98408d2 100644 --- a/src/.crumb +++ b/src/.crumb @@ -133,8 +133,8 @@ "purpose": "Directory src/polyglot. Purpose not yet described by a human." }, { - "digest": "ea7ee6a21ff8c2789b18dbeda15a9a72ca13369bfe42d93f66d20036ef8f75af", - "last_commit": "df6bc1c", + "digest": "232cde4802eb94e5eece9b2ca8f92636559958aa17ce8f24f0ae03bebaf4c176", + "last_commit": "62b6a28", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, @@ -169,15 +169,15 @@ "purpose": "Directory src/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:6418c3add919bdad8d246a8aff39d203104f1733d77d7ff7112c0800edf409fa", - "compiled_at": "2026-10-06T02:24:19Z", + "children_root": "sha256:f49f5aa012a5120f4c38a20c4f4db4555b292e7d7cc4f37bc2ff2b7494b550d1", + "compiled_at": "2026-10-06T18:55:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:e3f161b4058818a7618cafd193f7991475b5e7888e290d0d0147641e16e735f7", + "digest": "sha256:48c4ef0ed53e3daac0f20dab1d5534e8288398c9d89a6fe4cadb99325372efb3", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 411, - "generated_at_commit": "df6bc1cd3e0fbb70807274858bd734eb677be72c", - "source_tree": "sha256:00da16f90258cecd4d43d5c7f673680e7b0d2d707068fd1e1da4f3e904595087" + "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", + "source_tree": "sha256:d9b07fcbab1f66753a569b7671d8a8ab44154a0d8c847437a89d1c4aa25750d0" }, "owner_lane": "", "provenance": { diff --git a/src/runtime/.crumb b/src/runtime/.crumb index 75f1c61f3..0975d8c96 100644 --- a/src/runtime/.crumb +++ b/src/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-06T01:18:22Z", + "compiled_at": "2026-10-06T18:55:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:ea7ee6a21ff8c2789b18dbeda15a9a72ca13369bfe42d93f66d20036ef8f75af", + "digest": "sha256:232cde4802eb94e5eece9b2ca8f92636559958aa17ce8f24f0ae03bebaf4c176", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 63, - "generated_at_commit": "55f11ad10e21f9f2dd49649a95da0a85f93ce4df", - "source_tree": "sha256:5a85b38f7bdaf9f03d286b7342558d39f843abe4e86c70230b717c2448c49a49" + "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", + "source_tree": "sha256:c8978d2ea285802f890b60974c9f6d4da675bc9cb54edc24acf39038a34480e1" }, "owner_lane": "", "provenance": { diff --git a/src/runtime/rx_caproot.c b/src/runtime/rx_caproot.c index 8bfe00873..713bbf1ea 100644 --- a/src/runtime/rx_caproot.c +++ b/src/runtime/rx_caproot.c @@ -140,6 +140,11 @@ static int auth_use(RxCapTable *t, const uint8_t *delivered, RxCapRef a, if (e->lease_expiry && clock >= e->lease_expiry) return RX_CAP_ERR_EXPIRED; if (chain_ok(t, e) != RX_CAP_OK) return RX_CAP_ERR_CHAIN; if ((e->rights & need) != need) return RX_CAP_ERR_UNAUTHORIZED; + /* aienos#266/#272 parity: a privileged right is an authority-office right, + * honored only on an entry whose resource is RX_CAP_RES_AUTHORITY, as in + * the native auth_use at aienos.lock. */ + if ((need & RX_RIGHT_PRIVILEGED) && e->resource != RX_CAP_RES_AUTHORITY) + return RX_CAP_ERR_RESOURCE; if (out) *out = e; return RX_CAP_OK; } diff --git a/tests/.crumb b/tests/.crumb index b4b3cbc31..613c98dc0 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -253,8 +253,8 @@ "purpose": "Directory tests/relations. Purpose not yet described by a human." }, { - "digest": "2de57bdd33483fb5cf55de98b3767f5f38c0c4065f3eefaac648a67f02e7b46c", - "last_commit": "de7e72e", + "digest": "58546f913d961949734134a836d26504d48c66e6b07d6a774426bfa086f7d6b6", + "last_commit": "c44185c", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -283,15 +283,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:f10af5b33d005f7f66640a9a370308c5527d614f6ebf2524c8409594dbf60d1a", - "compiled_at": "2026-10-06T14:35:34Z", + "children_root": "sha256:c630c07cfd744174cf35b42b04d96bbb15dfedb76557947943c412d3219586c5", + "compiled_at": "2026-10-06T19:13:39Z", "compiler": "crumb-compile/1", - "digest": "sha256:c2187196e3d4e2a28000d45435ca7fc73e5af9966aa3ce3e9094b84973971db8", + "digest": "sha256:48a04fe5705d3aa90132af9e80604e233dcbb29adfa9ebeeb1c0ef960acb01d8", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", - "files": 816, - "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2", - "source_tree": "sha256:0c8c752ed57138adee3ecdd64fd47edb63b5819de6852d7170910c7bb2002c59" + "files": 817, + "generated_at_commit": "c44185c54ef6363f3ce3f61f547c8ce323b1cfae", + "source_tree": "sha256:62f0f6c749b0bcbe10827a0bebf3617c2d76c38a4d661e9eb6430bd9554fac1f" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index 0a2ecc375..a0b899753 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-06T14:35:34Z", + "compiled_at": "2026-10-06T19:13:39Z", "compiler": "crumb-compile/1", - "digest": "sha256:2de57bdd33483fb5cf55de98b3767f5f38c0c4065f3eefaac648a67f02e7b46c", + "digest": "sha256:58546f913d961949734134a836d26504d48c66e6b07d6a774426bfa086f7d6b6", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 63, - "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2", - "source_tree": "sha256:30f236c631a8792c1403ab55d5decbed02c1febaefb64e1b41c5930f22b83022" + "files": 64, + "generated_at_commit": "c44185c54ef6363f3ce3f61f547c8ce323b1cfae", + "source_tree": "sha256:61a725e8e3dd009b935bf9fc387713879d336597afefccb8966afc74bf963802" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/rx_operator_authority_misuse.c b/tests/runtime/rx_operator_authority_misuse.c new file mode 100644 index 000000000..c76bcdcb6 --- /dev/null +++ b/tests/runtime/rx_operator_authority_misuse.c @@ -0,0 +1,138 @@ +/* + * rx_operator_authority_misuse.c -- the R16 operator control capability + * against the locked native AIENOS authority (aienos#266, aienos#272). + * + * The operator's capability is minted as the R13 program mints it + * (tests/runtime/rx_r13_living.c: RX_OPERATOR_SUBJ, RX_WORLD_RES_CONTROL, + * RX_WORLD_RIGHT_HALT, issued by the office). It is the epoch right on the + * control resource (docs/r16-operator-control.md section 6.1). This test + * proves, by execution against $(AIENOS_CAP_LIB): + * (a) the authority's office still mints, revokes, reclaims, advances the + * clock and bumps the epoch; + * (b) the control capability, and one carrying every privileged right on + * the control resource, are refused by every authority operation with + * RX_CAP_ERR_RESOURCE, and nothing changes; + * (c) the world still accepts the control capability for the halt check + * (rx_world_validate_cap on RX_WORLD_RES_CONTROL with + * RX_WORLD_RIGHT_HALT), the check stop/status/resume run through. + * Against an aienos.lock without the resource check (bbad5e4) part (b) fails. + */ +#include <stdint.h> +#include <stdio.h> +#include <string.h> + +#include "../../src/runtime/aienos_cap.h" +#include "../../src/runtime/rx_caproot.h" +#include "../../src/runtime/rx_operator.h" +#include "../../src/runtime/rx_world.h" + +static int g_fail, g_pass; + +static void expect(const char *what, int got, int want) { + if (got == want) { + g_pass++; + printf("ok %s (%d)\n", what, got); + } else { + g_fail++; + printf("FAIL %s: got %d, want %d\n", what, got, want); + } +} + +static AienosCapRef office_of(AienosCapAdmin *admin) { + AienosCapRef o = {UINT32_MAX, 0}; + aienos_cap_office(admin, &o); + return o; +} + +static int mint(AienosCapAdmin *admin, uint32_t subject, uint64_t resource, uint32_t rights, + AienosCapRef *out) { + AienosCapMint m = {3, subject, resource, rights, 0, {UINT32_MAX, 0}, office_of(admin)}; + return aienos_cap_mint(admin, &m, out); +} + +static RxCapRef rx(AienosCapRef r) { return (RxCapRef){r.cap_id, r.generation}; } + +int main(void) { + AienosCapAdmin *admin = NULL; + AienosCapView *view = NULL; + if (aienos_cap_start(&admin, &view) != RX_CAP_OK) { + printf("FAIL native authority start\n"); + return 1; + } + RxWorld world; + if (rx_world_init_native(&world, view, 2, 1u << 12) != RX_OK) { + printf("FAIL native world init\n"); + aienos_cap_stop(admin, view); + return 1; + } + const uint32_t all_priv = RX_RIGHT_MINT | RX_RIGHT_REVOKE | RX_RIGHT_RECLAIM | + RX_RIGHT_EPOCH | RX_RIGHT_CLOCK; + AienosCapRef halt, wide, victim, victim2, minted; + expect("mint operator control capability (as R13)", + mint(admin, RX_OPERATOR_SUBJ, RX_WORLD_RES_CONTROL, RX_WORLD_RIGHT_HALT, &halt), RX_CAP_OK); + expect("mint every privileged right on the control resource", + mint(admin, RX_OPERATOR_SUBJ, RX_WORLD_RES_CONTROL, all_priv, &wide), RX_CAP_OK); + expect("mint a victim", mint(admin, 2, 0x77, RX_RIGHT_READ, &victim), RX_CAP_OK); + + /* (b) misuse: the control capability operates no authority entry point. + * The halt cap holds only the epoch right, so its epoch bump is the hole + * aienos#266 named (refused on the resource since aienos#272); its other + * operations lack the right and stay refused as before. The wide cap holds + * every right each operation needs, so every refusal is the resource. */ + expect("halt cap: bump epoch refused on the resource", aienos_cap_bump_epoch(admin, halt), + RX_CAP_ERR_RESOURCE); + expect("halt cap: advance clock refused (no clock right)", + aienos_cap_advance_clock(admin, halt, 1), RX_CAP_ERR_UNAUTHORIZED); + expect("halt cap: revoke refused (no revoke right)", aienos_cap_revoke(admin, halt, victim), + RX_CAP_ERR_UNAUTHORIZED); + AienosCapMint mh = {3, 2, 0x78, RX_RIGHT_READ, 0, {UINT32_MAX, 0}, halt}; + expect("halt cap: mint refused (no mint right)", aienos_cap_mint(admin, &mh, &minted), + RX_CAP_ERR_UNAUTHORIZED); + expect("wide control cap: bump epoch refused on the resource", + aienos_cap_bump_epoch(admin, wide), RX_CAP_ERR_RESOURCE); + expect("wide control cap: advance clock refused on the resource", + aienos_cap_advance_clock(admin, wide, 1), RX_CAP_ERR_RESOURCE); + expect("wide control cap: revoke refused on the resource", + aienos_cap_revoke(admin, wide, victim), RX_CAP_ERR_RESOURCE); + expect("wide control cap: reclaim refused on the resource", + aienos_cap_reclaim(admin, wide, victim.cap_id), RX_CAP_ERR_RESOURCE); + AienosCapMint mw = {3, 2, 0x78, RX_RIGHT_READ, 0, {UINT32_MAX, 0}, wide}; + expect("wide control cap: mint refused on the resource", aienos_cap_mint(admin, &mw, &minted), + RX_CAP_ERR_RESOURCE); + /* Nothing moved: the victim and both control capabilities are still live + * at the same epoch (a bump would have staled every one of them). */ + expect("victim still valid", rx_world_validate_cap(&world, rx(victim), 2, 0x77, RX_RIGHT_READ, NULL), + RX_CAP_OK); + + /* (c) the halt check the operator commands run through still passes. */ + expect("world accepts control cap for the halt check", + rx_world_validate_cap(&world, rx(halt), RX_OPERATOR_SUBJ, RX_WORLD_RES_CONTROL, + RX_WORLD_RIGHT_HALT, NULL), RX_CAP_OK); + expect("world refuses control cap on another resource", + rx_world_validate_cap(&world, rx(halt), RX_OPERATOR_SUBJ, 0x77, RX_WORLD_RIGHT_HALT, NULL), + RX_CAP_ERR_RESOURCE); + + /* (a) legitimate authority operations by the office still succeed. */ + AienosCapRef office = office_of(admin); + expect("office advances the clock", aienos_cap_advance_clock(admin, office, 1), RX_CAP_OK); + expect("office revokes", aienos_cap_revoke(admin, office, victim), RX_CAP_OK); + expect("office reclaims", aienos_cap_reclaim(admin, office, victim.cap_id), RX_CAP_OK); + expect("office mints", mint(admin, 2, 0x79, RX_RIGHT_READ, &victim2), RX_CAP_OK); + AienosCapRef clock_cap; + expect("authority-resource clock cap minted", + mint(admin, RX_OPERATOR_SUBJ, 0 /* AIENOS_CAP_RES_AUTHORITY */, RX_RIGHT_CLOCK, &clock_cap), + RX_CAP_OK); + expect("authority-resource clock cap advances the clock", + aienos_cap_advance_clock(admin, clock_cap, 1), RX_CAP_OK); + expect("office bumps the epoch", aienos_cap_bump_epoch(admin, office), RX_CAP_OK); + expect("control cap stale after the office's epoch bump", + rx_world_validate_cap(&world, rx(halt), RX_OPERATOR_SUBJ, RX_WORLD_RES_CONTROL, + RX_WORLD_RIGHT_HALT, NULL), RX_CAP_ERR_EPOCH); + + rx_world_destroy(&world); + aienos_cap_stop(admin, view); + printf("rx_operator_authority_misuse: %d passed, %d failed\n", g_pass, g_fail); + if (g_fail) return 1; + printf("OMEGA_OPERATOR_AUTHORITY_MISUSE_REFUSED PASS\n"); + return 0; +} diff --git a/tests/runtime/rx_r7_native.c b/tests/runtime/rx_r7_native.c index 97edb857c..fa836c7d1 100644 --- a/tests/runtime/rx_r7_native.c +++ b/tests/runtime/rx_r7_native.c @@ -233,6 +233,21 @@ static int corpus(void) { aienos_cap_revoke(p.native_admin, to_native(&p, revoker), native_office)); validate_both(&p, "office still live", linux_office, 0, 0, RX_RIGHT_MINT); + /* aienos#266/#272: a privileged right on a resource other than the + * authority (the R16 operator's epoch right on the control resource) is + * refused by every authority operation, in both authorities. */ + RxCapRef control; + mint_both(&p, "control-resource privileged cap", 70, 0x906, + RX_RIGHT_EPOCH | RX_RIGHT_CLOCK | RX_RIGHT_REVOKE | RX_RIGHT_RECLAIM | RX_RIGHT_MINT, + 0, none, 0, &control); + expect_eq("control cap bumps the epoch", rx_capadmin_bump_epoch(&p.admin, control), + aienos_cap_bump_epoch(p.native_admin, to_native(&p, control))); + expect_eq("control cap advances the clock", + rx_capadmin_advance_clock(&p.admin, control, 1), + aienos_cap_advance_clock(p.native_admin, to_native(&p, control), 1)); + expect_eq("control cap revokes", rx_capadmin_revoke(&p.admin, control, revoker), + aienos_cap_revoke(p.native_admin, to_native(&p, control), to_native(&p, revoker))); + validate_both(&p, "control cap still live", control, 70, 0x906, RX_RIGHT_EPOCH); RxCapRef cur; mint_both(&p, "depth base", 1, 0x20, RX_RIGHT_READ | RX_RIGHT_DELEGATE, 0, none, 0, &cur);