pub struct SealedEtcPath {
pub path: &'static str,
pub directory: bool,
pub synthetic: Option<SyntheticEtcFile>,
}Expand description
One entry of the fixed /etc allowlist: the host path to bind, plus whether it is a directory.
The directory bit exists because the same list drives two mechanisms with different needs.
[plan_composed_root] does not need it — it asks the host what each path is via
[HostLayout::kind] and mirrors accordingly. sandbox::resolve_sealed_etc_landlock_grants does:
it must decide ReadDir per entry, and it is required to be pure and syscall-free (it runs on
any platform, for paths that need not exist). Carrying the classification in the list rather
than in a second parallel constant is what makes the bound set and the granted set structurally
incapable of drifting apart — the same reason SealedDevice carries its own writable bit
rather than deriving it from a separate table.
It is a static claim about mainstream Linux, not a fact read off this host: /etc/ssl and
friends are directories on Debian, Ubuntu, Fedora, RHEL, Arch and Alpine alike. A host that
disagrees costs the entry its enumerability and nothing else — open_landlock_fds narrows
list_dir back to false for anything that does not fstat as a directory, because the kernel
rejects (EINVAL) a ReadDir rule on a non-directory and that would otherwise refuse the whole
launch.
Fields§
§path: &'static strAbsolute path inside the composed root. Also the host path bind-mounted there, except for
an entry carrying Self::synthetic, whose content the parent writes itself.
directory: boolWhether this path is a directory on a mainstream Linux host, and therefore whether its
Landlock rule carries ReadDir. false for regular files and for symlinks (the symlink is
followed when the rule’s fd is opened, so /etc/localtime’s rule lands on the zoneinfo file
it points at).
synthetic: Option<SyntheticEtcFile>Some when Self::path is backed by a file the parent synthesises rather than by the
host’s own file at that path — the account databases, and nothing else.
Carried on the entry for the same reason as directory: the alternative is a second
parallel list of “the ones we do not mirror”, which is free to drift out of step with this
one. Typed rather than a bool so the content each synthetic entry gets is decided by an
exhaustive match — adding a third one is then a compile error until it is given content,
instead of a launch-time failure to bind a file nobody wrote.
Trait Implementations§
Source§impl Clone for SealedEtcPath
impl Clone for SealedEtcPath
impl Copy for SealedEtcPath
Source§impl Debug for SealedEtcPath
impl Debug for SealedEtcPath
impl Eq for SealedEtcPath
Source§impl PartialEq for SealedEtcPath
impl PartialEq for SealedEtcPath
impl StructuralPartialEq for SealedEtcPath
Auto Trait Implementations§
impl Forget for SealedEtcPath
impl Freeze for SealedEtcPath
impl Move for SealedEtcPath
impl RefUnwindSafe for SealedEtcPath
impl Send for SealedEtcPath
impl Sync for SealedEtcPath
impl Unpin for SealedEtcPath
impl UnsafeUnpin for SealedEtcPath
impl UnwindSafe for SealedEtcPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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