interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / build / gate.om

507 lines · 10653 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note seed/build/gate.om: OMEGA-BUILD-COORD, the pure seeded-Omega self-qualification gate for all
3note pure-Omega build, release, and automation coordinators (birth, units, tlsbuild, sparkefi, gpucoord, release).
4note Compiles every coordinator twice with seed/out/omc (proving deterministic bit-identical builds),
5note runs end-to-end positive checks AND planted negative controls for every coordinator.
6note Zero shell, zero Python.
7note Build: cat seed/build/common.om seed/build/gate.om | seed/out/omc > build/om-build-gate
8note Usage: om-build-gate SCRATCH_DIR
9
10text gt_usage "usage: om-build-gate SCRATCH_DIR\n"
11text gt_omc "seed/out/omc"
12text gt_com "seed/build/common.om"
13text gt_s_bir "seed/build/birth.om"
14text gt_s_uni "seed/build/units.om"
15text gt_s_tls "seed/build/tlsbuild.om"
16text gt_s_efi "seed/build/sparkefi.om"
17text gt_s_gpu "seed/build/gpucoord.om"
18text gt_s_rel "seed/build/release.om"
19text gt_s_p0 "seed/build/phase0.om"
20text gt_n_bir "om-birth"
21text gt_n_uni "om-units"
22text gt_n_tls "om-tlsbuild"
23text gt_n_efi "om-sparkefi"
24text gt_n_gpu "om-gpucoord"
25text gt_n_rel "om-release"
26text gt_n_p0 "om-phase0"
27text gt_ok "ok "
28text gt_fail "FAIL "
29text gt_sum1 "OMEGA-BUILD-COORD "
30text gt_pass "PASS"
31text gt_fl "FAIL"
32text gt_sum2 " checks="
33text gt_sum3 " controls="
34text gt_sum4 " caught="
35text gt_sum5 " hardware=NOT_RUN\n"
36text gt_m_det "deterministic-2x "
37text gt_m_bir "birth-verify"
38text gt_m_tls "tlsbuild-fips"
39text gt_m_efi "sparkefi-qemu-pe32"
40text gt_m_gpu1 "gpucoord-spirv-check"
41text gt_m_gpu2 "gpucoord-intel-gate"
42text gt_m_gpu3 "gpucoord-build-spec"
43text gt_m_gpu4 "gpucoord-build-q36"
44text gt_m_rel1 "release-check-locks"
45text gt_m_rel2 "release-check-paths"
46text gt_m_rel3 "release-uxl"
47text gt_m_rel4 "release-package-verify"
48text gt_c_uni "ctrl-units-missing-env-exit3"
49text gt_c_efi "ctrl-sparkefi-qemu-refuses-SPARK.EFI"
50text gt_c_gpu "ctrl-gpucoord-bad-kernel-refused"
51text gt_c_rel1 "ctrl-release-verify-catches-tamper"
52text gt_c_rel2 "ctrl-release-paths-catches-CON.txt"
53text gt_c_rel3 "ctrl-release-locks-catches-bad-lock"
54text gt_f_verify "--verify"
55text gt_f_check "--check"
56text gt_c_locks "check-locks"
57text gt_c_paths "check-paths"
58text gt_c_uxl "uxl"
59text gt_c_pkg "package"
60text gt_c_ver "verify"
61text gt_c_srun "spirv-run"
62text gt_c_schk "spirv-check"
63text gt_c_xe "intel-gate"
64text gt_c_spec "build-spec"
65text gt_c_q36 "build-q36"
66text gt_badk "notakernel"
67text gt_cl "cl"
68text gt_ver "1.0.0-rc1"
69text gt_e_plat_q "PLAT=qemu"
70text gt_tlsp_src "fn main to int\nr = fips_check 0\nret int r\nend\n"
71text gt_b_s1 "/.1"
72text gt_b_s2 "/.2"
73text gt_b_src "/.src.om"
74text gt_d_bir "/birth-w"
75text gt_d_tls "/tls-prog.om"
76text gt_d_tlso "/tls-prog"
77text gt_d_efi "/qemu.efi"
78text gt_d_efibad "/SPARK.EFI"
79text gt_d_spec "/spec-out"
80text gt_d_q36 "/q36-out"
81text gt_d_uxl "/uxl-w"
82text gt_d_pkg "/pkg-out"
83text gt_d_pkgbin "/pkg-out/bin/om-birth"
84text gt_d_badwin "/bad-win"
85text gt_d_con "/bad-win/CON.txt"
86text gt_d_badlk "/bad-locks"
87text gt_d_bl_s "/bad-locks/seed/out"
88text gt_d_bl_p "/bad-locks/physics.lock"
89text gt_bad_hex "not-a-40-hex-commit\n"
90text gt_hi "hi\n"
91
92global gt_scr uchar 4096
93global gt_scrl ulong 1
94global gt_passc ulong 1
95global gt_failc ulong 1
96global gt_ctlc ulong 1
97global gt_caughtc ulong 1
98
99fn gt_sp suf view uchar * to void
100cb_pa_clr
101for i ulong get gt_scrl 0 bound 4096
102cb_pa_ch get gt_scr i
103end
104cb_pa_tx suf
105end
106
107fn gt_spb suf view uchar * to void
108cb_pb_clr
109for i ulong get gt_scrl 0 bound 4096
110cb_pb_ch get gt_scr i
111end
112cb_pb_tx suf
113end
114
115fn gt_bin_pa name view uchar * to void
116cb_pa_clr
117for i ulong get gt_scrl 0 bound 4096
118cb_pa_ch get gt_scr i
119end
120cb_pa_ch 47
121cb_pa_tx name
122end
123
124fn gt_rec_ok name view uchar * to void
125cb_out gt_ok
126cb_out name
127cb_out cb_nl
128put gt_passc 0 add get gt_passc 0 1
129end
130
131fn gt_rec_fail name view uchar * to void
132cb_out gt_fail
133cb_out name
134cb_out cb_nl
135put gt_failc 0 add get gt_failc 0 1
136end
137
138fn gt_rec_ctl ok bool name view uchar * to void
139put gt_ctlc 0 add get gt_ctlc 0 1
140if ok
141cb_out gt_ok
142cb_out name
143cb_out cb_nl
144put gt_caughtc 0 add get gt_caughtc 0 1
145else
146cb_out gt_fail
147cb_out name
148cb_out cb_nl
149put gt_failc 0 add get gt_failc 0 1
150end
151end
152
153note Compile common.om + src twice, check byte identity, install as SCRATCH/name
154fn gt_build_det src view uchar * name view uchar * to bool
155cb_wb_clr
156cb_pa_set gt_com
157if not cb_append_pa_to_wb
158gt_rec_fail name
159ret false
160end
161cb_pa_set src
162if not cb_append_pa_to_wb
163gt_rec_fail name
164ret false
165end
166gt_sp gt_b_src
167if not cb_write_wb_pa 420
168gt_rec_fail name
169ret false
170end
171for i ulong len gt_omc bound 4096
172put cb_pc i get gt_omc i
173end
174gt_spb gt_b_s1
175if ne cb_run_omc len gt_omc 493 -1 0
176gt_rec_fail name
177ret false
178end
179gt_spb gt_b_s2
180if ne cb_run_omc len gt_omc 493 -1 0
181gt_rec_fail name
182ret false
183end
184gt_sp gt_b_s1
185gt_spb gt_b_s2
186if not cb_cmp_pa_pb
187gt_rec_fail name
188ret false
189end
190gt_sp gt_b_s1
191cb_pb_clr
192for i ulong get gt_scrl 0 bound 4096
193cb_pb_ch get gt_scr i
194end
195cb_pb_ch 47
196cb_pb_tx name
197if not cb_copy_pa_to_pb 493
198gt_rec_fail name
199ret false
200end
201cb_out gt_ok
202cb_out gt_m_det
203cb_out name
204cb_out cb_nl
205put gt_passc 0 add get gt_passc 0 1
206ret true
207end
208
209fn gt_run_quiet use_ev bool to ulong
210fo = fopen cb_devnull 0 len cb_devnull 524289 0
211fe = fopen cb_devnull 0 len cb_devnull 524289 0
212ret cb_spawn_fds -1 int fo int fe use_ev
213end
214
215fn main to int
216if ne argcnt 2
217cb_err gt_usage
218ret 2
219end
220if not cb_pa_arg 1
221cb_err gt_usage
222ret 2
223end
224for i ulong get cb_n 3 bound 4096
225put gt_scr i get cb_pa i
226end
227put gt_scrl 0 get cb_n 3
228if not cb_mkdir_p_pa
229ret 2
230end
231
232note 1. Build all 6 coordinators deterministically (2x compile + byte compare)
233if not gt_build_det gt_s_bir gt_n_bir
234ret 1
235end
236if not gt_build_det gt_s_uni gt_n_uni
237ret 1
238end
239if not gt_build_det gt_s_tls gt_n_tls
240ret 1
241end
242if not gt_build_det gt_s_efi gt_n_efi
243ret 1
244end
245if not gt_build_det gt_s_gpu gt_n_gpu
246ret 1
247end
248if not gt_build_det gt_s_rel gt_n_rel
249ret 1
250end
251if not gt_build_det gt_s_p0 gt_n_p0
252ret 1
253end
254
255note 2. Positive check: om-birth --verify (full rung0..omc fixpoint + diaggen + 8 size-record + 4 probes)
256cb_av_clr
257gt_bin_pa gt_n_bir
258cb_av_push_pa
259cb_av_push_tx gt_f_verify
260gt_sp gt_d_bir
261cb_av_push_pa
262if eq gt_run_quiet false 0
263gt_rec_ok gt_m_bir
264else
265gt_rec_fail gt_m_bir
266end
267
268note 3. Positive check: om-tlsbuild builds & FIPS-stamps a real TLS program
269cb_wb_clr
270cb_wb_tx gt_tlsp_src
271gt_sp gt_d_tls
272z0 = cb_write_wb_pa 420
273cb_av_clr
274gt_bin_pa gt_n_tls
275cb_av_push_pa
276cb_av_push_tx gt_omc
277gt_sp gt_d_tls
278cb_av_push_pa
279gt_sp gt_d_tlso
280cb_av_push_pa
281if eq gt_run_quiet false 0
282note also run the FIPS-stamped TLS binary!
283cb_av_clr
284gt_sp gt_d_tlso
285cb_av_push_pa
286if eq gt_run_quiet false 0
287gt_rec_ok gt_m_tls
288else
289gt_rec_fail gt_m_tls
290end
291else
292gt_rec_fail gt_m_tls
293end
294
295note 4. Positive check: om-sparkefi with PLAT=qemu builds & verifies PE32+ image
296cb_av_clr
297gt_bin_pa gt_n_efi
298cb_av_push_pa
299gt_sp gt_d_efi
300cb_av_push_pa
301cb_ev_clr
302cb_pa_set gt_e_plat_q
303cb_ev_push_env_pa
304if eq gt_run_quiet true 0
305gt_rec_ok gt_m_efi
306else
307gt_rec_fail gt_m_efi
308end
309
310note 5. Negative control: om-sparkefi with PLAT=qemu refuses to write SPARK.EFI
311cb_av_clr
312gt_bin_pa gt_n_efi
313cb_av_push_pa
314gt_sp gt_d_efibad
315cb_av_push_pa
316cb_ev_clr
317cb_pa_set gt_e_plat_q
318cb_ev_push_env_pa
319gt_rec_ctl ne gt_run_quiet true 0 gt_c_efi
320
321note 6. Positive checks: om-gpucoord spirv-check, intel-gate, build-spec
322cb_av_clr
323gt_bin_pa gt_n_gpu
324cb_av_push_pa
325cb_av_push_tx gt_c_schk
326if eq gt_run_quiet false 0
327gt_rec_ok gt_m_gpu1
328else
329gt_rec_fail gt_m_gpu1
330end
331
332cb_av_clr
333gt_bin_pa gt_n_gpu
334cb_av_push_pa
335cb_av_push_tx gt_c_xe
336if eq gt_run_quiet false 0
337gt_rec_ok gt_m_gpu2
338else
339gt_rec_fail gt_m_gpu2
340end
341
342cb_av_clr
343gt_bin_pa gt_n_gpu
344cb_av_push_pa
345cb_av_push_tx gt_c_spec
346gt_sp gt_d_spec
347cb_av_push_pa
348if eq gt_run_quiet false 0
349gt_rec_ok gt_m_gpu3
350else
351gt_rec_fail gt_m_gpu3
352end
353
354cb_av_clr
355gt_bin_pa gt_n_gpu
356cb_av_push_pa
357cb_av_push_tx gt_c_q36
358gt_sp gt_d_q36
359cb_av_push_pa
360if eq gt_run_quiet false 0
361gt_rec_ok gt_m_gpu4
362else
363gt_rec_fail gt_m_gpu4
364end
365
366note 7. Negative control: om-gpucoord refuses bad kernel
367cb_av_clr
368gt_bin_pa gt_n_gpu
369cb_av_push_pa
370cb_av_push_tx gt_c_srun
371cb_av_push_tx gt_badk
372cb_av_push_tx gt_cl
373gt_rec_ctl ne gt_run_quiet false 0 gt_c_gpu
374
375note 8. Negative control: om-units without OMEGA_OMC/OMEGA_BRIDGE exits 3 (NOT_RUN)
376cb_av_clr
377gt_bin_pa gt_n_uni
378cb_av_push_pa
379cb_av_push_tx gt_f_check
380gt_rec_ctl eq gt_run_quiet false 3 gt_c_uni
381
382note 9. Positive checks: om-release check-locks, check-paths, uxl, package + verify
383cb_av_clr
384gt_bin_pa gt_n_rel
385cb_av_push_pa
386cb_av_push_tx gt_c_locks
387if eq gt_run_quiet false 0
388gt_rec_ok gt_m_rel1
389else
390gt_rec_fail gt_m_rel1
391end
392
393cb_av_clr
394gt_bin_pa gt_n_rel
395cb_av_push_pa
396cb_av_push_tx gt_c_paths
397if eq gt_run_quiet false 0
398gt_rec_ok gt_m_rel2
399else
400gt_rec_fail gt_m_rel2
401end
402
403cb_av_clr
404gt_bin_pa gt_n_rel
405cb_av_push_pa
406cb_av_push_tx gt_c_uxl
407gt_sp gt_d_uxl
408cb_av_push_pa
409if eq gt_run_quiet false 0
410gt_rec_ok gt_m_rel3
411else
412gt_rec_fail gt_m_rel3
413end
414
415cb_av_clr
416gt_bin_pa gt_n_rel
417cb_av_push_pa
418cb_av_push_tx gt_c_pkg
419gt_sp gt_d_pkg
420cb_av_push_pa
421cb_av_push_tx gt_ver
422pkg_rc = gt_run_quiet false
423ver_rc = ulong 1
424if eq pkg_rc 0
425cb_av_clr
426gt_bin_pa gt_n_rel
427cb_av_push_pa
428cb_av_push_tx gt_c_ver
429gt_sp gt_d_pkg
430cb_av_push_pa
431ver_rc = gt_run_quiet false
432end
433if and eq pkg_rc 0 eq ver_rc 0
434gt_rec_ok gt_m_rel4
435else
436gt_rec_fail gt_m_rel4
437end
438
439note 10. Negative control: flip 1 byte in packaged bin/om-birth -> verify MUST fail!
440gt_sp gt_d_pkgbin
441if cb_read_pa
442bn = get cb_n 0
443if gt bn 0
444put cb_rb sub bn 1 xor get cb_rb sub bn 1 1
445z1 = cb_write_rb_pa 493
446end
447end
448cb_av_clr
449gt_bin_pa gt_n_rel
450cb_av_push_pa
451cb_av_push_tx gt_c_ver
452gt_sp gt_d_pkg
453cb_av_push_pa
454gt_rec_ctl ne gt_run_quiet false 0 gt_c_rel1
455
456note 11. Negative control: Windows reserved filename CON.txt -> check-paths MUST fail!
457gt_sp gt_d_badwin
458z2 = cb_mkdir_p_pa
459cb_wb_clr
460cb_wb_tx gt_hi
461gt_sp gt_d_con
462z3 = cb_write_wb_pa 420
463cb_av_clr
464gt_bin_pa gt_n_rel
465cb_av_push_pa
466cb_av_push_tx gt_c_paths
467gt_sp gt_d_badwin
468cb_av_push_pa
469gt_rec_ctl ne gt_run_quiet false 0 gt_c_rel2
470
471note 12. Negative control: malformed physics.lock -> check-locks MUST fail!
472gt_sp gt_d_bl_s
473z4 = cb_mkdir_p_pa
474cb_wb_clr
475cb_wb_tx gt_bad_hex
476gt_sp gt_d_bl_p
477z5 = cb_write_wb_pa 420
478cb_av_clr
479gt_bin_pa gt_n_rel
480cb_av_push_pa
481cb_av_push_tx gt_c_locks
482gt_sp gt_d_badlk
483cb_av_push_pa
484gt_rec_ctl ne gt_run_quiet false 0 gt_c_rel3
485
486note Summary
487cb_out gt_sum1
488if eq get gt_failc 0 0
489cb_out gt_pass
490else
491cb_out gt_fl
492end
493cb_out gt_sum2
494cb_wnum 1 get gt_passc 0
495cb_out gt_sum3
496cb_wnum 1 get gt_ctlc 0
497cb_out gt_sum4
498cb_wnum 1 get gt_caughtc 0
499cb_out gt_sum5
500if ne get gt_failc 0 0
501ret 1
502end
503if ne get gt_ctlc 0 get gt_caughtc 0
504ret 1
505end
506ret 0
507end