Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/host/README.md # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / host / README.md` 256 lines ยท 15153 bytes Raw Blame History Rendered 1 # Native host operations 2 3 Drake authorized extending Omega before rewriting benchmarks-mv on 2026-10-23, 4 with no outside implementation help. These operations are implemented in 5 `seed/omc/omc.om`. That Omega compiler emits the machine instructions itself. 6 The seed chain builds it and it rebuilds itself to identical bytes. No C/Rust 7 implementation, translator, external model, foreign compiler, assembler or 8 linker implements or builds these additions. 9 10 The existing shell seed loader remains the first bootstrap step, as described 11 in `seed/README.md`. Shell scripts coordinate builds and tests; they do not 12 implement the host operations. Programs call the Linux ARM64 kernel directly, 13 as the original `read`, `write` and `exit` already do. This is Linux-hosted 14 operation, not a native AienOS qualification or a GPU qualification. 15 16 The language contract is [OMEGESE section 10](../../docs/one_layer/OMEGESE.md). 17 18 ## CPU scheduler words (draft) 19 20 `cpuset`, `cpuget`, `cpunow`, `setprio` and `getprio` provide checked Linux CPU 21 affinity and priority without a taskset/nice child wrapper. They are program-only 22 on AArch64 and x86linux, retain kernel permissions and return minus errno. 23 See [the draft contract](../../spec/omegese-cpu-workers.md) and the complete 24 `seed/host/affinity/sched.cases` gate, included in `check.sh`. 25 26 ## Qualification 27 28 From the repository root on Linux ARM64: 29 30 ```sh 31 make -j2 build/omegese/omegese build/omega_emit/omega_emit build/checker2/checker2 32 quiet-build sh seed/host/check.sh 33 ``` 34 35 On a machine without the Spark build coordinator, run the script directly. 36 Missing IR oracles return `NOT_RUN` with status 3 before rebuilding; they cannot 37 produce host qualification. The script rebuilds the seed chain, proves compiler 38 self-reproduction, runs the independent C-reference IR gate, exercises native 39 Omega fixtures, rejects malformed inputs, and compares the reviewed original 40 fixture baseline against the original native parent. The fixture gate itself is 41 `seed/host/gate.om`, compiled by `seed/out/omc`; the remaining shell step only 42 builds and launches it. 43 44 The `devcall` fixture uses image-backed parameter storage and a harmless memfd, 45 not a device descriptor. It requires Linux ENOTTY for 16384-byte, 55888-byte 46 and inclusive `1048576`-byte spans, and trap 3 for `1048577` bytes or a slice past 47 the array. The same host check runs `devcall-mutants.cases` through the Omega 48 conductor and requires attribution of both killed compiler mutants: 49 an off-by-one rejection at the cap and a removed cap check. No GPU is opened. 50 51 Verified on the Spark on 2026-10-23: 52 53 - Native file create/read/write/seek/sync/chmod/close/unlink and errno checks. 54 - Current-directory change, file creation below it and unlink through the 55 native `chdir` word. 56 - Monotonic nanoseconds, realtime nanoseconds and a measured native sleep. 57 - Argument copying, including empty arguments, spaces, UTF-8 bytes, and refusal 58 of short output buffers without modifying them. 59 - Socket exchange between native Omega processes, including local sockets and 60 TCP loopback on a kernel-selected ephemeral port. 61 - Poll timeouts, fork, accept, exec with exact arguments, exec failure, pipes, 62 descriptor duplication, process termination and child reaping. 63 - Directory creation/enumeration/removal, file metadata and no-replace rename. 64 - Current-directory and symbolic-link reads with explicit count conventions, 65 nonzero slice offsets, truncation checks, overlapping buffers and errno checks. 66 - Socket options verified by the changed bind result on an ephemeral UDP 67 loopback port, including readonly option bytes and invalid options. 68 - Forty-one negative controls for bounds, malformed packets, readonly arrays, 69 wrong types, invalid paths and use outside program mode. 70 - The baseline in `original-fixtures.tsv` pins paths and observed parent statuses. 71 Its 62 cases retain identical machine code, refusal status and diagnostics. 72 This is the actual selection at ``ec07d25d``; older prose incorrectly said 70. 73 74 Fixtures run in a unique temporary directory under `build/seed/host/`. The 75 network test connects only to its own local server. Process tests reap their 76 children. No service is installed or changed. `timeout` only bounds test 77 processes; timed operations inside the tests use the emitted native code. 78 79 Offline gate integrity controls (temporary repositories, no services or GPU): 80 81 ```sh 82 nice -n 19 python3 seed/host/test_gate_integrity.py 83 ``` 84 85 They exercise recursive and long secret searches, tracked generated paths, 86 search errors, missing/empty/duplicate corpus obligations, common compiler 87 refusals, and missing IR oracles. The secret gate checks all tracked paths 88 (including build output), plus untracked paths outside root `build/` and `.git/`; 89 its manifest forbids cache reuse across commits. 90 91 ### Packed-list hostile ingress (#671) 92 93 `seed/qualification/security673/` feeds runtime packets, not compile-time 94 constants, to `execprog`. `packet-corpus.om` writes one packet per mode byte; 95 `pkt-consumer.om` reads stdin and passes the bytes, or only the first K bytes 96 when given one decimal argument, to `execprog` unchanged. `check.sh` runs 97 `packets.cases` through the OM-2 conductor: 16 rows prove each committed fixture 98 in `packets/` equals the generator output, 16 rows run the modes (4 valid 99 packets, including the 1024-record and the exact 65536-byte exec limits, and 12 100 malformed ones: count 0, 1025 (bare and with 1025 records) and 65535, truncated, 101 over-declared and 65535-byte records, a trailing byte, an empty first record, 102 zero bytes inside and after the path, and a 65537-byte packet), 28 rows truncate 103 the 27-byte echo packet at every length, and 5 rows run the 1024-record, 104 1025-record, 65537-byte, 65536-byte and echo packets through the x86 decoder 105 (`xhpack`, the consumer composed after `seed/host/execenv/x86-target.om` and run 106 through binfmt qemu-x86_64: emulator evidence). Expected exits come from the 107 format rules in OMEGESE section 10; every malformed packet must trap 3 (exit 108 103) before any exec. 109 110 `packets-mutant.cases` builds three compilers, each without one length check of 111 the decoder (`hpack` in `seed/omc/omc.om`): the packet byte bound, the record 112 count bound, and exact consumption. Each mutant executes the one packet that 113 only its check refuses, so `check.sh` requires three exact `FAIL run exit=0 114 expected=103` verdicts. Removing the record-length-versus-remaining check is 115 not detected by exit status: the zero-byte and exact-consumption checks still 116 trap every over-declared record, so that check only bounds how far the decoder 117 reads. 118 119 ### Bounded networking additions (#788) 120 121 The source adds `peercred` (keyword 220), `pollfds` (221), and `sendmsg` (222). 122 `sockopt` now accepts only the scalar transport allowlist in OMEGESE section 10. 123 The existing `socknew`, `bind`, `listen`, `accept` (`accept4`), `connect`, 124 `read`/`write`, `recv`/`send`, `waitio`, and `fclose` remain the base transport API. 125 No host HTTP or JSON implementation is introduced. 126 127 `tests/netdata.om` exercises Unix peer PID/UID/GID at a nonzero output offset, 128 two-descriptor polling and timeout, private single-iovec `sendmsg`, deliberate 129 short nonblocking sends, closed-peer `EPIPE` without SIGPIPE, descriptor reuse 130 after repeated close, option allowlisting, and slice/record-size refusals. 131 `tests/netpeer.om` creates distinct parent/child endpoints, compares peer PIDs 132 independently, and checks nonzero offsets, untouched surrounding bytes, 133 negative-timeout readiness and nested expression preservation. It exposed an 134 older `getppid` lowering error: syscall 110 is `timer_settime` on Linux ARM64, 135 not `getppid` (173). The old fixture only rejected zero, silently accepting a 136 negative error. The lowering and positive-PID assertion are corrected here. 137 Run the candidate host gate without replacing the committed compiler: 138 139 ```sh 140 nice -n 19 ionice -c3 sh -c 'seed/out/omc < seed/host/gate.om > build/seed/host/gate && chmod +x build/seed/host/gate && build/seed/host/gate /absolute/path/to/candidate-omc' 141 OMC=/absolute/path/to/candidate-omc nice -n 19 ionice -c3 sh seed/host/negative.sh 142 nice -n 19 ionice -c3 python3 seed/host/net-mutant.py 143 nice -n 19 ionice -c3 sh seed/omc/gate18.sh 144 ``` 145 146 This is candidate host evidence, not a reseed, compiler fixpoint, release pin, 147 or hardware qualification. Compiler integration owns the batch reseed. 148 `net-mutant.py` is a verifier-only Python runner. It compiles each original and 149 wrong-word source through the committed seed (or `OMC` override), then requires 150 the real fixture to pass the original and exit 1 for the mutant. Its controls 151 restore the wrong `getppid` syscall and turn an option refusal into success. 152 The host gate's compiler argument (`gate.om` argv[1]) applies to every compilation, 153 including nested device/mapping refusal programs and generated identity fixtures; 154 early candidate-only logs from before that correction contain mixed-compiler evidence. 155 The Linux interface authorities are `asm-generic/unistd.h` (`ppoll` 73, 156 `getsockopt` 209, `sendmsg` 211), `asm-generic/socket.h`, and `linux/tcp.h`. 157 Instruction emission uses the existing Arm ARM forms; `STR` unsigned-offset 158 stores private stack records, with `imm12` scaled by eight for 64-bit cells. 159 Keyword pack verification used WolframLanguageEvaluator: 160 `Table[{s,FromDigits[Reverse[ToCharacterCode[s]],256]},{s,{"peercred","pollfds","sendmsg"}}]` 161 returned `{{"peercred",`7234314147887146352`},{"pollfds",`32480013390212976`},{"sendmsg",`29118836274783603`}}`. 162 163 ### Typed VFIO IRQ and eventfd additions 164 165 The current-main VFIO extension uses `vfioctl`228, `vfiomap`229, 166 `vfiomapw`230, `eventfd`231 and `vfioirq`232. These do not collide with 167 x86efi's scoped `efi`178, `qty`223, `peername`224 or `fma`227. 168 The original extension used driver-pinned base 169 ``397e67040fb74853c6814097fe02ae4e1ebd6f66``; that historical pin is not 170 rewritten. The exact acquisition, invalidation, bounded payload and masking 171 contracts are in [MAPPING.md](MAPPING.md#typed-irq-and-eventfd-extension). 172 These VFIO words are AArch64 program-mode only: function mode refuses them, 173 and no hosted x86 VFIO implementation or arbitrary syscall is added. 174 175 ```sh 176 taskset -c 10-14 nice -n 10 sh seed/omega-from-seed.sh 177 taskset -c 10-14 nice -n 10 sh seed/host/irq.sh 178 taskset -c 10-14 nice -n 10 sh seed/omc/gate18.sh 179 ``` 180 181 `irq.sh` also runs from the normal host gate. It compiles positive cases, 182 ten native compiler refusals, real nonblocking eventfd read/write/poll/close 183 behavior, a GCC UAPI byte-layout differential, fifteen runtime refusals, and 184 wrong-word compiler mutants. A ptrace-only fixture supplies an acquired-kind 185 stand-in while every real IRQ ioctl reaches an ordinary memfd and returns 186 ENOTTY. It also exercises fd numbers above1024 and a full128-slot table without 187 opening or closing a real VFIO resource. The C fixture and Python mutant runner 188 are independent verification tools, never linked into product code. 189 The QEMU tier is user-mode, VFIO-less, and cannot establish physical delivery. 190 Real device interrupt behavior remains NOT_RUN pending an authorized window. 191 192 WolframLanguageEvaluator query 193 `{FromDigits[Reverse[ToCharacterCode["eventfd"]],256],FromDigits[Reverse[ToCharacterCode["vfioirq"]],256],BitOr[524288,2048],20+4*64}` 194 returned `{`28260147925448293`,`31932469534615158`,526336,276}`: 195 the keyword packs, CLOEXEC|NONBLOCK flags, and bounded IRQ record bytes. 196 197 198 ## Connected peer metadata 199 200 `peername fd A off n` (keyword 224) queries the peer of an existing process 201 descriptor. Its types, writable slice validation and negative errno behavior 202 match `sockname`; success returns the full native Linux sockaddr length even 203 when the supplied slice truncates it. Empty slices are permitted at array end. 204 Neither word acquires or connects a socket. `accept` keeps its existing API. 205 Keyword encoding was checked with the mounted WolframLanguageEvaluator: 206 `FromDigits[Reverse[ToCharacterCode["peername"]],256] -> `7308604897285727600``. 207 208 The implementation shares `hbuffer`'s private 32-bit socklen with `sockname`; 209 checked byte-array capacities fit that representation. Linux source authority: 210 [v6.12 asm-generic syscall table](https://github.com/torvalds/linux/blob/v6.12/include/uapi/asm-generic/unistd.h) 211 assigns getpeername 205 and getsockname 204; under `target x86linux` the same 212 word lowers to x86-64 getpeername 52 (getsockname 51) from 213 [v6.17 `syscall_64.tbl`](https://github.com/torvalds/linux/blob/v6.17/arch/x86/entry/syscalls/syscall_64.tbl); 214 [`move_addr_to_user`](https://github.com/torvalds/linux/blob/v6.12/net/socket.c) 215 copies only the bounded prefix, permits zero capacity, and returns full length. 216 The [getpeername manual](https://man7.org/linux/man-pages/man2/getpeername.2.html) 217 defines EBADF, ENOTSOCK and ENOTCONN. Omega preserves raw negative syscall 218 errno, rather than libc's -1/errno convention. 219 220 `tests/peername.om` compares an accepted TCP peer with the independently queried 221 client endpoint on loopback, checks a distinct local endpoint, offset sentinels, 222 short/empty slices, closed descriptors, pipes and unconnected sockets. 223 The host gate also requires bounds traps; negative.sh covers typing, readonly 224 arrays and function mode. net-mutant.py replaces getpeername with getsockname 225 and requires the real fixture to reject that compiler. 226 227 Transport addresses are not user authentication or an original client identity 228 behind a proxy. Consumers must validate length and family, retain descriptor 229 lifetime control, and preserve their existing trusted-proxy boundary. This 230 compiler change neither activates gateway policy nor trusts forwarding headers. 231 232 ## Source authority and limits 233 234 Instruction forms come from the existing hand-audited instruction table in 235 `seed/rung2/table.s2`, which identifies Arm manual sections. Linux interfaces 236 were checked against the installed ARM64 headers: `asm/unistd.h`, 237 `asm-generic/unistd.h`, `asm/fcntl.h`, `asm-generic/fcntl.h`, 238 `asm-generic/stat.h`, `asm-generic/poll.h` and `linux/time.h`. The architecture 239 header overrides generic constants: ARM64 `O_DIRECTORY` is 040000 octal. 240 These are interface references, not imported implementation code. 241 242 The additional keywords 132 through 134 are `cwd`, `readlnk` and `sockopt`. 243 Installed ARM64 `asm/unistd.h` includes the generic definitions for `getcwd` 244 (17), `readlinkat` (78) and `setsockopt` (208). `linux/fcntl.h` supplies 245 `AT_FDCWD`; ARM64 `asm/socket.h` includes the generic `SOL_SOCKET` and 246 `SO_REUSEADDR` definitions. Adding these reserved words changes the compiler 247 digest. The reviewed baseline has 62 original fixtures after the old content 248 filters, not the 70 previously stated here. The new fixed manifest prevents 249 missing files, changed skip boundaries or common compiler refusals from silently 250 shrinking that obligation. New reserved words cannot be used as ordinary identifiers. 251 252 This extension supplies host facilities for the benchmark migration. It does 253 not implement a JSON library, floating-point types, the full benchmark suite, 254 or the sibling runtime's in-process interfaces. Existing numeric, array, 255 register and loop capacities remain in force. The language has no exposed 256 pointers or arbitrary-syscall escape hatch.