X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnspawn%2Fnspawn.c;h=7d188f0712820f9c171bcce10b076590405a1ec3;hb=feb12d3ed2c7f9132c64773c7c41b9e3a608a814;hp=df858a57e6bc90b3930ea7fe2188d9834a77bf44;hpb=6f67a45d8e61d69bf4f75e1da3edcf9fe7d89982;p=elogind.git diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index df858a57e..7d188f071 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -266,16 +266,16 @@ static int mount_all(const char *dest) { static const MountPoint mount_table[] = { { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true }, - { "/proc/sys", "/proc/sys", "bind", NULL, MS_BIND, true }, /* Bind mount first */ - { "/proc/sys", "/proc/sys", "bind", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, true }, /* Then, make it r/o */ - { "/sys", "/sys", "bind", NULL, MS_BIND, true }, /* Bind mount first */ - { "/sys", "/sys", "bind", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, true }, /* Then, make it r/o */ + { "/proc/sys", "/proc/sys", NULL, NULL, MS_BIND, true }, /* Bind mount first */ + { NULL, "/proc/sys", NULL, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, true }, /* Then, make it r/o */ + { "/sys", "/sys", NULL, NULL, MS_BIND, true }, /* Bind mount first */ + { NULL, "/sys", NULL, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, true }, /* Then, make it r/o */ { "tmpfs", "/dev", "tmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, true }, - { "/dev/pts", "/dev/pts", "bind", NULL, MS_BIND, true }, + { "/dev/pts", "/dev/pts", NULL, NULL, MS_BIND, true }, { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME, true }, #ifdef HAVE_SELINUX - { "/sys/fs/selinux", "/sys/fs/selinux", "bind", NULL, MS_BIND, false }, /* Bind mount first */ - { "/sys/fs/selinux", "/sys/fs/selinux", "bind", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, false }, /* Then, make it r/o */ + { "/sys/fs/selinux", "/sys/fs/selinux", NULL, NULL, MS_BIND, false }, /* Bind mount first */ + { NULL, "/sys/fs/selinux", NULL, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, false }, /* Then, make it r/o */ #endif }; @@ -1187,13 +1187,13 @@ int main(int argc, char *argv[]) { } /* Turn directory into bind mount */ - if (mount(arg_directory, arg_directory, "bind", MS_BIND, NULL) < 0) { + if (mount(arg_directory, arg_directory, "bind", MS_BIND|MS_REC, NULL) < 0) { log_error("Failed to make bind mount."); goto child_fail; } if (arg_read_only) - if (mount(arg_directory, arg_directory, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL) < 0) { + if (mount(arg_directory, arg_directory, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL) < 0) { log_error("Failed to make read-only."); goto child_fail; }