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
omega-mv / seed / authority / caproot.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Linux hosted Arboris dispatch admission. The trusted launch supervisor |
| 3 | note installs a read-only MAP_SHARED view of its RxCapRoot.ro_fd. The mapping |
| 4 | note token and authenticated subject must never come from the graph or request. |
| 5 | note The fixed resource "ARBRGB10" is local to this root. RX_RIGHT_EFFECT is 4. |
| 6 | note Scope is a point-in-time check. The dispatcher owns serialization with |
| 7 | note revocation, QMD publication and subsequent fence settlement. |
| 8 | om2 |
| 9 | const arboris_gpu_resource ulong 0x4152425247423130 |
| 10 | |
| 11 | fn arboris_root_entry table long id ulong gen ulong epoch ulong tick ulong to bool |
| 12 | pos = add 32 mul id 88 |
| 13 | if or ne mapget table pos 4 id ne mapget table add pos 8 8 gen |
| 14 | ret false |
| 15 | end |
| 16 | if or ne mapget table add pos 16 4 1 ne mapget table add pos 40 8 epoch |
| 17 | ret false |
| 18 | end |
| 19 | expiry = mapget table add pos 48 8 |
| 20 | ret or eq expiry 0 lt tick expiry |
| 21 | end |
| 22 | |
| 23 | fn arboris_root_chain table long handle view ulong 2 subject ulong epoch ulong to bool |
| 24 | id = get handle 0 |
| 25 | gen = get handle 1 |
| 26 | tick = mapget table 24 8 |
| 27 | for depth ulong 9 |
| 28 | if ge id 256 |
| 29 | ret false |
| 30 | end |
| 31 | if not arboris_root_entry table id gen epoch tick |
| 32 | ret false |
| 33 | end |
| 34 | pos = add 32 mul id 88 |
| 35 | if eq depth 0 |
| 36 | if ne mapget table add pos 24 4 subject |
| 37 | ret false |
| 38 | end |
| 39 | if eq and mapget table add pos 28 4 4 0 |
| 40 | ret false |
| 41 | end |
| 42 | if ne mapget table add pos 32 8 arboris_gpu_resource |
| 43 | ret false |
| 44 | end |
| 45 | end |
| 46 | id = mapget table add pos 56 4 |
| 47 | if eq id 0xffffffff |
| 48 | ret true |
| 49 | end |
| 50 | gen = mapget table add pos 64 8 |
| 51 | end |
| 52 | ret false |
| 53 | end |
| 54 | |
| 55 | fn caproot_validate table long subject ulong handle view ulong 2 meta view ulong 16 to bool |
| 56 | if or le table 0 gt subject 0xffffffff |
| 57 | ret false |
| 58 | end |
| 59 | if or eq get handle 1 0 ne get handle 1 get meta 8 |
| 60 | ret false |
| 61 | end |
| 62 | magic = get meta 0 |
| 63 | if and ne magic 0x4152425200000001 ne magic 0x4152425300000001 |
| 64 | ret false |
| 65 | end |
| 66 | if eq get meta 7 0 |
| 67 | ret false |
| 68 | end |
| 69 | if or ne mapget table 0 4 0x50414358 ne mapget table 4 4 256 |
| 70 | ret false |
| 71 | end |
| 72 | for attempt ulong 16 |
| 73 | seq = mapget table 8 8 |
| 74 | if eq and seq 1 0 |
| 75 | epoch = mapget table 16 8 |
| 76 | ok = false |
| 77 | if eq epoch get meta 7 |
| 78 | ok = arboris_root_chain table handle subject epoch |
| 79 | end |
| 80 | if eq mapget table 8 8 seq |
| 81 | ret ok |
| 82 | end |
| 83 | end |
| 84 | cpurelax |
| 85 | end |
| 86 | ret false |
| 87 | end |