Commit Graph
9 Commits
Author SHA1 Message Date
Anton Novoselov 29d01fc8e5 fix: prevent stack overflow from process tree cycles in build_proc (#7706)
The `build_proc` function in procinfo recursively walks the process
tree to build child process information. If a cycle exists in the
parent PID chain (which can happen on Windows in particular due to PID
reuse or race conditions during process snapshot enumeration),
the recursion never terminates and overflows the stack.

Add a `visited` HashSet to track already-visited PIDs and skip them,
preventing infinite recursion. Applied to all three platforms (Windows,
Linux, macOS)

Fixes #7705
Related: #6671
2026-06-07 08:22:04 +01:00
Mikayla Maki 32771eecc6 Rearranged order of trimming and parsing 2022-09-06 20:14:27 -07:00
Mikayla Maki d74cb1b625 Added extra test 2022-09-06 20:14:27 -07:00
Mikayla Maki d7c4898f3d Add tests for sysctl parsing 2022-09-06 20:14:27 -07:00
Mikayla Maki 75a7c38800 Change wording 2022-09-06 20:14:27 -07:00
Mikayla Maki ffae6818ef Fixed small bug in how procinfo reads sysctl KERN_PROCARGS2 2022-09-06 20:14:27 -07:00
Wez Furlong ed958160f3 procinfo: fixup macos build 2021-12-31 21:46:36 -07:00
Wez Furlong 1ad4015f9c procinfo: reorg a bit; enable cwd probing on windows
Likely breaks the mac and windows builds
2021-12-31 21:28:03 -07:00
Wez Furlong 910b111efa move procinfo bits into own crate 2021-12-31 19:31:21 -07:00