Commit graph

4948 commits

Author SHA1 Message Date
Ruslan Kuprieiev
c7c772f93e libcriu: add cr_errno support
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:38:52 +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
Pavel Emelyanov
6a6cdb8d4a proc: Drop always true last argument of parse_smaps()
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-12-22 13:52:03 +03:00
Pavel Emelyanov
5e99d708ca zdtm: test for packet socket mappings
It turned out we didn't have one, though recent 3.19-merge-window
kernel would crash on that test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-12-22 13:51:36 +03:00
Ruslan Kuprieiev
b30940eee2 cr_errno: move cr_err helpers into cr_errno.h
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:50:45 +03:00
Ruslan Kuprieiev
b58eb26fb2 service: add cr_errno to criu_resp and send cr_errno in it, v2
v2, set cr_errno only if we have one that is != 0

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:49:45 +03:00
Ruslan Kuprieiev
2d91ff5f2e tty:add comment explaining indices, v2
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:48:45 +03:00
Ruslan Kuprieiev
16a668e5d3 zdtm:tty:vt: add simple test
Inspired by static/console test.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:48:39 +03:00
Ruslan Kuprieiev
1ace257022 tty: add vt support, v2
/dev/ttyN are the virtual terminals which are provided
by the system with major 4 and minor 1..63.
You can run some program on ttyN by pressing alt+ctrl+FN
and running it manualy or by using open(openvt nowadays).

This patch also allows us to run all our tests from a vt.

v2, style fix + using linux/vt.h for constants

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:48:31 +03:00
Andrey Vagin
dfeccaddf7 zdtm: add a test to check non-root shared bind-mounts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:46:42 +03:00
Ruslan Kuprieiev
7dbd38dbc9 zdtm: set additional groups along with uids and gids
Currently zdtm doesn't set additional groups when running
tests. It sets uids and gids to some non-root values, but
additional groups remain untouched, which allows tests
to inherit groups list, which leads to different
behaviour depending on a way you run tests.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 19:11:53 +03:00
Ruslan Kuprieiev
8eaf0142ab cr-service: set cr_errno to EBADRQC if set_opts_from_req fails
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:59:28 +03:00
Ruslan Kuprieiev
e76749b790 cr-restore: set cr_error to EEXIST if such pid already exists, v3
This is a very common error when using criu.

The problem here is that we need to somehow transfer cr_errno
from one process to another. I suggest using pipe to give
one end to children and read cr_errno on other after restore
is finished.

v2, Pavel suggested putting errno into shared task_entries.
v3. and he also suggested using cmpxchg

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:59:17 +03:00
Ruslan Kuprieiev
b09a88b5f9 util: set cr_errno to ESRCH if no PID dir in proc
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:59:14 +03:00
Ruslan Kuprieiev
ef283e505c cr-errno: initial commit
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:58:46 +03:00
Ruslan Kuprieiev
2b2d6732cc cr-service: setup_opts_from_req: use single error exit point
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:57:56 +03:00
Nikolay Plotnik
0437606ecd Add root mount point of container as irmap hint
Some packages monitor the FS /.

(00.573051) irmap: Scanning /. hint
(00.573053) irmap: Stat for 110025: INO - 2891453, DEV - 64768
(00.573055) irmap: Refresh stat for /.
(00.573063) irmap: MNTNS_ROOT: 110025, PATH: /., INO: 2891453, DEV: 64768

Signed-off-by: Nikolay Plotnik <nikolay.plotnik@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:55:12 +03:00
Cyrill Gorcunov
1349619f83 test: posix_timers -- Don't fail on big @total_sleep_time if migrated, v2
In case if we're migrating to another node where @total_sleep_time
has a big value we might fail here because we don't support tracking
of @total_sleep_time at all, neither we can somehow restore it without
kernel patching (and it's hardly if ever be allowed in vanilla kernel).

Thus simply remember @total_sleep_time value before and after c/r stage
removing it from the computations.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:52:08 +03:00
Saied Kazemi
b2e6690409 Explain how an inherit fd can be reused.
Add comment to inherit_fd_reused() explaining how an inherit fd may be
closed or reused outside the inherit fd logic.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:50:39 +03:00
Andrey Vagin
4ea1eaa6cb pipe: increase the buffer size for pipe identifier
(00.312396)      4: Error (pipes.c:301): Not enough room for pipe 562178190 identifier string

Reported-by: Mr Jenkinks
Cc: Saied Kazemi <saied@google.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:33:01 +03:00
Pavel Emelyanov
ab2c1e426c proc_parse: Invert supported VMA check
It's for more natural adding of new else-if branch for aio.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-17 18:11:40 +03:00
Pavel Emelyanov
f408bc0331 log: Print vma status in dump logs
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-17 18:11:09 +03:00
Pavel Emelyanov
d4c62b6b5c proc_parse: Print vma start in hex
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-17 18:10:54 +03:00
Ruslan Kuprieiev
870bf2d5fd libcriu: print error if exec failed
Reported-by: Paschalis Mpeis <paschalis.mpeis@ed.ac.uk>
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-11 11:26:07 +03:00
Saied Kazemi
54081aff7b tests: Pipe.c Test Program
Hi Saied,

This patch adds your test in the criu test system.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 18:52:23 +03:00
Andrey Vagin
e12fd8f98e zdtm/cwd00: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Ruslan Kuprieiev <kupruser@gmail.com>
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:57:49 +03:00
Ruslan Kuprieiev
8f71344ce2 zdtm: add ip.dump and ip.rst to gitignore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:55:27 +03:00
Saied Kazemi
0412152fc5 Add inherit fd support
There are cases where a process's file descriptor cannot be restored
from the checkpoint images.  For example, a pipe file descriptor with
one end in the checkpointed process and the other end in a separate
process (that was not part of the checkpointed process tree) cannot be
restored because after checkpoint the pipe will be broken.

There are also cases where the user wants to use a new file during
restore instead of the original file at checkpoint time.  For example,
the user wants to change the log file of a process from /path/to/oldlog
to /path/to/newlog.

In these cases, criu's caller should set up a new file descriptor to be
inherited by the restored process and specify the file descriptor with the
--inherit-fd command line option.  The argument of --inherit-fd has the
format fd[%d]:%s, where %d tells criu which of its own file descriptors
to use for restoring the file identified by %s.

As a debugging aid, if the argument has the format debug[%d]:%s, it tells
criu to write out the string after colon to the file descriptor %d.  This
can be used, for example, as an easy way to leave a "restore marker"
in the output stream of the process.

It's important to note that inherit fd support breaks applications
that depend on the state of the file descriptor being inherited.  So,
consider inherit fd only for specific use cases that you know for sure
won't break the application.

For examples please visit http://criu.org/Category:HOWTO.

v2: Added a check in send_fd_to_self() to avoid closing an inherit fd.
    Also, as an extra measure of caution, added checks in the inherit fd
    look up functions to make sure that the inherit fd hasn't been reused.
    The patch also includes minor cosmetic changes.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:48:30 +03:00
Oleg Nesterov
0affd5bc19 criu/testing: caps00: don't hang if PR_CAPBSET_DROP fails
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:42:17 +03:00
Oleg Nesterov
40ae0fa35a criu: check: don't leak the child if PTRACE_ATTACH fails
PS: never ever use PTRACE_KILL.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:41:49 +03:00
Ruslan Kuprieiev
5d9c83cf88 arch:aarch64: add atomic_cmpxchg
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:55:55 +03:00
Ruslan Kuprieiev
3a2d171976 arch:arm: add atomic_cmpxchg
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:55:53 +03:00
Ruslan Kuprieiev
424162b075 arch:x86: add atomic_cmpxchg
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:55:52 +03:00
Andrey Vagin
4bca68ba49 tcp: don't split packets for restoring a send queue
The kernel can do it better. The problem exists only for recv queues.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:46:44 +03:00
Ruslan Kuprieiev
5ecb7b7ccd zdtm: don't forget to remove ip.dump and ip.rst when performing cleanup
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:45:46 +03:00
Vladimir Davydov
888cae434d zdtm/pty02: never close master before reading slave
We may close the master before reading the slave if the child runs first
when the parent wakes it up using task_waiter_complete. In this case the
subsequent read from the slave will return 0 resulting in a false
positive test failure:

13:23:42.194: 30914: ERR: pty02.c:89: read(slave) failed (errno = 11 (Resource temporarily unavailable))

Fix this by waking the child, which closes the master, only after the
read has been completed.

Also note errno = EAGAIN in the failure report above, which looks really
confusing. Let's print the actual number of bytes read/written along
with the errno while reporting a read/write failure to make the error
reporting clearer in this test.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Cyrill Gorcunov <gorcunov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:39:58 +03:00
Andrey Vagin
d64a49fdc6 zdtm/maps007: don't use signed values in calculations
maps007 segfaults on i386, because "size" is calculated bigger than allowed.

This occurs when the result of lrand48() * PAGE_SIZE is negative.
In this case the % operation returns a negative value too, what is unexpected.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:37:18 +03:00
Pavel Emelyanov
bda033e1e9 criu: Version 1.4
So, according to the recently accepted plan we have 1.4.

Biggest achievement here is that we've finally started with
user namespaces, fixed CRIU to work smoothly with the p.haul
project and optimized images and /proc files IO.

And a bunch of bugs, of course.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 15:50:35 +03:00
Andrew Vagin
50977c40a4 test: return the iteration number to the end of the test path
When we generate a path to the previous images, we take a directory name
and the previous iteration number.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 14:59:22 +03:00
Andrew Vagin
80ed2f3955 test: clean up pages immediately after restore
We see big load-avarage for the CRIU-iter job, because the host is
writing images for the maps04 test. If we will remove images after retore,
they will live in a page cache. Curretly we collect images for three
iterations and their size is too big to live in a cache.

[root@jenkins workspace]# time bash test/zdtm.sh  -i 3 ns/static/maps04
real	2m23.765s
user	0m0.719s
sys	0m4.006s
[root@jenkins workspace]# time bash test/zdtm.sh -C -i 3 ns/static/maps04
real	1m34.884s
user	0m0.200s
sys	0m4.191s

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 13:48:06 +03:00
Andrew Vagin
ef351aba03 test: use an origin test name to generate uniq name for test files
Currently ns/test and test may have the same test directory,
especially if zdtm.sh is executed with --ct.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 13:44:38 +03:00
Andrey Vagin
c7fafff448 jenkins: reduce number of jobs for executing tests
32 is too many for our test server

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-29 19:33:15 +03:00
Andrey Vagin
2559572a91 check: don't lead fd
CID 83243 (#1 of 1): Resource leak (RESOURCE_LEAK)
6. leaked_handle: Handle variable fd going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-29 19:33:00 +03:00
Andrey Vagin
71a0b5dc31 mem: check existence of parent images before dumping pages (v2)
When we are doing pre-dump, we splice pages in pipes and only then open
images and dump pages. But when we are splicing pages, we need to know
about existence of parent images. This patch adds a new call to determin
existence of parent images.

In addition this patch fixes a following issue:
CID 83244 (#1 of 1): Uninitialized pointer read (UNINIT)
14. uninit_use: Using uninitialized value xfer.parent.

v2: initialize unused field of struct page_server_iov, because it sends
in network.

CID 83451 (#1 of 1): Uninitialized scalar variable (UNINIT)
2. uninit_use_in_call: Using uninitialized value pi. Field pi.nr_pages
is uninitialized when calling write.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-29 19:32:40 +03:00
Andrey Vagin
0fc19cf7d2 tcp: don't fail if send eats only a part of data
For stream sockets it's possiable and we should not fail in this case.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-26 22:30:00 +03:00
Pavel Emelyanov
0c33452723 page server: Don't hide error from flush request
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-11-26 22:29:30 +03:00
vkonyashkin
6678fbb334 zdtm/inotify_system_nodel.c: need to print mask of events for UNKNOWN event
Need to print a mask of events for UNKNOWN event in inotify_system_nodel.c
and inotify_system.c tests. The current error message in this case is too vague:
inotify_system_nodel.c:266: got unexpected event UNKNOWN

Signed-off-by: vkonyashkin <vkonyashkin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-19 13:18:50 +04:00
Cyrill Gorcunov
02b2f197ed check: Implement F_GETOWNER_UIDS
It is in mainline and required for proper CRIU work.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-19 13:17:45 +04:00
Pavel Emelyanov
199619791d mnt: Factor out find-mount-by-s_dev code
And move the 2nd piece lower to avoid fwd declaration and
keep similar calls close to each other.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-19 13:17:30 +04:00
Cyrill Gorcunov
b6c3270b2f scripts: Exit early if no scripts passed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-14 15:51:28 +04:00