interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / evidence / device-window / DRA-441 / execenv-proposal.md

46 lines · 2475 bytes Raw Blame History Source

Proposal: an execenv whose environment packet is sized from its input

Status: PROPOSED (omega-mv compiler extension). Not implemented.

Why

tools/run-device-window.om must start spark-window, git and the probe programs with the caller's environment and a PATH search. omega-mv execenv A off n B off m (docs/one_layer/OMEGESE.md, keyword id 233) takes the environment as packet B with a count of 1..64 records and at most 4096 bytes. The environment on spark-b87b had 78 entries and 4796 bytes on 2026-11-16, so the driver cannot use execenv and runs every child as /usr/bin/env -i -- <NAME=VALUE ...> CMD ... through execprog.

That makes /usr/bin/env a host dependency of the build-free run path: GNU coreutils 9.4 on spark-b87b, sha256 d38fa7db8452a564868961fd5e9a0aa787095676b0fd6e497b766ac40ec65c8b. It does two things for us: it sets the child's environment from its arguments and it finds CMD on PATH.

The 64-record and 4096-byte limits are fixed sizes, not machine boundaries: the kernel's own boundary is the argument-plus-environment space (a quarter of the stack limit, never below 32 pages) and 131072 bytes per string (MAX_ARG_STRLEN). The execprog packet has the same shape of limit (65536 bytes, 1024 records, u16 record lengths).

Change

  1. execenv: size the environment packet from its input. Keep the packet form (u16 count, u16-length records) but accept any count and total that fit the packet's own fields, check each record (non-empty, no zero byte, one = after a non-empty name), and refuse with the documented negative errno -E2BIG only when the kernel does.
  2. execprog/execenv: add a PATH search form (execpath), following POSIX execvp (search the PATH of packet B, skip entries that fail with ENOENT/ENOTDIR/EACCES, return the last other error).
  3. Records longer than 65535 bytes need a wider length field: a second packet version with u32 lengths, so that an environment entry up to MAX_ARG_STRLEN passes (the driver refuses such an entry today, exit 3).
  4. Gate: seed/host/execenv/ cases for 65, 200 and 2000 records, a 64 KiB total, a 131071-byte record, an empty name, a missing =, a PATH search hit, miss and EACCES, plus an alarm test that reports the largest environment seen in the gate run (no cap; the no-hard-caps rule).

When this lands, tools/run-device-window.om drops /usr/bin/env and builds packet B from envread directly.