Fix rootless launches with subordinate ID maps

Resolve and verify canonical caller subordinate ranges, launch preparation and runtime workers through mapped causal acquisition, and keep runsc in the existing user namespace. Repair descriptor-relative OCI cleanup and absent-mount recovery so failed launches can progress to the corrected path.
This commit is contained in:
ms2k 2026-07-19 19:51:47 +09:00
commit 73e3e9fdee

View file

@ -22,6 +22,7 @@ use lazaret_linux::process::{
ChildStandardIo, ParentEdge, ProcessOwnershipContext, RetainedProcess, TargetCommand,
child_broker,
};
use lazaret_linux::user_namespace::UserNamespaceMap;
use lazaret_state_anchor::{
RuntimeStateAnchorAbsenceAuthority, RuntimeStateAnchorMount, StateAnchorLaunchAuthority,
};
@ -328,6 +329,7 @@ pub struct RuntimeSupervisorLaunch {
runsc_command: RunscCommand,
state_anchor: Option<StateAnchorLaunchAuthority>,
git_routing: Option<RuntimeGitRoutingLaunch>,
user_namespace_map: Option<UserNamespaceMap>,
}
#[derive(Clone, Copy)]
@ -443,6 +445,7 @@ impl RuntimeSupervisorLaunch {
runsc_command: command.clone(),
state_anchor: None,
git_routing: None,
user_namespace_map: None,
};
launch.refresh_target()?;
Ok(launch)
@ -485,6 +488,16 @@ impl RuntimeSupervisorLaunch {
Ok(self)
}
/// Adds the canonical caller-configured user namespace required by the Runtime Supervisor.
///
/// # Errors
/// Refuses a non-canonical rootless map.
pub fn with_user_namespace_map(mut self, map: UserNamespaceMap) -> io::Result<Self> {
map.validate()?;
self.user_namespace_map = Some(map);
Ok(self)
}
fn refresh_target(&mut self) -> io::Result<()> {
let encoded = build_runtime_handoff(self)?;
let handoff = sealed_memfd("lazaret-runtime-handoff", &encoded)?;
@ -522,6 +535,11 @@ impl RuntimeSupervisorLaunch {
&self.runsc_command
}
#[must_use]
pub const fn user_namespace_map(&self) -> Option<&UserNamespaceMap> {
self.user_namespace_map.as_ref()
}
/// # Errors
/// Refuses a Runtime Supervisor target without the lifetime-pipe parent edge.
pub fn child_standard_io(