summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-mount.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-30 13:47:28 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-30 15:19:33 +0200
commitd8fc6a000fe21b0c1ba27fbfed8b42d00b349a4b (patch)
tree7b21fcfde83588969aebf609e0ad835566a4358a /src/nspawn/nspawn-mount.h
parent403af78c8049358496ec10920b3aaf741056daf9 (diff)
nspawn: mount /sys as tmpfs, and then mount only select subdirs of the real sysfs below it
This way we can hide things like /sys/firmware or /sys/hypervisor from the container, while keeping the device tree around. While this is a security benefit in itself it also allows us to fix issue #1277. Previously we'd mount /sys before creating the user namespace, in order to be able to mount /sys/fs/cgroup/* beneath it (which resides in it), which we can only mount outside of the user namespace. To ensure that the user namespace owns the network namespace we'd set up the network namespace at the same time as the user namespace. Thus, we'd still see the /sys/class/net/ from the originating network namespace, even though we are in our own network namespace now. With this patch, /sys is mounted before transitioning into the user namespace as tmpfs, so that we can also mount /sys/fs/cgroup/* into it this early. The directories such as /sys/class/ are then later added in from the real sysfs from inside the network and user namespace so that they actually show whatis available in it. Fixes #1277
Diffstat (limited to 'src/nspawn/nspawn-mount.h')
-rw-r--r--src/nspawn/nspawn-mount.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nspawn/nspawn-mount.h b/src/nspawn/nspawn-mount.h
index da4986add0..54cab87665 100644
--- a/src/nspawn/nspawn-mount.h
+++ b/src/nspawn/nspawn-mount.h
@@ -58,6 +58,7 @@ int tmpfs_mount_parse(CustomMount **l, unsigned *n, const char *s);
int custom_mount_compare(const void *a, const void *b);
int mount_all(const char *dest, bool use_userns, bool in_userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
+int mount_sysfs(const char *dest);
int mount_cgroups(const char *dest, bool unified_requested, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
int mount_systemd_cgroup_writable(const char *dest, bool unified_requested);