Skip to content

Set the propagation a mount asks for - #864

Open
MayCXC wants to merge 4 commits into
apple:mainfrom
MayCXC:mount-propagation
Open

Set the propagation a mount asks for#864
MayCXC wants to merge 4 commits into
apple:mainfrom
MayCXC:mount-propagation

Conversation

@MayCXC

@MayCXC MayCXC commented Aug 27, 2026

Copy link
Copy Markdown

Summary

The mount options a runtime spec carries include propagation, which the kernel takes in a mount call of its own rather than alongside the mount it applies to. The call was already here, but nothing set the flags it acts on: option parsing knew every flag except these, so rshared and its siblings fell through to the mount data, where the kernel rejects them and the container fails to start.

Parse them into their own set, and make the propagation calls from it. A mount can then ask for what runc's spec conversion offers, and the flags a mount is given no longer have to be sifted for propagation bits that never belonged among them.

Dependency and Merge Order

This targets stock apple/containerization:main and depends on #863. Please merge #863 first.

The head carries #863's three commits as prerequisites, because both PRs target stock main and GitHub only allows a fork PR to base on a branch in this repository. Once #863 merges, this branch can take current main and its remaining diff is only Sources/ContainerizationOS/Mount/Mount.swift and the integration test.

The dependency is on the test suite work, not the fix: the propagation test needs the kernel #863 selects, since the guest has to be one where the propagation calls behave as the spec describes.

Motivation and Context

The failure is opaque from the outside: a container asking for rshared does not start, and the rejection comes from the kernel refusing an option string it was handed rather than from anything naming propagation. runc's spec conversion offers these flags, so a spec that sets them is well-formed and should work.

Testing

  • swift build and make check clean.
  • swift test: 603 tests in 83 suites passed.
  • Integration: container mount propagation asserts the mount is shared by checking that the kernel gave it a peer group, which only a mount told to share carries.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

MayCXC added 4 commits August 27, 2026 20:43
The reaper that runs at a concurrency of one deletes everything in the
test directory except the unpacked rootfs it means to preserve. It held
that rootfs path as FileManager reports it, under /var, and compared it
against the entries of contentsOfDirectory, which reports them under
/private/var, so the preserved path never matched any entry and the
rootfs was deleted along with the per-test files. The unpack coordinator
still held it as unpacked, so the next test opened a rootfs that was no
longer there and failed with a missing file error.

Resolve both sides with resolvingSymlinksInPathWithPrivate, which exists
for this difference between the two views of the same directory.
Tests guarded for Linux are compiled out on macOS, so `make test` reports
success without having run them, and nothing says so. The target that
does run them is not mentioned anywhere outside the makefile.
The default kernel the tests fetch had drifted from the one users run.
container installs kata 3.28.0 and its 6.18.15 kernel, while these tests
fetched 3.17.0, so the suite exercised a guest with a different feature
set to the one it is meant to represent. Nested runtimes are the visible
case: 3.17.0 was built without nf_tables, so a docker daemon inside a
container fails there and works on what ships.

Kata moved from xz to zstd between those releases, so the archive is no
longer named for its compression and tar is left to recognise it rather
than being told, which also holds if the format changes again.
The mount options a runtime spec carries include propagation, which the
kernel takes in a mount call of its own rather than alongside the mount it
applies to. The call was already here, but nothing set the flags it acts on:
option parsing knew every flag except these, so `rshared` and its siblings
fell through to the mount data, where the kernel rejects them and the
container fails to start.

Parse them into their own set, and make the propagation calls from it. A
mount can then ask for what runc's spec conversion offers, and the flags a
mount is given no longer have to be sifted for propagation bits that never
belonged among them.
@MayCXC
MayCXC force-pushed the mount-propagation branch from 9380e89 to 6b73db7 Compare August 27, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant