[CRIU] [PATCH 6/6] zdtm: check a case when a slave pty is mounted to somewhere
Andrei Vagin
avagin at openvz.org
Tue Jan 3 15:40:05 PST 2017
From: Andrei Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm/static/Makefile | 3 +++
test/zdtm/static/pty-console.c | 1 +
test/zdtm/static/pty-console.desc | 1 +
test/zdtm/static/pty01.c | 14 ++++++++++++++
4 files changed, 19 insertions(+)
create mode 120000 test/zdtm/static/pty-console.c
create mode 100644 test/zdtm/static/pty-console.desc
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index d89e3ed..d983a4b 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -114,6 +114,7 @@ TST_NOFILE := \
rlimits00 \
pty00 \
pty01 \
+ pty-console \
pty02 \
pty03 \
pty04 \
@@ -452,6 +453,8 @@ socket-tcp6-last-ack: override CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV6
socket-tcp6-closing: override CFLAGS += -D ZDTM_IPV6
socket-tcp6-unconn: override CFLAGS += -D ZDTM_IPV6
+pty-console: override CFLAGS += -D ZDTM_DEV_CONSOLE
+
$(LIB): force
$(Q) $(MAKE) -C $(LIBDIR)
diff --git a/test/zdtm/static/pty-console.c b/test/zdtm/static/pty-console.c
new file mode 120000
index 0000000..de7990f
--- /dev/null
+++ b/test/zdtm/static/pty-console.c
@@ -0,0 +1 @@
+pty01.c
\ No newline at end of file
diff --git a/test/zdtm/static/pty-console.desc b/test/zdtm/static/pty-console.desc
new file mode 100644
index 0000000..fba5e87
--- /dev/null
+++ b/test/zdtm/static/pty-console.desc
@@ -0,0 +1 @@
+{'flags': 'suid', 'flavor' : 'ns uns'}
diff --git a/test/zdtm/static/pty01.c b/test/zdtm/static/pty01.c
index fdf10b9..29b2060 100644
--- a/test/zdtm/static/pty01.c
+++ b/test/zdtm/static/pty01.c
@@ -9,6 +9,7 @@
#include <string.h>
#include <termios.h>
#include <signal.h>
+#include <sys/mount.h>
#include "zdtmtst.h"
@@ -51,6 +52,19 @@ int main(int argc, char *argv[])
return 1;
}
+#ifdef ZDTM_DEV_CONSOLE
+ {
+ int fd;
+ fd = open("/dev/console", O_CREAT | O_RDONLY, 0755);
+ if (fd < 0)
+ return -1;
+ close(fd);
+
+ if (mount(slavename, "/dev/console", NULL, MS_BIND, NULL))
+ return -1;
+ }
+#endif
+
if (fchown(slave1, new_uid, new_gid)) {
pr_perror("Can't set uid/gid on %s", slavename);
return 1;
--
2.7.4
More information about the CRIU
mailing list