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 / qualification / security673 / gate669.om

770 lines · 15964 bytes Raw Blame History
1note Native issue669 qualification coordinator. Run from repository root; scratch must not exist.
2note All child exits are observed; signal, timeout, failed build, malformed oracle output fail closed.
3note GNU objdump is an independent decoder. Hashes identify artifacts and do not prove correctness.
4text bd "build"
5text scratch "build/security673-native"
6text prefix "build/security673-native/"
7text names "seed/omc/omc.om\nseed/qualification/security673/branch-corpus.om\nseed/qualification/security673/branch-mutate.om\nseed/qualification/security673/branch-check.om\n/usr/bin/objdump\n-D\n-b\nbinary\n-m\naarch64\n0\n1\n/dev/null\nseed/rung4/om4.bin\nseed/qualification/security673/array-fill.om\nseed/qualification/security673/oracle-corpus.om\nseed/qualification/security673/gate-child.om\nseed/qualification/security673/hostile-corpus.om\n3\nseed/qualification/security673/branch-forms.om\nseed/qualification/security673/packet-corpus.om\nseed/qualification/security673/pkt-consumer.om\nseed/qualification/security673/renames-corpus.om\nseed/qualification/security673/renames-consumer.om\nseed/qualification/security673/path-consumer.om\nseed/authority/action-gate.om\nseed/authority/delegate-gate.om\nseed/authority/reuse-gate.om\nseed/authority/store-gate.om\nseed/authority/dispatch-gate.om\nseed/trace/sha256-gate.om\nseed/authority/lock-gate.om\n7\nseed/authority/dispatch-order-gate.om\nseed/authority/store-exact-gate.om\nseed/authority/store-cleanup-gate.om\n"
8text input " < "
9text output " > "
10text errors " 2> "
11text cwdmsg " cwd="
12text nl "\n"
13text statusm "exit="
14text expect " expected="
15text signalm "INVALID child wait low-byte="
16text timeoutm "INVALID child deadline exceeded; sent SIGKILL; wait low-byte="
17text elapsedm "elapsed_ns="
18text ingress "GATE671 SOURCE PASS bounded synthetic source families only\n"
19text numred "NEGATIVE CONTROL: compiled numeric-limit bypass admits21 digits; this violates the20-digit profile. Fixed compiler refuses6.\n"
20text passed "GATE669 PASS bounded Linux AArch64 execution and independent decoding only\n"
21text failed "GATE669 FAIL; retain all scratch files and command output\n"
22global pathbuf uchar 4096
23global plen ulong 1
24global serial ulong 1
25global workdir ulong 1
26global argv uchar 4096
27global argc ulong 1
28global apos ulong 1
29global statbuf uchar 4
30global buf uchar 4096
31global other uchar 4096
32global digits uchar 32
33fn stop to void
34r = write 2 failed 0 len failed
35exit 99
36end
37fn decimal v ulong to ulong
38x = v
39n = ulong 0
40while ge x 10
41put digits n uchar add 48 rem x 10
42x = div x 10
43n = add n 1
44end
45put digits n uchar add 48 x
46ret add n 1
47end
48fn num v ulong to void
49n = decimal v
50for i ulong n
51r = write 1 digits sub sub n i 1 1
52if ne r 1
53stop
54end
55end
56end
57fn setpath id ulong to void
58if ge id 1000
59for i ulong len prefix
60put pathbuf i get prefix i
61end
62n = decimal id
63for i ulong n
64put pathbuf add len prefix i get digits sub sub n i 1
65end
66put plen 0 add len prefix n
67ret
68end
69index = ulong 1
70p = ulong 0
71for i ulong len names
72b = get names i
73if eq b 10
74if eq index id
75put plen 0 p
76ret
77end
78index = add index 1
79else
80if eq index id
81put pathbuf p b
82p = add p 1
83end
84end
85end
86stop
87end
88fn showpath id ulong to void
89setpath id
90r = write 1 pathbuf 0 get plen 0
91if ne r long get plen 0
92stop
93end
94end
95fn openfile id ulong flags int to int
96setpath id
97r = fopen pathbuf 0 get plen 0 flags 384
98if lt r 0
99stop
100end
101ret int r
102end
103fn fresh to ulong
104n = add get serial 0 1
105if ge n 400000
106stop
107end
108put serial 0 n
109ret add 1000 n
110end
111fn packarg to void
112p = get apos 0
113n = get plen 0
114if gt add add p n 2 len argv
115stop
116end
117put argv p uchar and n 255
118put argv add p 1 uchar shr n 8
119p = add p 2
120for i ulong n
121put argv add p i get pathbuf i
122end
123put apos 0 add p n
124put argc 0 add get argc 0 1
125end
126fn arg id ulong to void
127setpath id
128packarg
129end
130note Shift the relative path right by base+1 (from its end), then prefix the cwd and '/'.
131fn absjoin base ulong size ulong to void
132for i ulong get plen 0
133at = sub sub get plen 0 i 1
134put pathbuf add add base 1 at get pathbuf at
135end
136for i ulong base
137put pathbuf i get other i
138end
139put pathbuf base 47
140put plen 0 size
141end
142note Isolated children use the absolute executable path captured before chdir.
143fn abscmd exe ulong to void
144setpath exe
145n = cwd other 0 len other
146if or le n 1 gt n long len other
147stop
148end
149base = sub ulong n 1
150if or ne get other 0 47 ne get other base 0
151stop
152end
153size = add add base 1 get plen 0
154if gt size len pathbuf
155stop
156end
157absjoin base size
158put argc 0 0
159put apos 0 2
160packarg
161r = write 1 pathbuf 0 size
162if ne r long size
163stop
164end
165end
166fn command exe ulong to void
167put argc 0 0
168put apos 0 2
169arg exe
170showpath exe
171end
172fn argument id ulong to void
173put digits 0 32
174r = write 1 digits 0 1
175showpath id
176arg id
177end
178fn close fd int to void
179if ne fclose fd 0
180stop
181end
182end
183fn redirect source int dest int to void
184if ne source dest
185if ne dupfd source dest 0 long dest
186stop
187end
188end
189end
190fn reap pid int to ulong
191start = monons
192if lt start 0
193stop
194end
195while true
196r = waitpid pid statbuf 0 len statbuf 1
197if eq r long pid
198r = write 1 elapsedm 0 len elapsedm
199num ulong sub monons start
200r = write 1 nl 0 1
201if ne get statbuf 0 0
202r = write 1 signalm 0 len signalm
203num ulong get statbuf 0
204r = write 1 nl 0 1
205stop
206end
207ret ulong get statbuf 1
208end
209if lt r 0
210stop
211end
212now = monons
213if or lt now start gt sub now start 30000000000
214r = killpid pid 9
215r = waitpid pid statbuf 0 len statbuf 0
216r = write 1 timeoutm 0 len timeoutm
217num ulong get statbuf 0
218r = write 1 nl 0 1
219stop
220end
221if ne sleepns 1000000 0
222stop
223end
224end
225exit 99
226end
227fn run source ulong wanted ulong to ulong
228outid = fresh
229errid = add outid 500000
230r = write 1 input 0 len input
231showpath source
232r = write 1 output 0 len output
233showpath outid
234r = write 1 errors 0 len errors
235showpath errid
236if ne get workdir 0 0
237r = write 1 cwdmsg 0 len cwdmsg
238showpath get workdir 0
239end
240r = write 1 nl 0 1
241rd = openfile source 524288
242wr = openfile outid 524481
243er = openfile errid 524481
244put argv 0 uchar get argc 0
245put argv 1 uchar shr get argc 0 8
246pid = fork
247if lt pid 0
248stop
249end
250if eq pid 0
251redirect rd 0
252redirect wr 1
253redirect er 2
254if ne get workdir 0 0
255setpath get workdir 0
256if ne chdir pathbuf 0 get plen 0 0
257exit 97
258end
259end
260r = execprog argv 0 get apos 0
261exit 98
262end
263close rd
264close wr
265close er
266actual = reap int pid
267r = write 1 statusm 0 len statusm
268num actual
269r = write 1 expect 0 len expect
270num wanted
271r = write 1 nl 0 1
272if ne actual wanted
273stop
274end
275ret outid
276end
277fn enable id ulong to void
278fd = openfile id 524288
279r = read fd buf 0 4
280if ne r 4
281stop
282end
283if or ne get buf 0 127 ne get buf 1 69
284stop
285end
286if or ne get buf 2 76 ne get buf 3 70
287stop
288end
289if ne fchmod fd 448 0
290stop
291end
292close fd
293end
294fn empty id ulong to void
295fd = openfile id 524288
296r = read fd buf 0 1
297close fd
298if ne r 0
299stop
300end
301end
302fn compile cc ulong src ulong wanted ulong to ulong
303command cc
304outid = run src wanted
305if eq wanted 0
306enable outid
307else
308empty outid
309end
310ret outid
311end
312fn equal a ulong b ulong to void
313fa = openfile a 524288
314fb = openfile b 524288
315while true
316ra = read fa buf 0 len buf
317rb = read fb other 0 len other
318if or lt ra 0 ne ra rb
319stop
320end
321if eq ra 0
322close fa
323close fb
324ret
325end
326for i ulong ulong ra
327if ne get buf i get other i
328stop
329end
330end
331end
332end
333fn params mode uchar count ulong size ulong to ulong
334id = fresh
335fd = openfile id 524481
336put buf 0 mode
337for i ulong 4
338put buf add i 1 uchar and shr count mul i 8 255
339end
340if ne write fd buf 0 size long size
341stop
342end
343close fd
344ret id
345end
346fn decode checker ulong elf ulong wanted ulong to void
347command 5
348argument 6
349argument 7
350argument 8
351argument 9
352argument 10
353argument elf
354decoded = run 13 0
355command checker
356result = run decoded wanted
357end
358fn fixture gen ulong mode uchar count ulong to ulong
359p = params mode count 5
360command gen
361ret run p 0
362end
363fn positive cc ulong gen ulong checker ulong count ulong to void
364src = fixture gen 0 count
365elf = compile cc src 0
366decode checker elf 0
367command elf
368outid = run 13 0
369empty outid
370end
371fn negative cc ulong gen ulong mode uchar count ulong to void
372src = fixture gen mode count
373elf = compile cc src 24
374end
375note trapfar: corpus mode3 (div x 0, then N one-word lines). Through omc f4fa7951 the trap branch's stub sat at
376note the function's end, past imm19, and N = 300000 was error 24; since 2026-11-11 omc places waiting trap stubs
377note in an island behind a B (OMEGESE 9.6), so it compiles and runs to trap 2 (exit 102, no output): the division
378note check's CBZ reaches the code-2 stub the island placed 512 KiB in. (branch-check reads b.ne forms only.)
379fn trapfar cc ulong gen ulong checker ulong count ulong to void
380src = fixture gen 3 count
381elf = compile cc src 0
382command elf
383outid = run 13 102
384empty outid
385end
386note backward: corpus mode4 (a while whose `continue` is a B.AL back to the loop head, N+11 words from it)
387note compiled, decoded with branch-check 1 (first b.al must hit mov x4, 12345) and run (exit 0, no output).
388fn backward cc ulong gen ulong checker ulong count ulong to void
389src = fixture gen 4 count
390elf = compile cc src 0
391command 5
392argument 6
393argument 7
394argument 8
395argument 9
396argument 10
397argument elf
398decoded = run 13 0
399command checker
400argument 12
401result = run decoded 0
402command elf
403outid = run 13 0
404empty outid
405end
406note backred: N = 262134 puts the continue 2^18 + 1 words back. The correct compiler refuses it with 24
407note (the head's loop-bound B.cs, N+16 words forward, is refused first); the range-free compiler (mode7)
408note accepts it, and its continue decodes to the wrong target (61). That output is never executed.
409fn backred cc ulong gen ulong mut ulong checker ulong to void
410command mut
411argument 33
412bare = run 1 0
413badcc = compile cc bare 0
414sample = fixture gen 4 262134
415elf = compile badcc sample 0
416command 5
417argument 6
418argument 7
419argument 8
420argument 9
421argument 10
422argument elf
423decoded = run 13 0
424command checker
425argument 12
426result = run decoded 61
427refused = compile cc sample 24
428end
429note boundaries: the real bdisp through probe cases 0..7 (imm19 and imm26 extremes, accepted with the exact
430note field), 8..15 (one word past each limit, misaligned target or origin: error 24), 16 (a word at 8 MiB,
431note the ceiling through omc f4fa7951, accepted since the output grows in omc's arena) and 17 (the first word at
432note the AArch64 output ceiling of 128 MiB: error 14, the invariant that keeps every B/BL inside imm26). Then the range-free mutant (mode7 then mode0) must answer 81 exactly
433note on the four out-of-range cases: a removed range check is caught by name, alignment cases stay 24.
434fn want669 i ulong to ulong
435if and ge i 8 lt i 16
436ret 24
437end
438if eq i 17
439ret 14
440end
441ret 0
442end
443fn boundaries cc ulong mut ulong to void
444command mut
445argument 11
446src = run 1 0
447probe = compile cc src 0
448for i ulong 18
449p = params uchar i 0 1
450command probe
451result = run p want669 i
452end
453end
454fn rangefree cc ulong mut ulong to void
455command mut
456argument 33
457bare = run 1 0
458command mut
459argument 11
460fsrc = run bare 0
461fprobe = compile cc fsrc 0
462for i ulong 18
463p = params uchar i 0 1
464want = want669 i
465if or or eq i 8 eq i 9 or eq i 12 eq i 13
466want = ulong 81
467end
468command fprobe
469result = run p want
470end
471end
472fn mutant cc ulong gen ulong mut ulong checker ulong to void
473command mut
474argument 12
475src = run 1 0
476badcc = compile cc src 0
477sample = fixture gen 0 262144
478elf = compile badcc sample 0
479decode checker elf 61
480refused = compile cc sample 24
481end
482fn oracle cc ulong checker ulong to void
483gen = compile cc 16 0
484for i ulong 7
485p = params uchar i 0 1
486command gen
487sample = run p 0
488command checker
489wanted = ulong 62
490if eq i 0
491wanted = ulong 0
492end
493if eq i 5
494wanted = ulong 61
495end
496result = run sample wanted
497end
498end
499fn control cc ulong to void
500if ne argread 1 buf 0 1 1
501stop
502end
503m = get buf 0
504if or lt m 48 gt m 50
505stop
506end
507p = params sub m 48 0 1
508child = compile cc 17 0
509command child
510result = run p 0
511stop
512end
513fn ingresscase cc ulong gen ulong mode uchar count ulong wanted ulong result ulong to void
514src = fixture gen mode count
515elf = compile cc src wanted
516if eq wanted 0
517command elf
518outid = run 13 result
519empty outid
520end
521end
522fn hostile cc ulong to void
523gen = compile cc 18 0
524ingresscase cc gen 0 20 0 0
525ingresscase cc gen 0 21 6 0
526ingresscase cc gen 0 1000001 6 0
527ingresscase cc gen 1 1000 0 0
528ingresscase cc gen 1 1021 0 1
529ingresscase cc gen 1 1022 0 0
530ingresscase cc gen 1 1023 14 0
531ingresscase cc gen 2 512 0 0
532ingresscase cc gen 2 513 14 0
533ingresscase cc gen 3 1000001 0 0
534ingresscase cc gen 4 4095 0 0
535ingresscase cc gen 4 4096 14 0
536ingresscase cc gen 5 0 16 0
537ingresscase cc gen 6 0 23 0
538ingresscase cc gen 7 0 22 0
539ingresscase cc gen 8 0 3 0
540ingresscase cc gen 9 1000001 0 0
541ingresscase cc gen 10 8388608 14 0
542ingresscase cc gen 11 1000001 0 0
543ingresscase cc gen 12 1000001 0 15
544ingresscase cc gen 13 70 0 3
545ingresscase cc gen 13 1000001 0 3
546mut = compile cc 3 0
547command mut
548argument 19
549changed = run 1 0
550badcc = compile cc changed 0
551sample = fixture gen 0 21
552badelf = compile badcc sample 0
553refused = compile cc sample 6
554r = write 1 numred 0 len numred
555if ne r long len numred
556stop
557end
558r = write 1 ingress 0 len ingress
559if ne r long len ingress
560stop
561end
562end
563fn formwant m ulong to ulong
564if eq m 0
565ret 11
566end
567if eq m 1
568ret 12
569end
570if eq m 2
571ret 11
572end
573if eq m 3
574ret 11
575end
576if eq m 4
577ret 11
578end
579if eq m 5
580ret 11
581end
582if eq m 6
583ret 11
584end
585if eq m 7
586ret 12
587end
588if eq m 8
589ret 12
590end
591if eq m 9
592ret 3
593end
594if eq m 10
595ret 3
596end
597if eq m 11
598ret 21
599end
600if eq m 12
601ret 30
602end
603if eq m 13
604ret 107
605end
606if eq m 14
607ret 102
608end
609ret 90
610end
611fn forms cc ulong to void
612gen = compile cc 20 0
613for m ulong 15
614p = params uchar m 0 1
615command gen
616src = run p 0
617elf = compile cc src 0
618command elf
619outid = run 13 formwant m
620empty outid
621end
622end
623fn packetwant m ulong to ulong
624if eq m 0
625ret 0
626end
627if eq m 8
628ret 0
629end
630ret 103
631end
632fn packets cc ulong to void
633gen = compile cc 21 0
634cons = compile cc 22 0
635for m ulong 9
636p = params uchar m 0 1
637command gen
638src = run p 0
639command cons
640outid = run src packetwant m
641empty outid
642end
643end
644fn renameswant m ulong to ulong
645if eq m 0
646ret 0
647end
648ret 103
649end
650fn renamescc cc ulong to void
651gen = compile cc 23 0
652cons = compile cc 24 0
653for m ulong 7
654p = params uchar m 0 1
655command gen
656src = run p 0
657command cons
658outid = run src renameswant m
659empty outid
660end
661end
662fn pathwant m ulong to ulong
663if or or eq m 1 eq m 2 eq m 5
664ret 103
665end
666ret 0
667end
668fn pathcc cc ulong to void
669cons = compile cc 25 0
670for m ulong 7
671p = params uchar m 0 1
672command cons
673argument 1
674outid = run p pathwant m
675empty outid
676end
677end
678fn authone cc ulong id ulong to void
679elf = compile cc id 0
680command elf
681outid = run 13 0
682end
683note Only these three regressions get fresh child cwd; parent stays at repository root.
684fn authiso cc ulong id ulong to void
685elf = compile cc id 0
686dir = fresh
687setpath dir
688if ne makedir pathbuf 0 get plen 0 448 0
689stop
690end
691abscmd elf
692put workdir 0 dir
693outid = run 13 0
694put workdir 0 0
695end
696fn authority cc ulong to void
697authone cc 26
698authone cc 27
699authone cc 28
700authone cc 29
701authone cc 30
702authone cc 31
703authone cc 32
704authiso cc 34
705authiso cc 35
706authiso cc 36
707end
708fn main to int
709if or lt argcnt 1 gt argcnt 2
710ret 90
711end
712mk = makedir bd 0 len bd 448
713if or eq mk 0 eq mk -17
714else
715ret 91
716end
717if ne makedir scratch 0 len scratch 448 0
718ret 91
719end
720cc1 = compile 14 1 0
721cc2 = compile cc1 1 0
722equal cc1 cc2
723if eq argcnt 2
724if ne argread 1 buf 0 1 1
725stop
726end
727if eq get buf 0 51
728hostile cc2
729ret 0
730end
731control cc2
732ret 99
733end
734gen = compile cc2 2 0
735mut = compile cc2 3 0
736checker = compile cc2 4 0
737boundaries cc2 mut
738rangefree cc2 mut
739array = compile cc2 15 0
740command array
741result = run 13 0
742oracle cc2 checker
743forms cc2
744packets cc2
745renamescc cc2
746pathcc cc2
747authority cc2
748positive cc2 gen checker 16
749positive cc2 gen checker 262142
750negative cc2 gen 0 262143
751negative cc2 gen 0 524287
752negative cc2 gen 1 300000
753negative cc2 gen 2 300000
754trapfar cc2 gen checker 300000
755backward cc2 gen checker 3
756backward cc2 gen checker 16
757backward cc2 gen checker 262131
758negative cc2 gen 4 262132
759negative cc2 gen 4 262133
760negative cc2 gen 4 262134
761backred cc2 gen mut checker
762mutant cc2 gen mut checker
763command checker
764result = run 13 62
765r = write 1 passed 0 len passed
766if ne r long len passed
767ret 99
768end
769ret 0
770end