pub struct BackendRegistration {
pub name: &'static str,
pub priority: i32,
pub auto_selectable: bool,
pub injects_9p_socket: bool,
pub mounts_fuse_vfs: bool,
pub is_available: fn() -> bool,
pub construct: fn(&BackendCtx) -> Result<Arc<dyn SandboxBackend>>,
}Expand description
A compile-time sandbox-backend registration, collected via inventory.
Each backend submits one of these next to its implementation, gated by the
#[cfg] feature that compiles the backend in. The registry is enumerated by
resolve_backend; there is no central enum to keep in sync.
Fields§
§name: &'static strStable selector name, e.g. "kata", "nspawn". Matched against
worker.backend (case-insensitively).
priority: i32Auto-selection precedence: higher is preferred. "auto" picks the
highest-priority available registration (among auto_selectable ones).
auto_selectable: boolWhether this backend is eligible for "auto" selection.
true → "auto" may pick it (subject to priority and is_available).
false → explicit-name-only: "auto" must never choose it, even if it
is the highest-priority available (or only) registration. It remains
selectable by its concrete name (fail-closed).
This exists so weaker-isolation tiers cannot become a silent "auto"
fallback when stronger backends are absent — auto-selecting them would be a
silent isolation downgrade, which the #547 MAC/ZSP model forbids. The
in-process wasm sandbox (shared host address space) sets this false.
injects_9p_socket: boolWhether this backend can inject a 9P socket endpoint — a host Unix domain socket — into a workload’s mount namespace (#506).
The Wanix-guest workload (runtime::wanix_workload) works by having
hyprstream serve a tenant’s Subject-scoped VFS Mount as a 9P2000.L
server on a host UDS, then making that socket reachable inside the
sandbox (bind-mounting the host socket into the container’s mount
namespace and setting HYPRSTREAM_9P_SOCK) so the guest dials back. That
requires the backend to be able to bind-mount an arbitrary host path (the
socket) into the workload, which the tiers do differently:
oci/nspawn→true: both bind-mount host paths into the container (podman --volume/nspawn --bind), so a host UDS injects cleanly.kata→false: a full VM does not share the host mount namespace, so a host UDS cannot be bind-injected the same way (the VM path uses virtio-fs, a different mechanism — seesandbox_fs); it therefore does not advertise this capability.wasm→false: in-process, no separate mount namespace to inject a host socket into.
Selection is fail-closed on this flag: a workload that requires 9P
socket injection (resolve_backend_9p_capable /
require_9p_socket_capability) never resolves to a backend that does
not advertise it — it errors rather than silently dropping the injection.
mounts_fuse_vfs: boolWhether this backend FUSE-mounts the composed per-sandbox tenant VFS as a real host directory and POSIX-roots its workload there (Model B, #715 — the non-VM sibling of the kata virtio-fs path).
true → the backend consumes SandboxFs::serve_local_at to serve the
composed namespace over /dev/fuse and give that host directory to the
container. nspawn sets this. kata does not — it already shares the
composed VFS as a virtio-fs device, not a host FUSE mount. In-process
wasm has no host filesystem to mount into. oci is deferred pending a
rootless /dev/fuse feasibility spike and advertises false for now.
require_fuse_mount_capability gates the mount fail-closed: a backend
that does not advertise this capability is never handed a FUSE-rooted
namespace (no silent POSIX-rooting in a namespace a backend can’t mount).
is_available: fn() -> boolRuntime prerequisite probe (PATH lookups, socket existence, …). Returns
true when this backend can actually run on this host right now. Used
to inform "auto" and to fail-close explicit requests whose prereqs are
missing.
construct: fn(&BackendCtx) -> Result<Arc<dyn SandboxBackend>>Construct the concrete backend from per-call BackendCtx state.
Trait Implementations§
Source§impl Debug for BackendRegistration
impl Debug for BackendRegistration
impl Collect for BackendRegistration
Auto Trait Implementations§
impl Freeze for BackendRegistration
impl RefUnwindSafe for BackendRegistration
impl Send for BackendRegistration
impl Sync for BackendRegistration
impl Unpin for BackendRegistration
impl UnsafeUnpin for BackendRegistration
impl UnwindSafe for BackendRegistration
Blanket Implementations§
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
§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