[CRIU] [PATCH 2/2] tempfs: check inaccessible tempfs mounts
Andrey Vagin
avagin at openvz.org
Wed May 11 22:53:00 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
criu dump should return an error in this case
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/static/Makefile | 1 +
test/zdtm/static/tempfs_overmounted.c | 36 ++++++++++++++++++++++++++++++++
test/zdtm/static/tempfs_overmounted.desc | 1 +
3 files changed, 38 insertions(+)
create mode 100644 test/zdtm/static/tempfs_overmounted.c
create mode 100644 test/zdtm/static/tempfs_overmounted.desc
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 7045734..afad959 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -205,6 +205,7 @@ TST_DIR = \
overmount_fifo \
overmount_sock \
tempfs \
+ tempfs_overmounted \
tempfs_ro \
tempfs_subns \
mnt_ro_bind \
diff --git a/test/zdtm/static/tempfs_overmounted.c b/test/zdtm/static/tempfs_overmounted.c
new file mode 100644
index 0000000..56c3d2e
--- /dev/null
+++ b/test/zdtm/static/tempfs_overmounted.c
@@ -0,0 +1,36 @@
+#include <stdbool.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <linux/limits.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc = "Check tmpfs mount";
+const char *test_author = "Pavel Emelianov <xemul at parallels.com>";
+
+char *dirname;
+TEST_OPTION(dirname, string, "directory name", 1);
+
+int main(int argc, char **argv)
+{
+ test_init(argc, argv);
+
+ mkdir(dirname, 0700);
+ if (mount("none", dirname, "tmpfs", 0, "") < 0) {
+ fail("Can't mount tmpfs");
+ return 1;
+ }
+ if (mount("none", dirname, "tmpfs", 0, "") < 0) {
+ fail("Can't mount tmpfs");
+ return 1;
+ }
+
+ test_daemon();
+ test_waitsig();
+
+ pass();
+ return 0;
+}
diff --git a/test/zdtm/static/tempfs_overmounted.desc b/test/zdtm/static/tempfs_overmounted.desc
new file mode 100644
index 0000000..0d8b7f2
--- /dev/null
+++ b/test/zdtm/static/tempfs_overmounted.desc
@@ -0,0 +1 @@
+{'flavor': 'ns uns', 'flags': 'suid crfail'}
--
2.7.4
More information about the CRIU
mailing list