nx_livecloexec_gate.nx
buildroot/runtime/nx_livecloexec_gate.nx
about
nx_livecloexec_gate.nx -- does any LIVE process hold a listening socket WITHOUT FD_CLOEXEC?
WHY THIS EXISTS ALONGSIDE nx_cloexec_gate (debt 1785521781). That gate is excellent at what it does:
it calls the SHIPPING nx_http_server_listen and proves the returned fd carries FD_CLOEXEC, with a
control and a reader neg-control. But it measures THE PRIMITIVE, and a primitive is not a fleet:
(a) a LIB fix reaches an organ only on ITS NEXT REBUILD -- a daemon deployed before the fix still
runs the old code, and the gate is GREEN the whole time;
(b) a daemon that binds by some OTHER path (raw sys_socket + bind + listen instead of the shared
helper) is not covered by the primitive at all.
So nx_cloexec_gate GREEN + a wedged port are perfectly consistent, which is exactly what happened
2026-07-31: the gate passed while :18098 was unreachable for every seat.
THIS gate measures the OTHER side: it walks /proc/<pid>/fd, finds sockets, and reads the REAL
FD_CLOEXEC bit out of /proc/<pid>/fdinfo/<fd> (`flags:` octal, 02000000 = O_CLOEXEC). It reports what
is TRUE OF RUNNING PROCESSES RIGHT NOW, not what the library would do if called today.
★ A GREEN PRIMITIVE GATE IS NOT EVIDENCE ABOUT DEPLOYED BINARIES.
⚠ ADVISORY BY DESIGN, exit 0 unless the SCAN ITSELF fails. A non-CLOEXEC socket is not automatically a
defect: most are ACCEPTED connections (short-lived, no port to hostage) and inherited-fd risk applies
to LISTENERS. Distinguishing listener from accepted socket needs /proc/net/tcp inode correlation --
see nx_portdup for that lane. Reporting a count with an honest caveat beats a RED verdict this gate
cannot justify. What it DOES prove non-vacuously: the scan reached real fds and read real flags.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 35 | const LC_MAXPID: i64 = 65536 |
| 36 | const LC_LOG: *u8 = "knowledge/status/livecloexec_gate.log" |
| 37 | const LC_MODE: i64 = 420 |
functions
| 39 | func lc_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 40 | func lc_p(s: *u8) -> i64 { let n: i64 = lc_len(s); sys_write(1, s, n); return 0 } |
| 41 | func lc_wf(fd: i64, s: *u8) -> i64 { let n: i64 = lc_len(s); sys_write(fd, s, n); return 0 } |
| 42 | func lc_pnf(fd: i64, v: i64) -> i64 |
| 53 | func lc_pn(v: i64) -> i64 |
| 65 | func lc_cat(dst: *u8, o0: i64, s: *u8) -> i64 called by 1: main |
| 72 | func lc_catn(dst: *u8, o0: i64, v: i64) -> i64 |
| 86 | func lc_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 97 | func lc_has(buf: *u8, n: i64, needle: *u8) -> i64 |
| 115 | func lc_flags(buf: *u8, n: i64) -> i64 called by 1: main |
| 156 | func lc_load_listeners(path: *u8, buf: *u8, cap: i64, inodes: *i64, n0: i64, maxn: i64) -> i64 |
| 229 | func lc_is_listener(inodes: *i64, n: i64, ino: i64) -> i64 called by 1: main |
| 236 | func lc_link_inode(lnk: *u8, n: i64) -> i64 called by 1: main |
| 260 | func main() -> i64 |