mirror of
https://github.com/systemd/systemd
synced 2024-09-06 08:46:19 +00:00
nspawn: disable propagation for selected host API bind mounts
We bind mount two selected inodes from the host into our container. Let's turn off propagation for that, since we just want those inodes, nothing else. With this change "grep master: /proc/self/mountinfo" should list only the mount propagation "tunnel" dir, and nothing else anymore.
This commit is contained in:
parent
75f8173247
commit
56339a10db
|
@ -598,6 +598,8 @@ int mount_all(const char *dest,
|
||||||
MOUNT_FATAL }, /* If /etc/os-release doesn't exist use the version in /usr/lib as fallback */
|
MOUNT_FATAL }, /* If /etc/os-release doesn't exist use the version in /usr/lib as fallback */
|
||||||
{ NULL, "/run/host/os-release", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
{ NULL, "/run/host/os-release", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
||||||
MOUNT_FATAL },
|
MOUNT_FATAL },
|
||||||
|
{ NULL, "/run/host/os-release", NULL, NULL, MS_PRIVATE,
|
||||||
|
MOUNT_FATAL }, /* Turn off propagation (we only want that for the mount propagation tunnel dir) */
|
||||||
{ NULL, "/run/host", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
{ NULL, "/run/host", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
||||||
MOUNT_FATAL|MOUNT_IN_USERNS },
|
MOUNT_FATAL|MOUNT_IN_USERNS },
|
||||||
#if HAVE_SELINUX
|
#if HAVE_SELINUX
|
||||||
|
@ -605,6 +607,8 @@ int mount_all(const char *dest,
|
||||||
MOUNT_MKDIR }, /* Bind mount first (mkdir/chown the mount point in case /sys/ is mounted as minimal skeleton tmpfs) */
|
MOUNT_MKDIR }, /* Bind mount first (mkdir/chown the mount point in case /sys/ is mounted as minimal skeleton tmpfs) */
|
||||||
{ NULL, "/sys/fs/selinux", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
{ NULL, "/sys/fs/selinux", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT,
|
||||||
0 }, /* Then, make it r/o (don't mkdir/chown the mount point here, the previous entry already did that) */
|
0 }, /* Then, make it r/o (don't mkdir/chown the mount point here, the previous entry already did that) */
|
||||||
|
{ NULL, "/sys/fs/selinux", NULL, NULL, MS_PRIVATE,
|
||||||
|
0 }, /* Turn off propagation (we only want that for the mount propagation tunnel dir) */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue