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 / game / roundtrip.om

105 lines · 1740 bytes Raw Blame History
1note Fixed two-child lifecycle measurement using gate669 fork/exec/wait pattern.
2note Not a general runner. Existing compiled solver/checker required; no model code here.
3text solver "build/security760-v3/solve0"
4text checker "build/security760-v3/check0"
5text spool "build/security760-v3/roundtrip.bin"
6text nullpath "/dev/null"
7global argv uchar 256
8global status uchar 4
9fn command c uint to ulong
10put argv 0 1
11put argv 1 0
12n = len solver
13if eq c 1
14n = len checker
15end
16put argv 2 uchar n
17put argv 3 0
18for i ulong n
19if eq c 0
20put argv add i 4 get solver i
21else
22put argv add i 4 get checker i
23end
24end
25ret add n 4
26end
27fn redir fd int dst int to void
28if ne fd dst
29if ne dupfd fd dst 0 long dst
30exit 90
31end
32end
33end
34fn reap pid long to void
35start = monons
36while true bound 60000
37r = waitpid int pid status 0 len status 1
38if eq r pid
39if or ne get status 0 0 ne get status 1 0
40exit 90
41end
42ret
43end
44if or lt r 0 gt sub monons start 30000000000
45r = killpid int pid 9
46r = waitpid int pid status 0 len status 0
47exit 90
48end
49if ne sleepns 1000000 0
50exit 90
51end
52end
53exit 90
54end
55fn child c uint fd int nullfd int to void
56n = command c
57pid = fork
58if lt pid 0
59exit 90
60end
61if eq pid 0
62redir nullfd 2
63if eq c 0
64redir nullfd 0
65redir fd 1
66else
67redir fd 0
68redir nullfd 1
69end
70r = execprog argv 0 n
71exit 90
72end
73reap pid
74end
75fn main to int
76fd = fopen spool 0 len spool 194 384
77if lt fd 0
78ret 90
79end
80nullfd = fopen nullpath 0 len nullpath 2 0
81if lt nullfd 0
82ret 90
83end
84for i ulong 101
85start = monons
86if ne fseek int fd 0 0 0
87ret 90
88end
89child 0 int fd int nullfd
90if ne fseek int fd 0 0 0
91ret 90
92end
93child 1 int fd int nullfd
94put samples i ulong sub monons start
95end
96percentiles
97if ne fclose int fd 0
98ret 90
99end
100if ne fclose int nullfd 0
101ret 90
102end
103label 8
104ret 0
105end