Commit graph

836 commits

Author SHA1 Message Date
Cyrill Gorcunov
6608402c97 zdtm: Don't modify global @errno in test_msg
This is logging routine, lets it not affect the global @errno.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-27 14:06:23 +03:00
Andrey Vagin
019ab4b795 test: check read-only bind-mounts
Here is a real example how it's used.

Cc:  Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-27 14:04:26 +03:00
Andrey Vagin
8329f06145 zdtm: suppress error messages if a cgroup holder exists
mkdir: cannot create directory ‘zdtm.mpAWGL/holder’: File exists

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-27 14:02:17 +03:00
Cyrill Gorcunov
6d30f4680b test: poll -- Move it out of namespace list
For some reason it returns ENOENT sometime
when run in namespace. Need to figure out
why. Disable it for a while to continue
testing the rest.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-26 14:13:27 +03:00
Andrey Vagin
4988a57981 test: create /etc in a temporary root
inotify_irmap creates files in /etc so it should be able to do
this from userns.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-26 14:12:08 +03:00
Andrey Vagin
81a4d3b2eb test: don't run cow01 in userns
/proc/pid/pagemap is protected by the global CAP_SYS_ADMIN, so
it can't be opened in a non-root userns.

00:34:48.260 Execute ns/user/static/cow01
...
00:34:48.260 12:37:03.951:     4: ERR: cow01.c:87: Unable to open child pagemap file /proc/5/pagemap (errno = 1 (Operation not permitted))

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-25 17:16:59 +03:00
Cyrill Gorcunov
089e81ac2f zdtm: test -- Add trivial poll() timeout test
The idea is simply make sure that timeour has not been
screwed during c/r cycle.

v2:
  - Drop unneeded early poll() call.
  - Make poll loop in cycle until caller passes c/r cycle.
v3:
  - Use test_go helper
  - Do poll in cycle

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-25 17:13:34 +03:00
Tycho Andersen
109ca471c4 fix error in tests when /bin/sh is not bash
== is a bashism, we should use = for /bin/sh; this prevents output like:

/home/ubuntu/criu/test/post-dump.sh: 3: [: post-dump: unexpected operator
/home/ubuntu/criu/test/post-dump.sh: 3: [: network-unlock: unexpected operator

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-24 11:24:02 +03:00
Andrey Vagin
9cabc3918a test: remove bashism from Makefile
* redirect both stdout and stderr
bash: >& and &>
dash: command > file 2>&1 or command 2>&1 | othercommand

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-24 11:05:26 +03:00
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