Bind sandbox handoff authority and restore verifier gates
This commit is contained in:
parent
cf914bdf51
commit
49d5def1a9
1 changed files with 951 additions and 170 deletions
|
|
@ -16,6 +16,7 @@ use lazaret_core::records::{
|
|||
use lazaret_linux::ipc::private_seqpacket_pair;
|
||||
use lazaret_linux::process::{RetainedProcess, child_broker, current_process_identity};
|
||||
use lazaret_runtime_supervisor::network::NetworkProbeRequest;
|
||||
use lazaret_runtime_supervisor::sandbox::SandboxHandoffAuthority;
|
||||
use lazaret_runtime_supervisor::supervision::{
|
||||
AttachedRunscSignal, CoordinatorChannel, RuntimeSupervisorLaunch, SupervisorEvent,
|
||||
};
|
||||
|
|
@ -365,6 +366,7 @@ pub struct AwaitingAttachedRunsc {
|
|||
staged: Option<StagedProcessOwnership>,
|
||||
helper_staged: Option<StagedProcessOwnership>,
|
||||
network_evidence: Option<NetworkReadinessEvidence>,
|
||||
runsc_command: lazaret_runtime_supervisor::sandbox::RunscCommand,
|
||||
}
|
||||
|
||||
impl AwaitingAttachedRunsc {
|
||||
|
|
@ -450,6 +452,7 @@ impl AwaitingAttachedRunsc {
|
|||
staged: None,
|
||||
helper_staged: None,
|
||||
network_evidence: None,
|
||||
runsc_command: launch.runsc_command().clone(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -621,12 +624,23 @@ impl AwaitingAttachedRunsc {
|
|||
pub fn acknowledge(
|
||||
mut self,
|
||||
staged: StagedProcessOwnership,
|
||||
handoff: &SandboxHandoffAuthority<'_>,
|
||||
) -> Result<AwaitingSandboxReadiness, SandboxCoordinatorError> {
|
||||
if self.staged != Some(staged) {
|
||||
return Err(SandboxCoordinatorError::InvalidState(
|
||||
"attached runsc acknowledgment does not match pending stage",
|
||||
));
|
||||
}
|
||||
if staged.domain_id() != handoff.domain_id()
|
||||
|| !handoff.matches_command(&self.runsc_command)
|
||||
{
|
||||
return Err(SandboxCoordinatorError::InvalidState(
|
||||
"sandbox handoff authority does not match attached runsc",
|
||||
));
|
||||
}
|
||||
handoff
|
||||
.revalidate()
|
||||
.map_err(|error| SandboxCoordinatorError::Io(io::Error::other(error)))?;
|
||||
self.control
|
||||
.as_ref()
|
||||
.ok_or(SandboxCoordinatorError::InvalidState(
|
||||
|
|
|
|||
Loading…
Reference in a new issue