The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(installer): reject POSIX marker PIDs that narrow to process groups
Teknium3126c6eb34ff
diff --git a/apps/bootstrap-installer/src-tauri/src/marker.rs b/apps/bootstrap-installer/src-tauri/src/marker.rsindex 51cdd5e1444..4025cac820e 100644--- a/apps/bootstrap-installer/src-tauri/src/marker.rs+++ b/apps/bootstrap-installer/src-tauri/src/marker.rs@@ -806,9 +806,12 @@ fn pid_is_alive(pid: u32) -> bool {#[cfg(not(windows))]fn pid_is_alive(pid: u32) -> bool {- // pid 0 is the caller's process GROUP, not a process: kill(0, 0) always- // succeeds, so a marker corrupted to "0" would read as alive forever.- if pid == 0 {+ // Unsigned marker PIDs must remain positive pid_t values: zero/negative+ // kill operands probe process groups (and -1 probes all processes).+ let Ok(pid) = libc::pid_t::try_from(pid) else {+ return false;+ };+ if pid <= 0 {return false;}// signal 0 delivers nothing; it only probes existence/permission.@@ -853,7 +856,7 @@ fn pid_is_alive(pid: u32) -> bool {}}}- let rc = unsafe { libc::kill(pid as libc::pid_t, 0) };+ let rc = unsafe { libc::kill(pid, 0) };if rc == 0 {return true;}diff --git a/apps/bootstrap-installer/src-tauri/src/marker_tests.rs b/apps/bootstrap-installer/src-tauri/src/marker_tests.rsindex d4ae1515f32..52b6753db0a 100644--- a/apps/bootstrap-installer/src-tauri/src/marker_tests.rs+++ b/apps/bootstrap-installer/src-tauri/src/marker_tests.rs@@ -458,6 +458,14 @@ fn pid_is_alive_false_for_unusable_pid() {assert!(!pid_is_alive(2147483647));}+#[cfg(unix)]+#[test]+fn pid_is_alive_never_interprets_unsigned_pids_as_groups() {+ assert!(pid_is_alive(std::process::id()));+ assert!(!pid_is_alive(u32::MAX)); // narrowing to pid_t would probe all processes+ assert!(!pid_is_alive(u32::MAX - std::process::id() + 1));+}+#[test]fn pid_is_alive_false_for_pid_zero() {// pid 0 means the caller's process GROUP to kill(2), so kill(0, 0)