Commit graph

1699 commits

Author SHA1 Message Date
Andrei Vagin
514510ba87 zdtm/tempfs_subns: sync children with the main process
All static tests has to stop any activity before C/R.

./tempfs_subns --pidfile=tempfs_subns.pid --outfile=tempfs_subns.out --dirname=tempfs_subns.test
Run criu dump
Unable to kill 128: [Errno 3] No such process
Run criu restore
7: Old mounts lost: []
7: New mounts appeared: [('/rootfs/criu/test', '/'), ('/', '/proc'), ('/', '/dev/pts')]
:

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-12-07 19:55:23 +03:00
Andrei Vagin
b921ad2908 test: check a pipe with a custom size
CRIU doesn't handle correctly pipes with sizes which are bigger than a
default one.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-12-04 23:59:06 +03:00
Mike Rapoport
8c545089ed zdtm: use {read,write}_data in fifo tests
Reading and writing large buffers may result in short read/write. In cases
we expect the entire buffer to be transferred use {read,write}_data rather
than plain read/write syscalls.

Reported-by: Mr Jenkins
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 21:59:03 +03:00
Mike Rapoport
a76ff847d6 zdtm: lib: add {read,write}_data helpers
Some tests expect that all the data will be handled in a single invocation
of read/write system call. But it possible to have short read/write on a
loaded system and this is not an error.
Add helper functions that will reliably read/write the entire buffer.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 21:58:59 +03:00
Pavel Begunkov
369b56068b zdtm: Test inherited file leases
-- check childs' errors in file_leases03
-- test c/r of lease transfered to child process

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:36:15 +03:00
Andrei Vagin
d1ba8b8831 zdtm/maps006: modify test so that file and anon vma-s are mixed
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:36:14 +03:00
Pavel Begunkov
4986cdf225 zdtm: Add file lease tests
Test cases:
0. Basic non-breaking read/write leases.
1. Multiple read leases and OFDs with no lease for the same file.
2. Breaking leases.
3. Multiple fds (dup + inherited) for single lease (mutual OFD).

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Andrei Vagin
641d5ff987 alpine: cast addresses to struct sockaddr *
Otherwise we get errors like this:

/usr/include/sys/socket.h:315:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
 int bind (int, const struct sockaddr *, socklen_t);

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Andrei Vagin
7b8de6bce6 zdtm: don't mix images from dump with and without check_only
The idea of the check-only option is that criu dump and criu
restore is executed with this option to check whether c/r is
possible for a set of processes. This has to work faster than
without the check-only option.

Now we run criu restore --check-only for images which have
been generated by criu dump without --check-only, it is obviously wrong.

Cc: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Andrei Vagin
9c8d9f1f08 zdtm: don't overwrite logs if the check-only option is set
If the check-only option is set, dump and restore is executed twice,
and we need to set separate logs for both cases.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Andrei Vagin
f951a3cc92 zdtm: restore ns_last_pid before executing restore in a second time
Otherwise a criu process can get a pid of one of restored processes.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Andrei Vagin
14ab677ef2 restore: wait restored tasks in the check-only case
If the restore was exexuted with the check-only option,
after restoring all resources tasks waits children and
exits with the 0 code.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:34:50 +03:00
Pavel Tikhomirov
ab1eaad3c3 zdtm/session04: do cleanup on success and wait children in it
https://github.com/xemul/criu/issues/372
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-11-30 01:31:19 +03:00
Kirill Tkhai
5af3ca59eb utils: Add sys_clone_unified()
Cleanup fork() definition and make a generic function
for all archs. It may be useful, when you want to add
more clone flags to fork(), or if you want to pass more,
than one argument to child function (glibc's clone
alows only one).

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:31:19 +03:00
Dmitry Safonov
f5c11168d5 fault-inj: Silently dying helper's child
The restorer blob may die silently due to anything:
- Segmentation fault
- OOM killer
- User-sended SIGKILL
- Child CRIU restorer did't abort futex on error path (and exited)

We should terminate the restoring process and avoid locking
self up on waiting for died restoree.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:31:03 +03:00
Veronika Kabatova
18c22b77c5 Modify and add test for configuration file functionality
Creating a test for verifying configuration parsing feature. The
test is created by reusing already present inotify_irmap test.

Because of addition of default configuration files, --no-default-config
option is added to zdtm.py to not break the test suite on systems with
these files present.

Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:44 +03:00
Michael Holzheu
7e01425766 s390: Fix clone() syscall parameters for s390
On s390 the first two paramters are swapped because we use
the CONFIG_CLONE_BACKWARDS2 kernel config option.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:44 +03:00
Kirill Tkhai
627ca7d13d zdtm: Add SIGCHLD flag to userns-leaked-sock test
wait() waits children created using SIGCHLD signal only.
Add it.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:44 +03:00
Dmitry Safonov
7d5ac8338d zdtm: Add infop to waitid() in pidns0{2,3}
As said in man page:
> The application shall ensure that the infop argument
> points to a siginfo_t structure.

While x86_64 ignores NULL, ia32 syscall returns error:
Test output: ================================
20:52:47.176:     4: FAIL: pidns02.c:158: Can't wait (errno = 14 (Bad address))
20:52:47.177:     4: FAIL: pidns02.c:183: Test failed (errno = 14 (Bad address))
20:52:47.177:     3: ERR: test.c:228: Test exited unexpectedly with code 255
 <<< ================================

Test output: ================================
20:53:27.835:     1: FAIL: pidns03.c:119: Can't wait (errno = 14 (Bad address))
20:53:28.207:     4: FAIL: pidns03.c:201: Can't wait or bad status: errno=0, status=32512 (errno = 0 (Success))
 <<< ================================

Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:44 +03:00
Kirill Tkhai
8df85f8c51 compel, x86_64: Fix sys_clone() definition
Commit 37e4c7bfc264 fixed arm, ppc, x86 (32bit),
while it made wrong definition of x86_64. Fix that.

Also, add commentary to raw fork() implementation.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:44 +03:00
Adrian Reber
4864af0d91 zdtm: also dump and restore tests with --check-only
This adds the option '--check-only' to zdtm.py. If specified each test
cases is first dumped with the '--check-only' option enabled before the
real dump. Also during restore the test case is first restored with
--check-only before doing the real restore.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:29:42 +03:00
Adrian Reber
bab458b0d6 zdtm: call getpid() during gone if pid is zero
If calling gone() without ever calling getpid() before leads to
backtrace. Just call getpid() to avoid that.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:57 +03:00
Adrian Reber
59d18c8028 zdtm: add reset_pid() function
In preparation for the zdtm option '--check-only' a new helper function
reset_pid() is added which writes to ns_last_pid to avoid PID collisions
during check-only restore and the real restore.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:57 +03:00
Kirill Tkhai
cd16b9c687 zdtm: Add userns-leaked-sock test
1)Create a socket, bind it, then create a child in lower user, pid and net ns.
2)Close socket in parent
3)After signal, check that child can create the socket with the same name.
  (It must, as it's in another net namespace).

v2: Add uid/gid mapping.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Kirill Tkhai
02fcb99c39 zdtm: Add SIGCHLD to clone flags in pidns01
Plain wait() waits only children created with SIGCHLD flag.
Add it.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Andrei Vagin
d8d3d8d81f zdtm: pidns03: Wait till child dead
Wait child before daemonization to do not allow
zdtm.py to see child fds and maps before it
becomes zombie.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Kirill Tkhai
662ca6ba95 zdtm: pidns02: Wait till child dead
Wait child before daemonization to do not allow
zdtm.py to see child fds and maps before it
becomes zombie.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Pavel Tikhomirov
0020399593 zdtm: test for new init reparent handling with tricky setns
Session 15's(20) leader is in first pidns, one it's process is in
second pidns and one is
in the third. So we create two helpers here for each aditional
pidns.

(It is critical that

Full test now looks like (mind pids here are different(real) from
their id's in source code e.g. 15 is 20 here):
      (pid,ppid,sid)
session04(1, 0, 1)───session04(4, 1, 4)───session04(5, 4, 4)───session04(6, 5, 6,pid1)─┬─session04(8, 6, 8)───session04(9, 8, 7)
                                                                                       ├─session04(10, 6, 6)───session04(11, 10, 11)
                                                                                       ├─session04(13, 6, 13)───session04(14, 13, 11)
                                                                                       ├─session04(15, 6, 15)
                                                                                       ├─session04(17, 6, 17)─┬─session04(18, 17, 15)
                                                                                       │                      └─session04(19, 17, 17,pid2)───session04(22, 19, 20)
                                                                                       ├─session04(20, 6, 20)
                                                                                       └─session04(23, 6, 6,pid3)───session04(25, 23, 20)

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Pavel Tikhomirov
55cd96cfd6 zdtm: test for new init reparent handling with nested pidns
Demand ns_pid, ns_get_userns and ns_get_parent features, else will
have "Can't do ns ioctl" error in criu:set_ns_opt().

v2:remove unused variable i in cleanup
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Pavel Tikhomirov
1d2955c039 zdtm: add test for new init reparent handling
Before "pstree: rework init reparent handling for pid namespaces" patch
we would get:

$ ./test/zdtm.py run -t zdtm/static/session01

=== Run 1/1 ================ zdtm/static/session01

======================= Run zdtm/static/session01 in ns ========================
Start test
./session01 --pidfile=session01.pid --outfile=session01.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/session01/31/1/restore.log
------------------------ grep Error ------------------------
(00.001103) 8 was born with sid 4
(00.001105) 7 was born with sid 4
(00.001106) 21 was born with sid 17
(00.001108) 1 was born with sid 17
(00.001109) Error (criu/pstree.c:1005): Can't find a session leader for 17
------------------------ ERROR OVER ------------------------

Corresponding tree before dump:
(combined 'pstree -pS 1' and 'ps axf -o pid,ppid,sid')

session01(1, 0, 1)─┬─session01(3, 1, 1)───session01(4, 3, 4)─┬─session01(5, 4, 5)─┬─session01(23, 5, 5)
                   │                                         │                    ├─session01(24, 5, 5)
                   │                                         │                    └─session01(26, 5, 5)
                   │                                         ├─session01(6, 4, 4)
                   │                                         ├─session01(7, 4, 7)───session01(16, 7, 4)
                   │                                         └─session01(8, 4, 8)───session01(15, 8, 15)───session01(20, 15, 4)
                   ├─session01(12, 1, 12)───session01(17, 12, 17)───session01(18, 17, 18)───session01(27, 18, 4)
                   ├─session01(13, 1, 10)
                   ├─session01(14, 1, 4)
                   └─session01(21, 1, 21)───session01(22, 21, 17)

22 can not restore as it needs session 17, but 17-th's leader is not in
ancestors(21 had been reparented from 17; 12, 13 an 14 from 4).

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:56 +03:00
Kirill Tkhai
02deb233ae zdtm: Add pidns03 test
Create a child in new pid_ns; then the child creats thread and zombie.
Zombie is in the second created new pid_ns. Then the great parent
setns() to its active pid_ns. So, lets draw the table:

                    pid_ns vs pid_for_children_ns
great parent:       equal
child:              not equal
child thread:       equal
grand child zombie: zombies don't have pid_for_children_ns

After signal chech that everything remains the same.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:28:55 +03:00
Kirill Tkhai
17b6de792d zdtm: Add pidns02 test (test on zombies)
1)Create a pid namespace and child reaper in it;
2)Set a specific next pid for future created process;
3)Create one more process in the namespace and kill it;
4)Wait for signal
5)Check, that NSpids of dead task remains the same.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:26:44 +03:00
Kirill Tkhai
d82cd43b78 zdtm: Make possible to claim for features list
Currently, one feature is supported. Add possibility
for a test to depend on several features.

v2: Delete excess "if" as suggested by Andrey Vagin.
    Rename variables to decrise patch size.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:26:43 +03:00
Kirill Tkhai
e997d34b0c criu: Add raw fork() implementation
Glibc has BUG with process creation:
https://sourceware.org/bugzilla/show_bug.cgi?id=21386

It doesn't behave well when parent and child are from
different pid namespaces and have the same pid.

Use raw syscall without glibc's asserts as workaround.

Also, use raw syscall for getpid() in tests too,
as these two function go in the pair (glibc's getpid()
relies on glibc's fork()).

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:59 +03:00
Kirill Tkhai
fce6be3c9b zdtm: Mark ns tests as auto
Check the features and delete "noauto".

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:31 +03:00
Kirill Tkhai
c739646659 zdtm: Fixup netns_sub_veth test hang
This patch fixes the test hang, which happens in my envinronment.

==================== Run zdtm/static/netns_sub_veth in uns =====================
Start test
Test is SUID
./netns_sub_veth --pidfile=netns_sub_veth.pid --outfile=netns_sub_veth.out

==== ALARM ====
  PID TTY      STAT   TIME COMMAND
 1991 ?        Ssl    0:40  \_ /usr/lib/gnome-terminal/gnome-terminal-server
 2124 pts/1    Ss+    0:00  |   \_ bash
 2416 pts/2    Ss+    0:00  |   \_ bash
 4064 pts/4    Ss     0:00  |   \_ bash
 4075 pts/4    S      0:00  |   |   \_ su
 4085 pts/4    S      0:00  |   |       \_ bash
 1556 pts/4    S+     0:00  |   |           \_ python2 ./test/zdtm.py run -t zdtm/static/netns_sub_veth
 1590 pts/4    S+     0:00  |   |               \_ ./zdtm_ct zdtm.py
 1605 pts/4    S+     0:00  |   |               |   \_ python2 zdtm.py
 1616 pts/4    S+     0:00  |   |               |       \_ python2 zdtm.py
 1960 pts/4    S+     0:00  |   |               |           \_ make --no-print-directory -C zdtm/static netns_sub_veth.pid
 1969 pts/4    S+     0:00  |   |               |               \_ ./netns_sub_veth --pidfile=netns_sub_veth.pid --outfile=netns_sub_veth.out
 1970 ?        Ss     0:00  |   |               |                   \_ ./netns_sub_veth --pidfile=netns_sub_veth.pid --outfile=netns_sub_veth.
 1973 ?        S      0:00  |   |               |                       \_ ./netns_sub_veth --pidfile=netns_sub_veth.pid --outfile=netns_sub_v
 1974 ?        Ss     0:00  |   |               |                           \_ ./netns_sub_veth --pidfile=netns_sub_veth.pid --outfile=netns_s
 1975 ?        Z      0:00  |   |               |                               \_ [netns_sub_veth] <defunct>
 1979 pts/4    R+     0:00  |   |               \_ ps axf

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:31 +03:00
Kirill Tkhai
e299352705 zdtm: Return tun test back as "auto"
After last patches for net ns the test works again (as envinronment changed),
so return it back.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:31 +03:00
Kirill Tkhai
27b6096cd8 zdtm: Add pidns01 test
Check that a pid_ns create with custom user_ns is restore right:

parent (pid_ns1, user_ns1)
  |
  v
child  (pid_ns2, user_ns2)

pid_ns1 (of user_ns1)
  |
  v
pid_ns2 (of user_ns2)

user_ns1
  |
  v
user_ns2

v3: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:30 +03:00
Kirill Tkhai
80f23b436e zdtm: Add pidns00 test
Create parent (P) and its three children (C1, C2 and C3)
with different pid namespaces:

	     P (pid_ns1)
	    /|\
	   / | \
	  /  |  \
	 /   |   \
	/    |    \
(pid_ns1) C1     C2    C3 (pid_ns1)
	 (pid_ns2)

where pid_ns1 is a parent of pid_ns2:

	   pid_ns1
	      |
	   pid_ns2

Children C1, C2 and C3 created in the written order,
i.e. C1 has the smallest pid and C2 has the biggest.

After receiving signal check, that pid namespaces
restored right.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:30 +03:00
Kirill Tkhai
9c7195ff39 ns: Do not change net_ns in prepare_net_namespaces()
In next patches usernsd will need to create transport
socket in the same net_ns as other tasks do their
TRANSPORT_FD_OFF sockets.

Choose criu net_ns for that: this allows usernsd
to do not wait for creation of other net_ns, i.e.
to do not introduce new dependencies between tasks.

In case of (root_ns_mask & CLONE_NEWUSER) != 0
root_item's user_ns does not allow to restore criu net_ns,
so do prepare_net_namespaces() in sub-process to do not
lose criu net.

v3: Introduce __prepare_net_namespaces and execute it in cloned task.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:24:29 +03:00
Dmitry Safonov
f456c6bd17 zdtm: rely on -D_GNU_SOURCE passed from Makefiles
After the commit
  02c763939c10 ("test/zdtm: unify common code")

CFLAGS with -D_GNU_SOURCE defined in the top Makefile
are being passed to tests Makefiles.
As _GNU_SOURCE is also defined by tests, that resulted in
zdtm tests build failures:

  make[2]: Entering directory `/home/criu/test/zdtm/lib'
   CC        test.o
  test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
   #define _GNU_SOURCE
   ^
  <command-line>:0:0: note: this is the location of the previous definition
  cc1: all warnings being treated as errors
  make[2]: *** [test.o] Error 1

However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't
do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`.
By calling middle makefile this way, it doesn't have _GNU_SOURCE in
CFLAGS from top-Makefile.

I think the right thing to do here - is following CRIU's way:
rely on definition of _GNU_SOURCE by Makefiles.

This patch is almost fully generated with
  find test/zdtm/ -name '*.c' -type f					\
     -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \;		\
     -exec sed -i '/define _GNU_SOURCE/d' '{}' \;

With an exception for adding -D_GNU_SOURCE in tests Makefile.inc for
keeping the same behaviour for zdtm.py.
Also changed utsname.c to use utsname::domainname, rather private
utsname::__domainname, as now it's uncovered (from sys/utsname.h):
> struct utsname
>  {
...
> # ifdef __USE_GNU
>     char domainname[_UTSNAME_DOMAIN_LENGTH];
> # else
>     char __domainname[_UTSNAME_DOMAIN_LENGTH];
> # endif

Reported-by: Adrian Reber <areber@redhat.com>
Cc: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:16 +03:00
Kirill Tkhai
d9a785adbb zdtm: Add proc-self01 test
Check, that fdstore-keeped user ns files are opened
correct after restore.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:16 +03:00
Andrei Vagin
9fb0bd805e test: check veth devices from two network namespaces
We shave a test case for external veth devices. This test case
checks veth devices which are living in two dumped network
namespaces.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:16 +03:00
Andrei Vagin
e84540e1f1 zdtm: show a process tree if a test doesn't show signs of life
Call "ps axf" if waitpid() is running more than 10 seconds

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:15 +03:00
Kirill Tkhai
96cbd9f5bd zdtm: Add userns02 test
Differs to userns01 test by unsharing net net in child.
This should test nested user/net ns interaction.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:15 +03:00
Kirill Tkhai
c5435791b9 zdtm: Check for fsuid and fsgid in userns01 test
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:14 +03:00
Kirill Tkhai
67f9aef330 zdtm: Check for euid, suid, egid and sgid in userns01 test
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:14 +03:00
Kirill Tkhai
da9367188b zdtm: Check for groups list userns01 test
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:14 +03:00
Kirill Tkhai
8ba659fec1 zdtm: Add userns01 test
Check UID and GID in unshared userns remains the same

v5: Use custom UID and GID.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:13 +03:00
Kirill Tkhai
b0af94ddf4 zdtm: Add userns00 test
Create two children, and unshare() user_ns in one of them (C1).
The second child creates one more process, which switches to C1's
namespace and unshares.

v4: Keep in mind the case, when readlink returns PATH_MAX-length string.
    Print full wait status instead of WEXITSTATUS().
v3: Unshare net ns in grand child

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-11-30 01:22:13 +03:00