From f223d891bd1bf049cc660eeea771fd874c1f0468 Mon Sep 17 00:00:00 2001 From: haozi007 Date: Mon, 20 Apr 2020 15:22:11 +0800 Subject: [PATCH] add judge whether have mount /dev entry 1.Should not populate devices 2.Should not setup devpts Signed-off-by: haozi007 --- ...d-judge-whether-have-mount-dev-entry.patch | 50 +++++++++++++++++++ series.conf | 1 + 2 files changed, 51 insertions(+) create mode 100644 0144-add-judge-whether-have-mount-dev-entry.patch diff --git a/0144-add-judge-whether-have-mount-dev-entry.patch b/0144-add-judge-whether-have-mount-dev-entry.patch new file mode 100644 index 0000000..fda3b86 --- /dev/null +++ b/0144-add-judge-whether-have-mount-dev-entry.patch @@ -0,0 +1,50 @@ +From 035a43547eb501b3db9da6780635652d906600c1 Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Mon, 20 Apr 2020 15:14:49 +0800 +Subject: [PATCH] add judge whether have mount /dev entry + +1.Should not populate devices +2.Should not setup devpts + +Signed-off-by: haozi007 +--- + src/lxc/conf.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/src/lxc/conf.c b/src/lxc/conf.c +index b67e138d..5155824a 100644 +--- a/src/lxc/conf.c ++++ b/src/lxc/conf.c +@@ -2064,17 +2064,19 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs, + return -errno; + } + +- ret = fchmod(console->slave, S_IXUSR | S_IXGRP); +- if (ret < 0) { +- SYSERROR("Failed to set mode \"0%o\" to \"%s\"", +- S_IXUSR | S_IXGRP, console->name); +- return -errno; +- } ++ if (console->slave > 0) { ++ ret = fchmod(console->slave, S_IXUSR | S_IXGRP); ++ if (ret < 0) { ++ SYSERROR("Failed to set mode \"0%o\" to \"%s\"", ++ S_IXUSR | S_IXGRP, console->name); ++ return -errno; ++ } + +- ret = safe_mount(console->name, path, "none", MS_BIND, 0, rootfs_path); +- if (ret < 0) { +- ERROR("Failed to mount \"%s\" on \"%s\"", console->name, path); +- return -1; ++ ret = safe_mount(console->name, path, "none", MS_BIND, 0, rootfs_path); ++ if (ret < 0) { ++ ERROR("Failed to mount \"%s\" on \"%s\"", console->name, path); ++ return -1; ++ } + } + + DEBUG("Mounted pts device \"%s\" onto \"%s\"", console->name, path); +-- +2.25.2 + diff --git a/series.conf b/series.conf index efe564e..4fd76c2 100644 --- a/series.conf +++ b/series.conf @@ -142,3 +142,4 @@ lxc-CVE-2019-5736-runC-rexec-callers-as-memfd.patch 0141-lxc-decode-some-escape-charactors-of-lxc-config-file.patch 0142-lxc-fix-non-root-user-cannot-write-dev-stdout.patch 0143-Support-syslog-for-console-log.patch +0144-add-judge-whether-have-mount-dev-entry.patch -- Gitee