advanced26 min studyLesson 342 in Engineering

Mount propagation: isolate topology as well as pathnames

Distinguish mount namespaces, shared peer groups, slave propagation, recursive operations, and root changes from ordinary file-content isolation.

On this page

What you’ll understand

  • Predict the direction of a mount event across a specified peer/slave topology.
  • Distinguish recursive bind and propagation changes from single-mount operations.
  • Explain why changing a process root does not revoke inherited file access.

A container can have its own mount namespace and still receive mount events from another namespace through shared-subtree relationships. It can also have a read-only root while a separately mounted directory remains writable. These are deliberate kernel mechanisms, not contradictions. We study Linux 6.12 mount objects and propagation topology, with OCI Runtime Specification v1.3.0 as the configuration vocabulary. Exact runtime setup and kernel support must be inspected rather than inferred from a generic container command.

A new mount namespace initially inherits a topology

A mount namespace provides a view of a mount tree. Creating one begins with a copy of an existing mount layout, including relevant propagation relationships; it does not deep-copy filesystem contents. A shared mount belongs to a peer group whose mount and unmount events can propagate to peers. A slave receives relevant events from its master but does not send them back upstream. A mount can participate in more nuanced shared-and-slave relationships, so classify the actual mount object instead of assuming four labels describe every topology completely.

Private mounts do not participate in that shared event propagation. Unbindable mounts add restrictions on bind replication. These properties concern mount topology changes, such as a new filesystem appearing beneath a mount, not ordinary writes to files in a shared backing filesystem. Making a mount private does not copy its data or make existing file contents confidential. Conversely, two isolated mount trees can still expose the same underlying writable directory through bind mounts. A correct explanation keeps visibility of names, topology, and data access separate.

receives⁡(v,e)  ⟺  v∈reachable⁡propagation(origin⁡(e))\operatorname{receives}(v,e)\iff v\in\operatorname{reachable}_{\rm propagation}(\operatorname{origin}(e))
For a specified valid shared-subtree topology and one propagating mount event e, this schematic counts directed propagation reachability. It is not a complete Linux mount algorithm; ordinary file writes are not the event e, and permission and topology rules remain required.↔ Scroll wide equations horizontally.

Recursive operations determine what happens below the top

A bind mount and a recursive bind mount differ in whether existing subordinate mounts are replicated. Similarly, changing one mount's propagation state is different from recursively changing its descendants. A runtime that intends an isolated root subtree must account for every relevant nested mount, not just apply a private label to the top and assume children changed too. Inspect mountinfo optional fields such as shared and master identifiers to reconstruct the relationships visible from the target process's mount namespace.

The process root and working directory are separate references. chroot changes pathname resolution but is not a complete security boundary against privileged processes or inherited descriptors. Runtime root setup commonly uses pivot_root or an equivalent supported mechanism with careful cleanup of old-root references. Open file descriptors, current directories, and bind mounts can preserve access to objects outside the intended path tree. A read-only root mount also does not automatically make every separately mounted writable volume read-only; inspect the effective mount attributes at each destination.

Nchanged=1+dfor an operation covering one root and d selected descendant mountsN_{\rm changed}=1+d\quad\text{for an operation covering one root and }d\text{ selected descendant mounts}
This is a finite inventory count for an explicitly recursive operation over d distinct descendant mounts. Counts are dimensionless; actual Linux propagation and bind operations have their own inclusion rules, so the equation does not replace a mount-tree inspection.↔ Scroll wide equations horizontally.

Audit the graph rather than trust a few successful tests

Build a small table listing mount IDs, parent IDs, namespace identity, propagation group, source, target, and read/write attributes. Then predict where one test mount event should appear and verify that prediction in a disposable controlled environment. Unexpected propagation often comes from an inherited shared relationship or a nested mount omitted by a nonrecursive operation. Testing one pathname says little about another subtree with a different relationship. Preserve the exact runtime version and configuration when comparing results, because defaults can differ.

The probability lab illustrates the limited evidence from sampling test paths. Reset, explicitly set p=0.25 and n=4, interpret success as detecting a hypothetical propagation error, predict the zero-success bar, then Play or Step. For a separate sample-size comparison Reset and explicitly set p=0.25 and n=8. This assumes independent equal-probability tests; real mount checks can be correlated. The diagram contains no namespaces, peers, slaves, or mount operations, so a passing sample cannot replace the topology audit.

Count one directed propagation event

In an explicitly simplified valid topology, A, B, and C form one shared peer group. D and E are separate slave mounts receiving from that group and have no downstream peers. Assume one new child mount event propagates once to every eligible receiving mount and no other relationships exist.

  1. An event originating beneath shared mount A is visible through the peer group's A, B, and C views. That gives three peer-side instances under the stipulated topology.

  2. D and E receive the event from their master group, adding two more views. The total is five. This count assumes the specified one-level graph and does not describe recursive nested propagation in an arbitrary host tree.

  3. An event originating only beneath slave D does not propagate back to A, B, or C or sideways to E through that master relationship. Receiving from upstream is not permission to publish upstream.

The result

The stipulated event reaches five views from A, while a D-origin event does not reverse the master-to-slave direction. Ordinary writes to an already shared backing file follow different visibility rules.

Explore the model

Interactive lab

Interactive lab · probability

Sampled mount tests are not a topology proof

For separate toy detection experiments use Reset → explicitly set both p and n → predict → Play or Step. Compare (0.25,4) with Reset plus (0.25,8). Independent test detection is assumed. This model does not represent shared peer groups, recursive mounts, propagation direction, or filesystem permissions.

Sampled mount tests are not a topology proofThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA few passing sampled paths cannot establish that every inherited or nested mount has the intended propagation state.

Check your understanding

A mount is made private without a recursive operation. Which conclusion is justified?

Try it yourself

A root subtree contains one top mount and six descendant mounts. A policy intends to change propagation on all seven, but the implementation changes only the top. How many intended objects remain unchecked? Does a private bind of a host directory make writes to that directory invisible to the host?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Count mount objects separately from the backing storage they expose.

Compare with the solution

Six descendants remain unchecked by the stated nonrecursive change. Their actual propagation states may or may not already be acceptable, so inspect them rather than assuming either result. A private bind does not copy the directory's data; writes to the same underlying objects can remain visible through the host's path. Private propagation controls mount-event relationships, while data isolation requires a different backing-store or access-control design. A namespace and root change likewise do not close inherited descriptors automatically.

Take it with you

  • Mount namespaces can inherit shared-subtree relationships.
  • Propagation direction, recursive selection, and file-content sharing are separate questions.
  • Root changes do not revoke every existing reference to outside objects.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.