Skip to content

Commit af8182f

Browse files
authored
perf(identity): bound per-connect procfs work in binary identity resolution (#5213)
Cut the procfs and hashing work openshell-binary-identity pays for every external connect, all of it synchronous on the sandbox broker thread while the workload's connect(2) stays blocked: - Cap /proc/<pid>/cmdline reads at 128 KiB so a long command line can no longer grow per-connect work without bound. Reading one byte past the cap keeps the truncation predicate exact, and the truncated tail drops its last argument so no partial fragment reaches cmdline_paths. - Deduplicate the collected cmdline paths with a hash set instead of a quadratic Vec scan, preserving the insertion order consumers compare. - Evict one digest-cache entry at capacity instead of clearing the whole cache, so a capacity crossing no longer forces a full-file rehash of every live executable. - Read /proc/<pid>/status once per ancestry hop instead of twice, so the NSpid check and the parent PID come from one kernel generation. - Hash executables with a 64 KiB buffer instead of 8 KiB; a same-run release-mode comparison over a page-cached 100 MiB file measures about 1.28x throughput (68.9 ms vs 88.2 ms per hash). Digests, fail-closed Option contracts, and cmdline_paths for untruncated command lines are unchanged; streaming digests stay byte-identical, pinned by an equivalence test against the one-shot facade hash. Closes #5182 Signed-off-by: Emilien Macchi <[email protected]>
1 parent cb836ea commit af8182f

1 file changed

Lines changed: 361 additions & 46 deletions

File tree

  • crates/openshell-binary-identity/src

0 commit comments

Comments
 (0)