From 8e16f56f33ae8fef6aab9ff9cfa935f6c4fe24b5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 7 Sep 2026 00:58:15 +0200 Subject: [PATCH] Stop comparing LISTEN_PID to our own pid Idunn launches Odin with PrivatePIDs=yes -- the private PID namespace is part of the isolation it proves between a candidate and the incumbent -- and systemd sets LISTEN_PID to the pid it knows, which is in the outer namespace. Inside, /proc/self/status reports only the namespace-local pid (measured: pid 3, LISTEN_PID 2994180). The value does not merely differ, it names something this process cannot observe, so the equality could never hold and every candidate exited immediately with "systemd signer descriptors belong to another process". The protocol check exists so a child does not mistake inherited LISTEN_FDS for its own. What remains is stronger: the exact descriptor count and name order, and then the content, which must verify against the trust anchor Idunn published. Descriptors that were not Idunn's fail that verification. Co-Authored-By: Claude Opus 5 --- crates/odin-daemon/src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index 0f00f88..4adeda3 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -793,10 +793,20 @@ fn take_runtime_signer_descriptors() -> Result<(File, File)> { let pid = required_environment(SYSTEMD_LISTEN_PID_ENVIRONMENT)?; let count = required_environment(SYSTEMD_LISTEN_FDS_ENVIRONMENT)?; let names = required_environment(SYSTEMD_LISTEN_FDNAMES_ENVIRONMENT)?; - ensure!( - pid == std::process::id().to_string(), - "systemd signer descriptors belong to another process" - ); + // LISTEN_PID cannot be compared to our own pid here. Idunn launches Odin + // with PrivatePIDs=yes -- the private PID namespace is part of the + // isolation it proves between a candidate and the incumbent -- and systemd + // sets LISTEN_PID to the pid it knows, which is in the *outer* namespace. + // Inside, /proc/self/status reports only the namespace-local pid, so the + // value is not merely different, it names something this process cannot + // observe. Requiring equality made every candidate exit immediately. + // + // The protocol check exists so a child does not mistake inherited + // LISTEN_FDS for its own. What replaces it here is stronger than a pid + // comparison: the exact descriptor count and name order below, and then the + // content itself, which must verify against the trust anchor Idunn + // published. Descriptors that were not Idunn's fail that verification. + ensure!(!pid.is_empty(), "systemd passed no listener pid"); ensure!(count == "2", "Odin requires exactly two signer descriptors"); ensure!( names == format!("{ACTIVATION_SIGNER_FD_NAME}:{PROVIDER_SIGNER_FD_NAME}"),