pub struct SandboxPolicy {
pub limits: ResourceLimits,
pub allowed_k2k_destinations: HashSet<String>,
pub denied_k2k_destinations: HashSet<String>,
pub memory_access: HashMap<String, AccessLevel>,
pub can_checkpoint: bool,
pub can_migrate: bool,
pub can_spawn: bool,
pub can_access_host: bool,
pub allowed_syscalls: HashSet<String>,
}Expand description
Sandbox policy defining what a kernel can access.
Fields§
§limits: ResourceLimitsResource limits
allowed_k2k_destinations: HashSet<String>Allowed K2K destinations (empty = all allowed)
denied_k2k_destinations: HashSet<String>Denied K2K destinations
memory_access: HashMap<String, AccessLevel>Memory region access levels
can_checkpoint: boolWhether the kernel can create checkpoints
can_migrate: boolWhether the kernel can be migrated
can_spawn: boolWhether the kernel can spawn child kernels
can_access_host: boolWhether the kernel can access host memory
allowed_syscalls: HashSet<String>Allowed system calls (for future use)
Implementations§
Source§impl SandboxPolicy
impl SandboxPolicy
Sourcepub fn with_limits(self, limits: ResourceLimits) -> Self
pub fn with_limits(self, limits: ResourceLimits) -> Self
Set resource limits.
Sourcepub fn with_memory_limit(self, bytes: u64) -> Self
pub fn with_memory_limit(self, bytes: u64) -> Self
Set memory limit.
Sourcepub fn with_execution_timeout(self, timeout: Duration) -> Self
pub fn with_execution_timeout(self, timeout: Duration) -> Self
Set execution timeout.
Sourcepub fn allow_k2k_to(self, destinations: &[&str]) -> Self
pub fn allow_k2k_to(self, destinations: &[&str]) -> Self
Allow K2K to specific destinations.
Sourcepub fn deny_k2k_to(self, destinations: &[&str]) -> Self
pub fn deny_k2k_to(self, destinations: &[&str]) -> Self
Deny K2K to specific destinations.
Sourcepub fn with_memory_access(self, region: &str, access: AccessLevel) -> Self
pub fn with_memory_access(self, region: &str, access: AccessLevel) -> Self
Set memory region access level.
Sourcepub fn with_checkpoint(self, enabled: bool) -> Self
pub fn with_checkpoint(self, enabled: bool) -> Self
Enable/disable checkpointing.
Sourcepub fn with_migration(self, enabled: bool) -> Self
pub fn with_migration(self, enabled: bool) -> Self
Enable/disable migration.
Sourcepub fn with_spawn(self, enabled: bool) -> Self
pub fn with_spawn(self, enabled: bool) -> Self
Enable/disable spawning.
Sourcepub fn with_host_access(self, enabled: bool) -> Self
pub fn with_host_access(self, enabled: bool) -> Self
Enable/disable host memory access.
Sourcepub fn restrictive() -> Self
pub fn restrictive() -> Self
Create a restrictive policy for untrusted kernels.
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive policy for trusted kernels.
Sourcepub fn is_k2k_allowed(&self, destination: &str) -> bool
pub fn is_k2k_allowed(&self, destination: &str) -> bool
Check if K2K to destination is allowed.
Trait Implementations§
Source§impl Clone for SandboxPolicy
impl Clone for SandboxPolicy
Source§fn clone(&self) -> SandboxPolicy
fn clone(&self) -> SandboxPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more