[root@fc24 criu]# python test/zdtm.py run -t zdtm/transition/shmem --pre 3
=== Run 1/1 ================
======================== Run zdtm/transition/shmem in h ========================
cc -g -O2 -Wall -Werror -fno-strict-aliasing -iquote ../lib/arch/x86/include -I../lib shmem.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o shmem
Start test
./shmem --pidfile=shmem.pid --outfile=shmem.out
Run criu pre-dump
Run criu pre-dump
Run criu pre-dump
Run criu dump
Run criu restore
Send the 15 signal to 33
Wait for zdtm/transition/shmem(33) to die for 0.100000
Test output: ================================
15:12:25.444: 33: FAIL: shmem.c:70: checksum mismatch: ea71000 109c9000
Cc: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
To mimic the environment that systemd is in when it causes the problem, we
preserve a prefix cgroup path across checkpoint and restore which the tasks
live below, and then we open a fd to this path. Without
--cgroup-root /prefix on dump, this test fails:
(00.030429) 32: Error (criu/files-reg.c:1487): File home/ubuntu/criu/test/zdtm/static/cgroup02.test/zdtmtst/prefix has bad mode 040600 (expect 040777)
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In commit 07d259f365f2 ("cgroup: support --cgroup-root on dump too")
criu starts to understand --cgroup-root option on dump, but our
cgroup02 test in cgroup02.desc file sets these opt to /newroot
unintentionaly, as on dump we don't have /newroot dump fails:
https://ci.openvz.org/job/CRIU/job/CRIU-x86_64/branch/criu-dev/989
======================== Run zdtm/static/cgroup02 in h
=========================
Start test
Test is SUID
./cgroup02 --pidfile=cgroup02.pid --outfile=cgroup02.out
--dirname=cgroup02.test
Run criu dump
=[log]=> dump/zdtm/static/cgroup02/30/1/dump.log
------------------------ grep Error ------------------------
(00.023103) Error (criu/cgroup.c:620): cg: failed walking
/proc/self/fd/10/newroot for empty cgroups: No such file or directory
(00.023129) Error (criu/cr-dump.c:1359): Dump core (pid: 30) failed with
-1
(00.023944) Error (criu/cr-dump.c:1675): Dumping FAILED.
------------------------ ERROR OVER ------------------------
So fix this by using restore-only ropts instead of opts.
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: add cgroup04.hook which removes the cgroups in between, so things are
actually restored :)
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Before this patch vma sizes were hardcoded and weren't derived
from PAGE_SIZE value.
But all the actions with these vmas are based on PAGE_SIZE value.
That's why maps008 on PowerPC with "huge" PAGE_SIZE of 64k was simply
terminating due to invalid memory access.
This commit sets vma sizes to safe values derived from PAGE_SIZE.
New sizes are enough to perform all the actions test does with vmas.
Tested-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Fixes:
cow01.c: In function 'parent_check':
../lib/zdtmtst.h:120:11: error: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", \
^
cow01.c:287:5: note: in expansion of macro 'fail'
fail("%s[%#x]: %p is not COW-ed (pagemap of "
^~~~
In file included from inotify_system.c:14:0:
inotify_system.c: In function 'read_set':
../lib/zdtmtst.h:117:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Werror=form
at=]
test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
^
inotify_system.c:299:3: note: in expansion of macro 'pr_perror'
pr_perror("read(%d, buf, %lu) Failed, errno=%d",
^~~~~~~~~
deleted_dev.c:53:36: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type '__dev_t {aka long long unsigned
int}' [-Werror=format=]
test_msg("mode %x want %x, dev %lx want %lx\n",
^
deleted_dev.c:53:45: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'dev_t {aka long long unsigned i
nt}' [-Werror=format=]
test_msg("mode %x want %x, dev %lx want %lx\n",
^
../lib/zdtmtst.h:117:11: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'off64_t {aka long long int
' [-Werror=format=]
test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
^
Nothing really interesting, but printings with right format specifier.
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Fixes:
maps03.c: In function 'main':
maps03.c:15:32: error: result of '10l << 30' requires 35 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
mem = (void *)mmap(NULL, (10L << 30), PROT_READ | PROT_WRITE,
^~
maps03.c:22:9: error: result of '4l << 30' requires 34 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
mem[4L << 30] = 1;
^~
maps03.c:23:9: error: result of '8l << 30' requires 35 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
mem[8L << 30] = 2;
^~
maps03.c:30:13: error: result of '4l << 30' requires 34 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
if (mem[4L << 30] != 1 || mem[8L << 30] != 2) {
^~
maps03.c:30:35: error: result of '8l << 30' requires 35 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
if (mem[4L << 30] != 1 || mem[8L << 30] != 2) {
^~
Proceses virtual address space is smaller than 4Gb - omit this test for
those archs.
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This files are used by zdtm.sh. zdtm.py uses *.desc files.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Running test/zdtm.py run -t zdtm/transition/maps008 --snap --pre 30
in a loop I got test failure with "Mem differs"
error each ~20 minutes. The cause of the bug is in lack of
synchronization between processes that still do datagen stage of
test and processes that already do datacheck stage of test.
As a result we can get "Mem differs" error if:
1. Process P1 being on datacheck stage fetches a byte with
offset X from ashmem vma VMA1 into CPU register.
2. Process P2 still being on datagen stage changes byte with offset X
in the same ashmem vma VMA1.
3. Process P1 fetches byte with offset X from another ashmem vma VMA2
mapped to the same physical memory as VMA1.
4. Process P1 compares two fetched bytes and finds out that they
have different values.
5. Process P1 reports "Mem differs" error.
Race is fixed by waiting for all processes to exit datagen stage
before proceeding to datacheck stage.
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Here is a race when someone umounted something and this operation
isn't propagated into our namespace.
CRIU | Another process
-----------------------------------------------------------------
pivot_root(".", put_root) |
mount(put_root, MS_REC|MS_PRIVATE) |
| umount /xxx/yyy
| umount /xxx -> EBUSY
umount(put_root)
We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.
Reported-by: Mr Travis
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It can hapen in tty tests, where we get SIGHUP.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
as these sysctls can not be set to -1(default) leave them uninitialized
sometimes
https://jira.sw.ru/browse/PSBM-48397
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Main test features:
- Non trivial ps tree with non trivial anon shmem regions
(no such test exists now).
- Each ps tree process continuously writes parts of anon shmem
vmas and validates these writes after restore
(required for dedup testing).
- Checking simultaneous changing of anon shmem contents in different
processes.
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It's what we have when ReadOnlyDirectories=/ is set for systemd services.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
...and fix misprints that weren't caught before.
I guess, I never fixed that much (possible) bugs by one commit, heh.
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Currently during criu dump we create link remap in the same dir
where original file was opened. But that dir may not exist during
link remap creation. At the same time it's okay to create link
remap in any dir on the same mount point.
In this patch we do this. We check existance of every dir bottom
up through the original file path. We use the first existing dir.
Similar approach is used on criu restore during ghost file creation.
Signed-off-by: Egor Gorbunov <egor-mailbox@ya.ru>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: drop /bin/ps from test deps
v3: wait for the zombie to make sure it exits
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In the next patch, we'll introduce an option to allow for leaving zombie
processes in the pid ns for the test so that we can test the behavior of
zombies. Let's not reap everything after restore, since we'll reap the
restored zombies as well.
v2: restore the old behavior when in reap mode
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We'll use this variable in the next test to make sure the test suite
doesn't accidentally reap the zombie we want to leave around for the actual
test.
This is kind of ugly and there might be a better way to pass information to
the test's init, I'm open for suggestions :)
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
and move fs.mqueue.xxx from get_shared_memory_info to get_messages_info
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The directory that the tests run in on jenkins is:
/var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static
which makes the whole path too long. This commit makes the whole path:
/var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static/del_standalone_un.test/sock
which is 105 chars, less than 108 of sun_path.
Closes#191
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It's quite boring to add your test to .gitignore and one may forget
to do that boilerplate -- put this labour on computer.
For that I make real targets for tests instead of implicit and
add test's binary name to .gitignore on make stage.
Also added *.pidns to .gitignore -- do not wanna do this as separate
trivial patch.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
static/transition tests are built with implicit rules.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: open two sockets, one "on top" of the other
v3: also drop unnecessary unlink(), we can just rely on rename()
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
/proc/locks is racy with adding/removing locks,
so we may lose lock on check.
Use fdinfo's list of locks instead.
v2: Feature 'fdinfo_lock'
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Hopefully this would/will trigger more of these types of bugs; I took this
list straight from Adrian's report.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Adrian Reber <adrian@lisas.de>
Tested-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
--link-remap opt is obligatory for unlink_regular00 test.
Without it CRIU dump will fail because it won't be able to
create link remaps.
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
this avoids:
===================== Run zdtm/static/socket-tcpbuf6 in h ======================
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
Start test
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
./socket-tcpbuf6 --pidfile=socket-tcpbuf6.pid --outfile=socket-tcpbuf6.out
Run criu dump
Run criu restore
Wait for zdtm/static/socket-tcpbuf6 to die for 0.100000
Wait for zdtm/static/socket-tcpbuf6 to die for 0.200000
Removing dump/zdtm/static/socket-tcpbuf6/27
===================== Test zdtm/static/socket-tcpbuf6 PASS =====================
in every test.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
1) Support autofs kernel-user exchange protocol
2) Test mounts: direct, indirect, offset (?) (migrated and operational).
3) Test cases, when write end of the pipe is closed, and when it's not.
4) Test catatonic mounts.
5) Test nested mounts are migrated (tmpfs suits it good)
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It uses --manage-cgroup full and can dump and restore cgroup of other tests.
Reported-by: Mr Jenkins
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
1. First save/check all,default,lo together and only after - set them,
as setting some sysctls can affect the others
2. Set "accept_redirects" after "forwarding" both for ipv4 and ipv6
3. Change order to "all", "default", "lo"
*One can not set ipv6.conf.all.stable_secret, so don't even try, see:
commit 622c81d57b39 ("ipv6: generation of stable privacy addresses for
link-local and autoconf")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
An oddity (bug?) means that we don't preserve empty cgroups in in the criu
cgset, since we don't dump it. So we do need to move things into tasks.
(This probably got commented out due to a bug in the Ubuntu kernel that I
ran across [1] which should be fixed shortly :)
[1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1588056
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Because we're doing this on the same host, the cgroups will already exist.
We need to write the properties in full mode to exercise these cases.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
======================= Run zdtm/static/socket_aio in h ========================
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
Start test
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
./socket_aio --pidfile=socket_aio.pid --outfile=socket_aio.out
Run criu dump
=[log]=> dump/zdtm/static/socket_aio/24/1/dump.log
------------------------ grep Error ------------------------
(00.003450) Error (util.c:665): exited, status=3
(00.009104) Error (util.c:665): exited, status=3
(00.024564) Error (util.c:665): exited, status=3
(00.024598) Error (netfilter.c:88): Iptables configuration failed: Success
(00.024625) Error (cr-dump.c:1297): Dump files (pid: 24) failed with -1
(00.025117) Error (cr-dump.c:1605): Dumping FAILED.
------------------------ ERROR OVER ------------------------
Wait for zdtm/static/socket_aio to die for 0.100000
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Makefile:305: warning: overriding recipe for target 'shm-unaligned.pid'
Makefile:290: warning: ignoring old recipe for target 'shm-unaligned.pid'
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CRIU dump should fail if criu can't handle something.
v2: add a separate patch to remove noauto for a few tests
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Looks like noauto was set by mistake for these tests
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The s_dev as well as mnt_id may change during container
migration, so exclude them from the comparision.
Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It can be dead-lokced:
#0 0x00007fafbf49f6ac in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007fafbf44af1c in _L_lock_2460 () from /lib64/libc.so.6
#2 0x00007fafbf44ad57 in __tz_convert () from /lib64/libc.so.6
#3 0x00000000004022e2 in test_msg (format=0x404508 "Receive signal %d\n") at msg.c:51
#4 <signal handler called>
#5 0x00007fafbf3f2483 in __GI__IO_vfscanf () from /lib64/libc.so.6
#6 0x00007fafbf408f27 in vsscanf () from /lib64/libc.so.6
#7 0x00007fafbf4032f7 in sscanf () from /lib64/libc.so.6
#8 0x00007fafbf449ba6 in __tzset_parse_tz () from /lib64/libc.so.6
#9 0x00007fafbf44c4cb in __tzfile_compute () from /lib64/libc.so.6
#10 0x00007fafbf44ae17 in __tz_convert () from /lib64/libc.so.6
#11 0x00000000004022e2 in test_msg (format=format@entry=0x40458c "PASS\n") at msg.c:51
#12 0x0000000000401ceb in main (argc=<optimized out>, argv=<optimized out>) at ptrace_sig.c:172
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Test should not assume that page size is 4096.
The test was failing on ppc64 where page size is usually 64K.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It's possible to create sysvshmem segment with size not being
multiple of page_size. And this very size will be reported
everywhere in the interfaces.
Support this type of segments too.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>