Struct SandboxPolicy
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§
§impl SandboxPolicy
impl SandboxPolicy
pub fn new() -> SandboxPolicy
pub fn new() -> SandboxPolicy
Create a new sandbox policy.
pub fn with_limits(self, limits: ResourceLimits) -> SandboxPolicy
pub fn with_limits(self, limits: ResourceLimits) -> SandboxPolicy
Set resource limits.
pub fn with_memory_limit(self, bytes: u64) -> SandboxPolicy
pub fn with_memory_limit(self, bytes: u64) -> SandboxPolicy
Set memory limit.
pub fn with_execution_timeout(self, timeout: Duration) -> SandboxPolicy
pub fn with_execution_timeout(self, timeout: Duration) -> SandboxPolicy
Set execution timeout.
pub fn allow_k2k_to(self, destinations: &[&str]) -> SandboxPolicy
pub fn allow_k2k_to(self, destinations: &[&str]) -> SandboxPolicy
Allow K2K to specific destinations.
pub fn deny_k2k_to(self, destinations: &[&str]) -> SandboxPolicy
pub fn deny_k2k_to(self, destinations: &[&str]) -> SandboxPolicy
Deny K2K to specific destinations.
pub fn with_memory_access(
self,
region: &str,
access: AccessLevel,
) -> SandboxPolicy
pub fn with_memory_access( self, region: &str, access: AccessLevel, ) -> SandboxPolicy
Set memory region access level.
pub fn with_checkpoint(self, enabled: bool) -> SandboxPolicy
pub fn with_checkpoint(self, enabled: bool) -> SandboxPolicy
Enable/disable checkpointing.
pub fn with_migration(self, enabled: bool) -> SandboxPolicy
pub fn with_migration(self, enabled: bool) -> SandboxPolicy
Enable/disable migration.
pub fn with_spawn(self, enabled: bool) -> SandboxPolicy
pub fn with_spawn(self, enabled: bool) -> SandboxPolicy
Enable/disable spawning.
pub fn with_host_access(self, enabled: bool) -> SandboxPolicy
pub fn with_host_access(self, enabled: bool) -> SandboxPolicy
Enable/disable host memory access.
pub fn restrictive() -> SandboxPolicy
pub fn restrictive() -> SandboxPolicy
Create a restrictive policy for untrusted kernels.
pub fn permissive() -> SandboxPolicy
pub fn permissive() -> SandboxPolicy
Create a permissive policy for trusted kernels.
pub 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§
§impl Clone for SandboxPolicy
impl Clone for SandboxPolicy
§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§impl Debug for SandboxPolicy
impl Debug for SandboxPolicy
§impl Default for SandboxPolicy
impl Default for SandboxPolicy
§fn default() -> SandboxPolicy
fn default() -> SandboxPolicy
Auto Trait Implementations§
impl Freeze for SandboxPolicy
impl RefUnwindSafe for SandboxPolicy
impl Send for SandboxPolicy
impl Sync for SandboxPolicy
impl Unpin for SandboxPolicy
impl UnwindSafe for SandboxPolicy
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more