2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

1777 Commits

Author SHA1 Message Date
Andrey Vagin
902f9f3c89 zdtm: fix awk script for Ubuntu
mawk doesn't handle '\<...\>'

Ubuntu:
$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
$ ldd /bin/ps
	linux-vdso.so.1 =>  (0x00007fffb290a000)
$ ldd /bin/ps  | awk '/\<linux-vdso\.so\>/ { print $1 }'
$ ldd /bin/ps  | awk '/linux-vdso\.so/ { print $1 }'
linux-vdso.so.1

Fedora:
$ ldd /bin/ps
	linux-vdso.so.1 =>  (0x00007fff61fcb000)
$ ldd /bin/ps  | awk '/\<linux-vdso\.so\>/ { print $1 }'
linux-vdso.so.1
$ awk --version
GNU Awk 4.1.1, API: 1.1

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-24 11:05:19 +03:00
Andrey Vagin
a2e0acfdcb cow01: try to read a page to take it from a swap
Vladimir said that a page can be unmapped from one process, but can be
mmaped in another one. In this case we can't understand whether both
processes link to the same page or they don't.

So we can try read both pages to take them from swap.

Cc: Vladimir Davydov <vdavydov@parallels.com>
Reported-by: Parallels' QA
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-24 10:59:50 +03:00
Andrey Vagin
bda4dfd173 test: add cow01 into TEST_SUID_LIST
cow01 uses /proc/pid/pagemap which has been protected by
CAP_SYS_ADMIN.

"""
	commit	ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce
	pagemap: do not leak physical addresses to non-privileged userspace

	As pointed by recent post[1] on exploiting DRAM physical imperfection,
	/proc/PID/pagemap exposes sensitive information which can be used to do
	attacks.
"""

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-23 17:42:03 +03:00
Kirill Tkhai
83f7e667d9 tests: Add more debug info to caps00 test
Print all cap values in case of test is failed.
Also check for capset() and capsget() return values.

Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-18 22:41:11 +03:00
Cyrill Gorcunov
0328d33e62 test: posix_timers -- Beautify code and output
- easier to read @posix_timers
 - more verbose logging is convernient for handling errors

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-04 17:49:29 +03:00
Andrey Vagin
6c6854b5e9 zdtm: add debug to investigate fails of maps007
Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-27 16:29:36 +03:00
Andrey Vagin
1d7ed7dfab zdtm: set ZDTM_NOSUBNS when a specified test is executed
Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-25 18:40:19 +03:00
Pavel Emelyanov
90b2c9b472 zdtm: Print /proc/locks in lock tests to investigate random failures
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-25 11:46:46 +03:00
Andrey Vagin
9fa75831c7 zdtm: don't use sleep for synchronization in zombie00
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-25 11:13:28 +03:00
Andrey Vagin
2ecc25ef5e zdtm: clean a test root before executing tests in userns
A tests is executed from different users in cases with and without
userns, so it can't to open files which were created before.

Here is an example for ns/user/static/inotify_irmap:
13355 mkdir("/etc", 0600)               = -1 EEXIST (File exists)
13355 unlink("/etc/zdtm-test")          = -1 EACCES (Permission denied)
13355 creat("/etc/zdtm-test", 0600)     = -1 EACCES (Permission denied)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-19 23:15:10 +03:00
Andrey Vagin
9b600167a5 zdtm: don't execute ns/ and ns/user tests simultaneously
One test can't be execute as ns/test ans ns/user/test
simultaneously, because they use the same file tree

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-19 23:14:59 +03:00
Andrey Vagin
603929cad7 zdtm: print correct errno messages from err() and fail()
"%m" can't be used to print strerror(errno), because test_msg()
calls gettimeofday() which can overwrite errno.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-13 15:15:05 +03:00
Andrey Vagin
55a7c7a79d test: check descriptors and maps for static tests
tname doesn't contain a test type.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-13 15:14:56 +03:00
Pavel Emelyanov
9a392dff3a reg-files: Do not try to linkat with wrong user
We link files to each other at restore time to restore
unlinked paths. Kernel has strange secutiry restrictions
about linkat we use. If the fsuid of the caller doesn't
equals the uid of the file and the file is not "safe"
one, then only global CAP_CHOWN will be allowed to link().

This brings problems in user namespaces -- uns root is
not allowed to linkat any file, unlike global root.

Fortunately, we can change the fsuid temporarily and
still linkat the file we want. Hopefully this hack will
go away some day soon, when the kernel will have saner
checks for linkat capabilities.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2015-02-13 16:11:38 +04:00
Pavel Emelyanov
ba66b14b9a packet: Get packet_sock_mmap test work in userns
The test uses map_files dir to check for mapping being restored,
while this proc directory is only available for CAP_SYS_ADMIN.

Fix this by checking less strict /proc/pid/maps.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-13 16:11:38 +04:00
Pavel Emelyanov
364979159f zdtm: Run "ip link set up" after becoming userns root
This allows excluding more userns tests from blacklist.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2015-02-13 16:11:38 +04:00
Pavel Emelyanov
cdb3684834 zdtm: Exclude from blacklist some tests that now work in userns
The rest partially need more userns_call-s but mostly just don't
work in userns themselves. Need further investigation.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2015-02-13 16:11:38 +04:00
Ruslan Kuprieiev
1842e1e0ea test: crit: use --pretty instead of dropped --format
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-02-09 14:06:38 +03:00
Pavel Emelyanov
46b7f13cf2 zdtm: Ability to run tests starting from a specified one
Can be useful to re-run some tests in case smth failed in the middle

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2015-01-29 18:45:24 +03:00
Pavel Emelyanov
8076c4580b check: Do not print "Looks good" message regardless of loglevel
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:16:01 +03:00
Ruslan Kuprieiev
d1d4c018e0 test: rpc: run test as a non-root user
It is nice to have non-root user case covered with tests.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:08:14 +03:00
Ruslan Kuprieiev
4d705e7200 test: crit: enhance test process
Use mature technics to organize test process.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:07:49 +03:00
Ruslan Kuprieiev
fe6255c2c6 test:rpc: add generated files to gitignore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:06:19 +03:00
Ruslan Kuprieiev
bb96d80fde test:crit: do cleanup before generating new images
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:05:43 +03:00
Andrey Vagin
7352e104de zdtm/maps007: wait MAX_DELTA operations before daemonizing
We suppose that the test is not able to exit before this moment.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-27 16:05:06 +03:00
Konstantin Khorenko
1f3b76b07a test/*/Makefile: remove bash-isms in loops
Need to make it working in Debian where "dash" is default.

Signed-off-by: Konstantin Khorenko <khorenko@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-26 20:13:20 +03:00
Andrey Vagin
71f5542e00 test/Makefile: clean zdtm-tst-list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 15:40:25 +03:00
Andrey Vagin
34cb2d23f2 zdtm: define _GNU_SOURCE for zdtm_ct
zdtm_ct.c:19:14: error: ‘CLONE_NEWNS’ undeclared (first use in this function)
  if (unshare(CLONE_NEWNS | CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWIPC))

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 15:40:12 +03:00
Andrey Vagin
cb3984844b zdtm.sh: don't generate a test list if a test is specified
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 14:47:33 +03:00
Andrey Vagin
e636a226c8 zdtm.sh: add ns/static/aio00, ns/static/timerfd
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 14:47:32 +03:00
Andrey Vagin
ca97fed57b zdtm: generate a test list only once
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 14:46:29 +03:00
Andrey Vagin
2a8ab28924 zdtm.sh: don't add static/aio00 twice
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 14:44:59 +03:00
Andrey Vagin
ba4713d383 zdtm.sh: don't allow anyone to print on stdout
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-23 14:44:53 +03:00
Andrey Vagin
f3bf749b2b test: add the crit test in the test list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 18:59:11 +03:00
Andrey Vagin
63cb8b4da8 zdtm/maps007: fix a race condition
If shm->delta = MAX_DELTA and we set shm->stop to 1, the child can exit
before the parent adds MAX_DELTA to shm->delta.

parent			child
shm->stop = 1
			if (shm->stop == 1 && shm->delta == MAX_DELTA)
				break
shm->delta += MAX_DELTA

Cc: Konstantin Neumoin <kneumoin@parallels.com>
Reported-by: Konstantin Neumoin <kneumoin@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 18:56:30 +03:00
Pavel Emelyanov
b99fbf66fb check/zdtm: Check userns feature in criu
This is the continuation -- check relevant userns features in criu check.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 18:55:35 +03:00
Pavel Emelyanov
0749ef23e9 check/zdtm: Introduce fine-grained feature testing
Right now we state that CRIU works on 3.11 and above kernels and, at the
same time, have support for a couple of new features like aio, tun, timerfd
etc. available in later kernels. Since these new features do not break
generic operations we do not require them in the kernel strictly.

However, in the zdtm tests it's very important to know exactly what can
and what cannot be tested. Right now this is done in a tough manner -- if
the kernel is not 3.11 or criu check fails for _any_ reason we treat the
kernel as being "bad" and throw out a set of tests.

I propose to test some individual features and form the list of tests
in a more fine-grained manner.

This patch only fixes the AIO, mnt_id, tun and posix-timers tests. Next
I will add checks and fixes for user-namespaces tests.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2015-01-22 18:55:34 +03:00
Ruslan Kuprieiev
f977a9a9f7 test: crit: use --format hex
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:58 +04:00
Ruslan Kuprieiev
9761dc3a70 test: crit: use decode/encode instead of convert
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:47 +04:00
Ruslan Kuprieiev
12db8f23f5 test: add crit test
Test steps:
1) generate img files by dumping loop.sh
2) convert img files to json files
3) convert json files to img files
4) cmp original and produces img files

It also uses i/o redirection and --format nice options to
check if they work properly.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:50 +04:00
Ruslan Kuprieiev
0c366dd887 zdtm: git: add some test binaries to gitignore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:48:05 +03:00
Andrew Vagin
769d527876 tests: add libaio to LDLIBS
Reported-by: Mr Travis
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 19:59:19 +03:00
Andrey Vagin
f42ba40f27 jenkins: exclude maps04 from the criu-iter job
This job does three iterations. We need to write about 0.5Gb of images
for maps04.  This is too much for our test VM and other tests start fail
due to timeout.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:17:00 +03:00
Pavel Emelyanov
bbc38f3dac zdtm: Simple test for AIO ring
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:44 +03:00
Andrey Vagin
2fd795b61c zdtm/cwd02: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Mr Jenkins
Fixes: 7dbd38dbc939 ("zdtm: set additional groups along with uids and gids")
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-25 21:10:58 +03:00
Andrew Vagin
f4282b478a zdtm/cwd01: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Mr Jenkins
Fixes: 7dbd38dbc939 ("zdtm: set additional groups along with uids and gids")
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-24 19:15:04 +03:00
Andrey Vagin
18d40fddd6 zdtm.sh: set correct path for dump files (v3)
Don't use an uninitialized variable to create a path pattern.

v2: fix the comment
v3: don't use readlink -m, which isn't supported by busybox

Cc: Christopher Covington <cov@codeaurora.org>
Reported-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-24 19:13:17 +03:00
Andrew Vagin
fa992b9d6a zdtm: execute mntns_root_bind only if mnt_id is shown
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:40:53 +03:00
Ruslan Kuprieiev
2802618efa test:libcriu: add cr_errno test
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:39:00 +03:00
Ruslan Kuprieiev
8cba5a16dd test: rpc: cr_errno, v3
Lets simulate some errors and check what
error will be returned by service.

v2, fix tests accordingly to new errorlist
v3, fix tests accordingly to new errorlist, again

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:38:46 +03:00