X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnspawn%2Fnspawn.c;h=ed72c3ebf1cffc43fae0455694abda1038f76510;hb=9c1c7f712d8270c4f6bd8141d0b1acb1f031fa08;hp=7d188f0712820f9c171bcce10b076590405a1ec3;hpb=1e41be20158a6d982c34cea20e66ff271302abc5;p=elogind.git diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 7d188f071..ed72c3ebf 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -53,6 +53,7 @@ #include "path-util.h" #include "loopback-setup.h" #include "sd-id128.h" +#include "dev-setup.h" typedef enum LinkJournal { LINK_NO, @@ -268,8 +269,7 @@ static int mount_all(const char *dest) { { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true }, { "/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 */ + { "sysfs", "/sys", "sysfs", NULL, MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV, true }, { "tmpfs", "/dev", "tmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, true }, { "/dev/pts", "/dev/pts", NULL, NULL, MS_BIND, true }, { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME, true }, @@ -295,7 +295,7 @@ static int mount_all(const char *dest) { break; } - t = path_is_mount_point(where, false); + t = path_is_mount_point(where, true); if (t < 0) { log_error("Failed to detect whether %s is a mount point: %s", where, strerror(-t)); free(where); @@ -306,6 +306,10 @@ static int mount_all(const char *dest) { continue; } + /* Skip this entry if it is not a remount. */ + if (mount_table[k].what && t > 0) + continue; + mkdir_p_label(where, 0755); if (mount(mount_table[k].what, @@ -1204,6 +1208,8 @@ int main(int argc, char *argv[]) { if (copy_devnodes(arg_directory) < 0) goto child_fail; + dev_setup(arg_directory); + if (setup_dev_console(arg_directory, console) < 0) goto child_fail;