pub struct ContainerMountTable {
pub mounts: Vec<ContainerMount>,
pub hidden_ancestors: Vec<(u64, u64)>,
}Expand description
The guest’s container mount table (see the module documentation).
Fields§
§mounts: Vec<ContainerMount>The rows the guest sees, in the kernel’s row order.
For each mount of the namespace the table hides, the nearest mount
above it that the table shows, as raw mount IDs: a file on a hidden
mount reports that mount’s ID in fdinfo mnt_id and STATX_MNT_ID.
Implementations§
Source§impl ContainerMountTable
impl ContainerMountTable
Sourcepub fn select(
namespace: &[ContainerMount],
installed: &BTreeSet<u64>,
base: &[(Vec<u8>, u64)],
never: &BTreeSet<u64>,
) -> Self
pub fn select( namespace: &[ContainerMount], installed: &BTreeSet<u64>, base: &[(Vec<u8>, u64)], never: &BTreeSet<u64>, ) -> Self
The table of the namespace whose rows are namespace (in the kernel’s
order). A row is shown exactly when it is:
- a mount Hermit’s mount plan installed: hermit-cli records the mount
IDs each installation creates as it installs it (
owned_mounts), and passes those of every installation but a backend’s own (installed); - a mount at one of
BASE_MOUNTPOINTS, proven the same way:baseholds each base mountpoint, as the kernel escapes it, with the mount ID of a descriptor held on it, and the row counts only if it is mounted at that very path (not merely the mount containing it); - an ancestor of a row of (1), so that every mount Hermit installed hangs from rows the table shows.
A row in never (a backend’s own mount, an ephemeral host FUSE seed)
is not shown by rule 2 or 3, and a chain of parents passes through it.
No other host mount is shown, whatever it is. A shown row’s parent is
its nearest shown ancestor; the namespace’s root keeps its parent,
which no row shows, as Linux shows it. Each hidden row is mapped to
its nearest shown ancestor (Self::shown_mount_id).
This is a chosen fidelity trade, generalizing the one made for host
FUSE seed mounts (crate::procfs::is_ephemeral_host_seed_mount): a
hidden mount is real and traversable, and Linux omits no real mount
from these files. Hermit hides it because whether it exists is decided
by unrelated host activity between runs, and a row added or removed
renumbers every later row. Where Hermit is given an image root
(--image), every mount below that root is Hermit’s own, so nothing is
hidden there. hermit-cli also leaves the uid= and gid= superblock
options out of the rows of the filesystems its plan mounts afresh,
which only the container’s root can own: Linux prints a tmpfs’s owner
as the initial user namespace sees it, so they would name the host
user who ran Hermit where the same mount by root names no one.
Sourcepub fn shown_mount_id(&self, raw_mount_id: u64) -> u64
pub fn shown_mount_id(&self, raw_mount_id: u64) -> u64
The raw mount ID the guest is shown for a file on mount raw_mount_id:
the mount itself where the table shows it or it is no row of the
namespace (pipefs, sockfs and the like, which no mountinfo lists),
else its nearest shown ancestor.
Sourcepub fn shown_mount_ids(&self) -> BTreeSet<u64>
pub fn shown_mount_ids(&self) -> BTreeSet<u64>
The raw mount IDs of the rows the table shows.
Sourcepub fn mountinfo(&self) -> Vec<u8> ⓘ
pub fn mountinfo(&self) -> Vec<u8> ⓘ
The table as the kernel would write /proc/<pid>/mountinfo with only
these rows: raw IDs, devices and peer groups, which Detcore’s
mountinfo sanitizer then numbers for the guest.
Sourcepub fn mounts(&self, rewrites: &[MountInfoRootRewrite]) -> Vec<u8> ⓘ
pub fn mounts(&self, rewrites: &[MountInfoRootRewrite]) -> Vec<u8> ⓘ
The table as Linux writes /proc/<pid>/mounts (show_vfsmnt): source,
mountpoint, type, options and two zeros per row, in the table’s order,
with the mountpoints rewrites translate (Hermit’s internal staging
prefixes) written as the guest sees them, as its mountinfo shows them.
Trait Implementations§
Source§impl Clone for ContainerMountTable
impl Clone for ContainerMountTable
Source§fn clone(&self) -> ContainerMountTable
fn clone(&self) -> ContainerMountTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContainerMountTable
Only the table’s size: Detcore logs its whole configuration, this table
included, on one line at each run’s start, and verbose verification
compares that line between two runs character by character. The rows’
raw mount IDs differ from run to run, and their bytes print as decimal
lists, so in a container with long mount options (an overlay root’s layer
list) the line, and that comparison, grew without bound: the validate
node running hermit_modes hit its 4 GiB memory cap on it.
impl Debug for ContainerMountTable
Only the table’s size: Detcore logs its whole configuration, this table included, on one line at each run’s start, and verbose verification compares that line between two runs character by character. The rows’ raw mount IDs differ from run to run, and their bytes print as decimal lists, so in a container with long mount options (an overlay root’s layer list) the line, and that comparison, grew without bound: the validate node running hermit_modes hit its 4 GiB memory cap on it.
Source§impl Default for ContainerMountTable
impl Default for ContainerMountTable
Source§fn default() -> ContainerMountTable
fn default() -> ContainerMountTable
Source§impl<'de> Deserialize<'de> for ContainerMountTable
impl<'de> Deserialize<'de> for ContainerMountTable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ContainerMountTable
Source§impl PartialEq for ContainerMountTable
impl PartialEq for ContainerMountTable
Source§impl Serialize for ContainerMountTable
impl Serialize for ContainerMountTable
impl StructuralPartialEq for ContainerMountTable
Auto Trait Implementations§
impl Freeze for ContainerMountTable
impl RefUnwindSafe for ContainerMountTable
impl Send for ContainerMountTable
impl Sync for ContainerMountTable
impl Unpin for ContainerMountTable
impl UnsafeUnpin for ContainerMountTable
impl UnwindSafe for ContainerMountTable
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,
§impl<T> Conv for T
impl<T> Conv for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.