code wiki / _hdl_build / nx_dos_timeout_scan.nx

nx_dos_timeout_scan.nx

buildroot/runtime/_hdl_build/nx_dos_timeout_scan.nx

7357 B145 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_dos_timeout_scan.nx -- FLEET DoS-STARVATION GUARD (seq321). A single-threaded accept-loop daemon that loop-reads to Content-Length can be starved FOREVER by one peer that declares a body it never finishes sending = a one-request DoS (hostile OR merely buggy client). The 2-line cure is sys_set_socket_timeout(cfd,N) right after accept (RCVTIMEO+SNDTIMEO). This guard SUPERVISES the class: it scans the organ tree and flags every DAEMON source that has an accept() call but NO socket-timeout tooth, so the fix (fold-in-on-touch) is a visible standing signal, not a one-time audit. Read-only (never patches). Pattern: nx_dup_source_check. nx_dos_timeout_scan -- self-test the detector, then scan buildroot/runtime/_hdl_build; RED if vulns license_tier: ORIGINAL Sovereign: nx_syscalls. expect_exit: 0 when clean.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_dos_timeout_scan.nx

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

main dw sys_write selftest sys_mkdir wfile sys_openat_wr sys_write ↻ dslen sys_close scan sys_openat_rd sys_mmap sys_getdents64 dirent_type dirent_name ends_nx dslen ↻ name_is_daemon dslen ↻ has_sub dslen ↻ join_path read_file sys_openat_rd ↻ sys_read sys_close ↻ is_vuln has_sub ↻ dw ↻ dirent_reclen sys_close ↻ dw ↻ dwn sys_write ↻ sys_mmap ↻ sys_exit scan ↻ dwn ↻ sys_openat_wr ↻

structs

none

consts

10const K_MAGIC_131072: i64 = 131072
11const K_MAGIC_524288: i64 = 524288
12const K_MAGIC_4096: i64 = 4096
13const K_MAGIC_524287: i64 = 524287

functions

15func dw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: scanselftestmain calls 1: sys_write
16func dwn(v: i64) -> i64
called by 2: selftestmain calls 2: sys_writesys_mmap
22func dslen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
23func ends_nx(nm: *u8) -> i64
called by 1: scan calls 1: dslen
30func has_sub(buf: *u8, n: i64, needle: *u8) -> i64
called by 2: name_is_daemonis_vuln calls 1: dslen
43func name_is_daemon(nm: *u8) -> i64
called by 1: scan calls 2: dslenhas_sub
54func join_path(buf: *u8, dir: *u8, name: *u8) -> i64
called by 1: scan
62func read_file(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: scan calls 3: sys_openat_rdsys_readsys_close
72func is_vuln(buf: *u8, n: i64) -> i64
called by 1: scan calls 1: has_sub
82func scan(dir: *u8, verbose: i64) -> i64
115func wfile(path: *u8, s: *u8) -> i64 { let fd: i64=sys_openat_wr(path, 420); if fd>=0 { sys_write(fd, s, dslen(s)); sys_close(fd) } return 0 }
118func selftest() -> i64
called by 1: main calls 5: sys_mkdirwfilescandwdwn
128func main() -> i64