aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / om / agora / startup-check.om
| 1 | note Native startup verification policy; no production process is launched or signalled. |
| 2 | note With five args: deadline_ns, executable_match, effective_uid, effective_gid, same_pid_listener. |
| 3 | note Policy exits: 0 pending, 1 ready, 2 refused; malformed syntax exits 90 and checked-integer overflow traps. |
| 4 | note Without args: synthetic credential snapshots exercise the same policy against the real monotonic clock. |
| 5 | note WolframLanguageEvaluator: UnitConvert[Quantity[10,"Seconds"],"Nanoseconds"] -> Quantity[10000000000,"Nanoseconds"]. |
| 6 | global sc_argb uchar 32 |
| 7 | text sc_pass "AGORA STARTUP OMEGA PASS modeled pre-exec root pending; expected executable/976/964/same-PID listener accepted; root past deadline refused\n" |
| 8 | fn sc_arg idx ulong to long |
| 9 | n = argread idx sc_argb 0 len sc_argb |
| 10 | if or le n 0 ge n long len sc_argb |
| 11 | ret -1 |
| 12 | end |
| 13 | v = long 0 |
| 14 | for i ulong ulong n |
| 15 | c = get sc_argb i |
| 16 | if or lt c 48 gt c 57 |
| 17 | ret -1 |
| 18 | end |
| 19 | v = add mul v 10 long sub c 48 |
| 20 | end |
| 21 | ret v |
| 22 | end |
| 23 | fn sc_gate xe bool uid long gid long sc_own bool until long to int |
| 24 | now = monons |
| 25 | if or lt now 0 ge now until |
| 26 | ret 2 |
| 27 | end |
| 28 | note MUTANT_PREEXEC: a root pre-exec observation is pending, not an immediate failure. |
| 29 | if xe |
| 30 | if or ne uid 976 ne gid 964 |
| 31 | ret 2 |
| 32 | end |
| 33 | if sc_own |
| 34 | now = monons |
| 35 | if or lt now 0 ge now until |
| 36 | ret 2 |
| 37 | end |
| 38 | ret 1 |
| 39 | end |
| 40 | ret 0 |
| 41 | end |
| 42 | if sc_own |
| 43 | ret 2 |
| 44 | end |
| 45 | if and eq uid 0 or eq gid 0 eq gid 964 |
| 46 | ret 0 |
| 47 | end |
| 48 | if and eq uid 976 eq gid 964 |
| 49 | ret 0 |
| 50 | end |
| 51 | ret 2 |
| 52 | end |
| 53 | fn sc_root until long to bool |
| 54 | while true bound 999999 |
| 55 | now = monons |
| 56 | if lt now 0 |
| 57 | ret false |
| 58 | end |
| 59 | if ge now until |
| 60 | ret eq sc_gate false 0 0 false until 2 |
| 61 | end |
| 62 | state = sc_gate false 0 0 false until |
| 63 | if eq state 1 |
| 64 | ret false |
| 65 | end |
| 66 | if eq state 2 |
| 67 | now = monons |
| 68 | ret and ge now 0 ge now until |
| 69 | end |
| 70 | r = sleepns 10000000 |
| 71 | if lt r 0 |
| 72 | ret false |
| 73 | end |
| 74 | end |
| 75 | ret false |
| 76 | end |
| 77 | fn sc_test to int |
| 78 | start = monons |
| 79 | if lt start 0 |
| 80 | ret 39 |
| 81 | end |
| 82 | until = add start 10000000000 |
| 83 | if ne sc_gate false 0 0 false until 0 |
| 84 | ret 40 |
| 85 | end |
| 86 | if ne sc_gate false 976 964 false until 0 |
| 87 | ret 41 |
| 88 | end |
| 89 | if ne sc_gate true 976 964 false until 0 |
| 90 | ret 42 |
| 91 | end |
| 92 | if ne sc_gate true 976 964 true until 1 |
| 93 | ret 43 |
| 94 | end |
| 95 | if ne sc_gate true 0 0 true until 2 |
| 96 | ret 44 |
| 97 | end |
| 98 | if ne sc_gate true 976 0 true until 2 |
| 99 | ret 45 |
| 100 | end |
| 101 | if ne sc_gate false 976 964 true until 2 |
| 102 | ret 46 |
| 103 | end |
| 104 | start = monons |
| 105 | if lt start 0 |
| 106 | ret 39 |
| 107 | end |
| 108 | if not sc_root add start 10000000000 |
| 109 | ret 48 |
| 110 | end |
| 111 | if ne sc_gate true 976 964 true 0 2 |
| 112 | ret 47 |
| 113 | end |
| 114 | r = write 1 sc_pass 0 len sc_pass |
| 115 | if ne r long len sc_pass |
| 116 | ret 49 |
| 117 | end |
| 118 | ret 0 |
| 119 | end |
| 120 | fn main to int |
| 121 | if eq argcnt 1 |
| 122 | ret sc_test |
| 123 | end |
| 124 | if ne argcnt 6 |
| 125 | ret 90 |
| 126 | end |
| 127 | until = sc_arg 1 |
| 128 | xe = sc_arg 2 |
| 129 | uid = sc_arg 3 |
| 130 | gid = sc_arg 4 |
| 131 | sc_own = sc_arg 5 |
| 132 | if or lt until 0 or lt xe 0 gt xe 1 |
| 133 | ret 90 |
| 134 | end |
| 135 | if or lt uid 0 or lt gid 0 or lt sc_own 0 gt sc_own 1 |
| 136 | ret 90 |
| 137 | end |
| 138 | ret sc_gate eq xe 1 uid gid eq sc_own 1 until |
| 139 | end |