[CRIU] [PATCH v3 2/3] zdtm: Add userns02 test
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Mar 20 04:58:43 PDT 2017
Differs to userns01 test by unsharing net net in child.
This should test nested user/net ns interaction.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
test/zdtm/static/Makefile | 2 ++
test/zdtm/static/userns01.c | 8 ++++++--
test/zdtm/static/userns02.c | 1 +
test/zdtm/static/userns02.desc | 1 +
4 files changed, 10 insertions(+), 2 deletions(-)
create mode 120000 test/zdtm/static/userns02.c
create mode 120000 test/zdtm/static/userns02.desc
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 84c73c480..02bf54d35 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -179,6 +179,7 @@ TST_NOFILE := \
netns_sub \
userns00 \
userns01 \
+ userns02 \
# jobctl00 \
ifneq ($(SRCARCH),arm)
@@ -466,6 +467,7 @@ socket-tcp6-closing: override CFLAGS += -D ZDTM_IPV6
socket-tcp6-unconn: override CFLAGS += -D ZDTM_IPV6
pty-console: override CFLAGS += -D ZDTM_DEV_CONSOLE
+userns02: override CFLAGS += -D USERNS02
$(LIB): force
$(Q) $(MAKE) -C $(LIBDIR)
diff --git a/test/zdtm/static/userns01.c b/test/zdtm/static/userns01.c
index 7830909cc..4d2a9d937 100644
--- a/test/zdtm/static/userns01.c
+++ b/test/zdtm/static/userns01.c
@@ -78,9 +78,13 @@ int child(void)
gid_t gid_list2[ARRAY_SIZE(gid_list) + 1];
uid_t uid, euid, suid, fsuid;
gid_t gid, egid, sgid, fsgid;
- int i, nr, ret;
+ int i, nr, flags, ret;
- ret = unshare(CLONE_NEWUSER);
+ flags = CLONE_NEWUSER;
+#ifdef USERNS02
+ flags |= CLONE_NEWNET;
+#endif
+ ret = unshare(flags);
if (ret < 0) {
pr_perror("unshare");
futex_set_and_wake(futex, EMERGENCY_ABORT);
diff --git a/test/zdtm/static/userns02.c b/test/zdtm/static/userns02.c
new file mode 120000
index 000000000..d9ce9246a
--- /dev/null
+++ b/test/zdtm/static/userns02.c
@@ -0,0 +1 @@
+userns01.c
\ No newline at end of file
diff --git a/test/zdtm/static/userns02.desc b/test/zdtm/static/userns02.desc
new file mode 120000
index 000000000..0112fa7b9
--- /dev/null
+++ b/test/zdtm/static/userns02.desc
@@ -0,0 +1 @@
+userns01.desc
\ No newline at end of file
More information about the CRIU
mailing list