New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
many: make per-snap mount namespace MS_SHARED #6891
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e93bc36
many: make per-snap mount namespace MS_SHARED
zyga 6f73c1f
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga ac9a954
tests: fix repack_snapd_snap_with_deb_content
mvo5 7be0d17
cmd/snap-update-ns: clarify several comments
zyga 454a374
tests: lift limitations from 1828354 regression test
zyga 74d2fdf
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga 6987fcb
cmd/snap-update-ns: don't propagate detaching changes
zyga dbbc4ba
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga 372d52f
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga edac19e
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga 24e1da2
Merge branch 'master' of github.com:snapcore/snapd into fix/lp-1828354
zyga File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,89 +133,115 @@ | |
|
||
# LP: #1668659 | ||
mount options=(rw rbind) /snap/ -> /snap/, | ||
mount options=(rw rshared) -> /snap/, | ||
mount options=(rw rslave) -> /snap/, | ||
mount options=(rw rshared) -> /snap/, | ||
|
||
# boostrapping the mount namespace | ||
mount options=(rw rshared) -> /, | ||
mount options=(rw bind) /tmp/snap.rootfs_*/ -> /tmp/snap.rootfs_*/, | ||
mount options=(rw unbindable) -> /tmp/snap.rootfs_*/, | ||
# the next line is for classic system | ||
mount options=(rw unbindable) -> /tmp/snap.rootfs_*/, | ||
# the next lines are for classic system | ||
mount options=(rw rbind) @SNAP_MOUNT_DIR@/*/*/ -> /tmp/snap.rootfs_*/, | ||
# the next line is for core system | ||
mount options=(rw rbind) / -> /tmp/snap.rootfs_*/, | ||
mount options=(rw rslave) -> @SNAP_MOUNT_DIR@/*/*/, | ||
mount options=(rw rshared) -> @SNAP_MOUNT_DIR@/*/*/, | ||
# the next lines are for core system | ||
# all of the constructed rootfs is a rslave | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/, | ||
# then it becomes shared for per-user mount namespaces | ||
mount options=(rw rbind) / -> /tmp/snap.rootfs_*/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/, | ||
# bidirectional mounts (for both classic and core) | ||
# NOTE: this doesn't capture the MERGED_USR configuration option so that | ||
# when a distro with merged /usr and / that uses apparmor shows up it | ||
# should be handled here. | ||
/{,run/}media/ w, | ||
mount options=(rw rbind) /{,run/}media/ -> /tmp/snap.rootfs_*/{,run/}media/, | ||
mount options=(rshared) -> /tmp/snap.rootfs_*/{,run/}media/, | ||
/run/netns/ w, | ||
mount options=(rw rbind) /run/netns/ -> /tmp/snap.rootfs_*/run/netns/, | ||
mount options=(rshared) -> /tmp/snap.rootfs_*/run/netns/, | ||
# unidirectional mounts (only for classic system) | ||
mount options=(rw rbind) /dev/ -> /tmp/snap.rootfs_*/dev/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/dev/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/dev/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/dev/, | ||
|
||
mount options=(rw rbind) /etc/ -> /tmp/snap.rootfs_*/etc/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/etc/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/etc/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/etc/, | ||
|
||
mount options=(rw rbind) /home/ -> /tmp/snap.rootfs_*/home/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/home/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/home/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/home/, | ||
|
||
mount options=(rw rbind) /root/ -> /tmp/snap.rootfs_*/root/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/root/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/root/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/root/, | ||
|
||
mount options=(rw rbind) /proc/ -> /tmp/snap.rootfs_*/proc/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/proc/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/proc/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/proc/, | ||
|
||
mount options=(rw rbind) /sys/ -> /tmp/snap.rootfs_*/sys/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/sys/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/sys/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/sys/, | ||
|
||
mount options=(rw rbind) /tmp/ -> /tmp/snap.rootfs_*/tmp/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/tmp/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/tmp/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/tmp/, | ||
|
||
mount options=(rw rbind) /var/lib/snapd/ -> /tmp/snap.rootfs_*/var/lib/snapd/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/snapd/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/snapd/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/var/lib/snapd/, | ||
|
||
mount options=(rw rbind) /var/snap/ -> /tmp/snap.rootfs_*/var/snap/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/snap/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/snap/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/var/snap/, | ||
|
||
mount options=(rw rbind) /var/tmp/ -> /tmp/snap.rootfs_*/var/tmp/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/tmp/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/tmp/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/var/tmp/, | ||
|
||
mount options=(rw rbind) /run/ -> /tmp/snap.rootfs_*/run/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/run/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/run/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/run/, | ||
|
||
mount options=(rw rbind) /var/lib/extrausers/ -> /tmp/snap.rootfs_*/var/lib/extrausers/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/extrausers/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/lib/extrausers/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/var/lib/extrausers/, | ||
|
||
mount options=(rw rbind) {,/usr}/lib{,32,64,x32}/modules/ -> /tmp/snap.rootfs_*{,/usr}/lib/modules/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*{,/usr}/lib/modules/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*{,/usr}/lib/modules/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*{,/usr}/lib/modules/, | ||
|
||
mount options=(rw rbind) {,/usr}/lib{,32,64,x32}/firmware/ -> /tmp/snap.rootfs_*{,/usr}/lib/firmware/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*{,/usr}/lib/firmware/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*{,/usr}/lib/firmware/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*{,/usr}/lib/firmware/, | ||
|
||
mount options=(rw rbind) /var/log/ -> /tmp/snap.rootfs_*/var/log/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/log/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/var/log/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/var/log/, | ||
|
||
mount options=(rw rbind) /usr/src/ -> /tmp/snap.rootfs_*/usr/src/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/usr/src/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/usr/src/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/usr/src/, | ||
|
||
mount options=(rw rbind) /mnt/ -> /tmp/snap.rootfs_*/mnt/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/mnt/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/mnt/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/mnt/, | ||
|
||
# allow making host snap-exec available inside base snaps | ||
mount options=(rw bind) @LIBEXECDIR@/ -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
mount options=(rw slave) -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
mount options=(rw slave) -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
mount options=(rw shared) -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
|
||
# allow making re-execed host snap-exec available inside base snaps | ||
mount options=(ro bind) @SNAP_MOUNT_DIR@/core/*/usr/lib/snapd/ -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
# allow making snapd snap tools available inside base snaps | ||
mount options=(ro bind) @SNAP_MOUNT_DIR@/snapd/*/usr/lib/snapd/ -> /tmp/snap.rootfs_*/usr/lib/snapd/, | ||
|
||
# XXX: this seems unused | ||
mount options=(rw bind) /usr/bin/snapctl -> /tmp/snap.rootfs_*/usr/bin/snapctl, | ||
mount options=(rw slave) -> /tmp/snap.rootfs_*/usr/bin/snapctl, | ||
mount options=(rw slave) -> /tmp/snap.rootfs_*/usr/bin/snapctl, | ||
|
||
# /etc/alternatives (classic) | ||
mount options=(rw bind) @SNAP_MOUNT_DIR@/*/*/etc/alternatives/ -> /tmp/snap.rootfs_*/etc/alternatives/, | ||
|
@@ -228,12 +254,16 @@ | |
mount options=(rw slave) -> /tmp/snap.rootfs_*/etc/nsswitch.conf, | ||
# the /snap directory | ||
mount options=(rw rbind) @SNAP_MOUNT_DIR@/ -> /tmp/snap.rootfs_*/snap/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/snap/, | ||
mount options=(rw rslave) -> /tmp/snap.rootfs_*/snap/, | ||
mount options=(rw rshared) -> /tmp/snap.rootfs_*/snap/, | ||
# pivot_root preparation and execution | ||
mount options=(rw bind) /tmp/snap.rootfs_*/var/lib/snapd/hostfs/ -> /tmp/snap.rootfs_*/var/lib/snapd/hostfs/, | ||
mount options=(rw private) -> /tmp/snap.rootfs_*/var/lib/snapd/hostfs/, | ||
mount options=(rw private) -> /tmp/snap.rootfs_*/var/lib/snapd/hostfs/, | ||
# pivot_root mediation in AppArmor is not complete. See LP: #1791711 | ||
pivot_root, | ||
# post-pivot_root hostfs propagation change. | ||
mount options=(rw rslave) -> /var/lib/snapd/hostfs/, | ||
mount options=(rw rshared) -> /var/lib/snapd/hostfs/, | ||
# cleanup | ||
umount /var/lib/snapd/hostfs/tmp/snap.rootfs_*/, | ||
umount /var/lib/snapd/hostfs/sys/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to the apparmor policy look fine. |
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is unused, we should remove it, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just didn't want to mix up other changes in this patch. I have a few cleanups for the profile in a separate patch.