2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Commit Graph

6803 Commits

Author SHA1 Message Date
Andrew Vagin
55de67a7fa zdtm/shm-unaligned: don't overriding recipe for target 'shm-unaligned.pid'
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>
2016-06-28 13:09:40 +03:00
Andrew Vagin
c48b5d1142 proc_parse: don't read an uninitialized pointer
CID 161665 (#1 of 1): Uninitialized pointer read (UNINIT)
14. uninit_use: Using uninitialized value vma.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:40 +03:00
Andrew Vagin
549d71f3cc aio: don't leak memory
CID 161664 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable re going out of scope leaks the storage it points to.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:40 +03:00
Andrew Vagin
2a835eb8d1 zdtm: remove or replace noauto on crfail where it's possiable
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>
2016-06-28 13:09:40 +03:00
Andrew Vagin
99c6e840fc zdtm: remove the noauto flags for tests which can be executed
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>
2016-06-28 13:09:40 +03:00
Kirill Tkhai
eec3f49b4d dump: Allocate root_item before run pre-dump scripts
This allows pre-dump scripts to know CT root_item pid
and enter into its namespaces.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:40 +03:00
Tycho Andersen
b734cd4003 tests: add a test for cgroup kernel controller props
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>
2016-06-28 13:09:40 +03:00
Tycho Andersen
c38e18432d cgroups: add support for c/r of the devices cgroup
This one is a little big ugly, see comments for details. At some point we
should invent a better way to do these special cases, since we have them
for freezer, cpuset, and now devices. Perhaps something like fstype, where
you can ask the cgroup how to restore itself.

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>
2016-06-28 13:09:40 +03:00
Tycho Andersen
a827d386e5 cgroup props: update controllers list and props list
In particular add support for the new controllers:

* perf_event (nothing here, but may be used by the perf tool so we should
  keep it)
* net_cls
* net_prio
* pids

Also add support for many more memory properties that were not implemented
in the first pass, but the container may use.

Note that this commit omits the "devices" controller, because that needs to
be checkpointed and restored in a special way.

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>
2016-06-28 13:09:40 +03:00
Tycho Andersen
a6587ef404 cgroup props: ditch notify_on_release from individual controllers
This is listed as a global prop, so we don't need to list it individually.

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>
2016-06-28 13:09:40 +03:00
Tycho Andersen
e30f45d3a0 cgroup props parser: allow empty property lists
We'll use this in the next patchset where we want to dump global properties
of the freezer cgroup, but none of the special ones for this cgroup,
because they're handled separately.

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>
2016-06-28 13:09:40 +03:00
Mike Rapoport
d5095c00b5 criu: page-xfer: intorduce helpers for sending IOVs
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:40 +03:00
Mike Rapoport
afa9d8df51 criu: page-xfer: move code aroud
to remove forward declarations and create better grouping

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Kirill Tkhai
673ffadeef sk-unix: Move out interconnected pair setup
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Kirill Tkhai
c085d6af6d unix: Link all sockets in unix_sockets list
List "unix_sockets" is used to link external sockets.
Change this, to link all unix sockets there. To differ
really external sockets in fix_external_unix_sockets(),
we may check for socket's already_dumped value.

This may be useful to traverse over all unix sockets
in a namespace.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Kirill Tkhai
c58a2867cb pstree: Export current
Export current to allow to use find_unused_fd()
from everywhere.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Dmitry Safonov
a2de3eb831 travis: add coveralls.io support
I suggest to add support for coveralls.io.
It can't show all coverage, as we don't run all tests on travis,
but still everyone who forked CRIU can see instant coverage of
his Travis build. As a nice feature, it will show code cover
increasing/decreasing just after you push a commit - which
could give you a nice hint about content of a new tests.
For this feature, we need to build CRIU with `make GCOV=1`,
which adds --coverage and disables optimizations.

The resulting report looks like this:
https://coveralls.io/builds/6439346
I was thinking about codecov.io also, but it has fewer community,
less fixed issues on github - so I choose this service.

Just a random fun fact:
file-ids.c covered completely on tests, except -ENOMEM return.
Maybe it worth to run fault injections tests on Travis.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Cyrill Gorcunov
e47c3684fa test: static, fanotify00 -- Don't compare @s_dev in test
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>
2016-06-28 13:09:39 +03:00
Andrew Vagin
f1015e4cdf zdtm/tty*: wait when processes complete a preparation stage
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Dmitry Safonov
a8423135c5 parasite: drop unused PARASITE_CMD_DAEMONIZED
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Andrew Vagin
66299a0065 zdtm: use flake8 to verify zdtm.py
and fix various warnings. For example, we mix tab and space indentations.

v2: add flake8.cfg

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>
2016-06-28 13:09:35 +03:00
Mike Rapoport
93991e6678 criu: page-read: remove unnecessary forward declaration
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:07:38 +03:00
Mike Rapoport
cd7928d371 criu: page-read: make seek_pagemap_page a method of page_read
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:07:37 +03:00
Andrew Vagin
51970afa5e zdtm: don't fail if a test changed cwd
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:05:53 +03:00
Andrew Vagin
b599cda15b files: use pr_err instead of pr_perror
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:05:53 +03:00
Andrey Vagin
1cd1da9ca1 zdtm/ptrace_sig: don't print from signal handlers
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>
2016-06-28 13:05:53 +03:00
Cyrill Gorcunov
7e2f7296bd cg: rpc -- Fix typos for custom cgroup props engine
Seems @rpc-> part has been sneaked out (forgot to
push into index), as result it built fine locally,
but not when applied from the patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:05:53 +03:00
Cyrill Gorcunov
900e71cbec cg: rpc -- Add bindings for custom cgroup props engine
For handling  --cgroup-props, --cgroup-props-file and
--cgroup-dump-controller from RPC interface.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:05:52 +03:00
Pavel Emelyanov
92486c9015 coredump: Rename dir to coredump
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:58 +03:00
Andrew Vagin
308741d059 mount: detect sibling mounts correctly
I found the meaning of comparing basename-s for mounts in mount_qual(),
which was removed in v2.1-49-gbcf40bf.

I think it was an attempt to detect siblings (propagated mounts).

Actually it's wrong to compare only basenames for such mounts and
we need to generate full paths for them.

For example:
28 25 0:25 /	/sys/fs/cgroup/devices rw shared:10 - cgroup cgroup rw,devices
29 28 0:49 /	/sys/fs/cgroup/devices/101/xxx/yyy ...
38 35 0:25 /101 /sys/fs/cgroup/devices/ rw master:10 - cgroup cgroup rw,devices
39 38 0:49 /	/sys/fs/cgroup/devices/xxx/yyy ...

28 and 38 are in the one shared group. 29 and 39 siblings and probably
one of them was mounted and another one was propagated.

This patch adds a function to generate a sibling mount point and
use it to propagate mounts

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:58 +03:00
Andrew Vagin
fdeba04e86 mount: move functions to handle paths in a separate file
mount.c is too big already and the next patch adds one more such functions
with a few unit test, so it's better to add one more source file.

v2: fix compilation on arm and ppc
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:56 +03:00
Pavel Emelyanov
b0049beacc tcp: Move call to prepare socket
The restore_tcp_queues() will become int sk agnostic.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Pavel Emelyanov
e931c75734 tcp: Make reuse crit section wider
This lock will have to be moved into the libsocr which is
not nice, so pull this out of the restore_tcp_queues.

And, since we're extending the section anyway, pull it away
from sk-tcp.c at all. Makes the code a little bit cleaner.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Ruslan Kuprieiev
947358a9ed test: add manual test for criu-coredump
Convert criu images to coredumps and check if they are
readable by readelf.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Ruslan Kuprieiev
e569e46b31 test: fix manual crit test
In automated tests we use test/crit-recode.py because of performance
benefits(no need to launch python interpreter more than once), but
manual test is still useful for manual testing, so lets make it
work again.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Ruslan Kuprieiev
8a71a4a27d criu-coredump: merge criu-coredump project
This patch introduces a new subproject called "criu-coredump". The name
is pretty much self-explanatory, it allows generating coredumps from
criu images. Coredumps are readable and usable by gdb. The structure is
something in the middle of kernel-generated and gdb-generated core dumps.

This is a first iteration of core-dump patch series. It introduces
ability to generate gdb-operatable core dump only for x86_64 machines.
To support other architectures there will be a set to introduce proper
structures for notes section of the core dump. It is also worth noting,
that we still leave some notes(SIGINFO primarily) not fullfilled, as
I still need to figure out what to put in there in our case, where no
signal is involved in triggering core dump generation and other
caveats like zeroed vvar(we have problems with it withing CRIU itself
as well as gdb has some difficalties with it) and vsyscall vmas.
One can already use produced core dump with gdb, there is also
a quick simple demo https://asciinema.org/a/18936 .

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Cyrill Gorcunov
b28f93efaf cg: Add documentation about dumping specified controllers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Cyrill Gorcunov
45dc87b819 cg: Add ability to dump specified controllers only
For example in containers case there might be a number
of controllers mounted on the node which we should not
carry inside image when container is migrated. So
add ability to dump predefined controllers only
specified via command line --cgroup-dump-controller
option.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Cyrill Gorcunov
3b3e03c557 cg: props -- Handle use after free on error path in cgp_handle_props caller
| *** CID 161427:  Memory - corruptions  (USE_AFTER_FREE)
 | /criu/cgroup-props.c: 352 in cgp_parse_stream()
 | 346
 | 347             ret = 0;
 | 348     out:
 | 349             return ret;
 | 350
 | 351     err_parse:
 | >>>     CID 161427:  Memory - corruptions  (USE_AFTER_FREE)
 | >>>     Calling "cgp_free" frees pointer "cgp_entry" which has already been freed.
 | 352             cgp_free(cgp_entry);
 | 353             ret = -EINVAL;
 | 354             goto out;
 | 355     }
 | 356
 | 357     static int cgp_parse_file(char *path)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:03:12 +03:00
Cyrill Gorcunov
3ae937d59f cg: props -- Fix resource leak on realloc failure
| *** CID 161426:  Resource leaks  (RESOURCE_LEAK)
 | /criu/cgroup-props.c: 318 in cgp_parse_stream()
 | 312                             }
 | 313
 | 314                             if (xrealloc_safe(&cgp_entry->cgp.props,
 | 315                                               (cgp_entry->cgp.nr_props + 1) * sizeof(char *))) {
 | 316                                     pr_err("Can't allocate property for controller %s\n",
 | 317                                            cgp_entry->cgp.name);
 | >>>     CID 161426:  Resource leaks  (RESOURCE_LEAK)
 | >>>     Variable "cgp_entry" going out of scope leaks the storage it points to.
 | 318                                     return -1;
 | 319                             }

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:03:12 +03:00
Andrey Vagin
a439bafede cgrou-props: typo fix
280                             xfree(p);
>>> >>>     CID 161428:  Memory - illegal accesses  (USE_AFTER_FREE)
>>> >>>     Passing freed pointer "p" as an argument to "print_on_level".
281                             pr_err("Unknown strategy \"%s\" in controller's %s stream\n",
282                                    p, cgp_entry->cgp.name);

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:03:12 +03:00
Cyrill Gorcunov
04deb5f37a cg: Add documentation about props
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:03:12 +03:00
Cyrill Gorcunov
c80a84f8e0 cg: Add ability to dump custom cgroup properties
We have some common predefined properties such as "cpuset.cpus" and etc gathered
in @cgp_predefined set, but there might be situation when only predefined ones
are not enough, so add ability to specify properties via --cgroup-props
and/or --cgroup-props-file options.

For example one may pass file with content

"cpu":
 - "strategy": "merge"
 - "properties": ["cpu.shares", "cpu.cfs_period_us"]

to dump custom properties for cpu controller.

The description is implemented in almost valid yaml, probably we will
need to support the various forms, but oneline is enough for now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:03:12 +03:00
Pavel Emelyanov
ee0d1be19e Add ascciinema tour on basic criu features. 2016-06-16 16:37:06 +03:00
Pavel Emelyanov
1ba5a900db criu: Version 2.3
So, we have some nice new features, again aimed at better integration,
also have massive restorer blob preparation rework and several nasty
bugfixes in mounts code.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2.3
2016-06-14 11:41:17 +03:00
Dmitry Safonov
7171f7f45d parasite-syscall: describe task's state on trap failure
I think we can improve error messages to distinguish task's kills
from segfaults from ptrace failures & etc.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-14 11:24:10 +03:00
Laurent Dufour
f6cc277cad test/zdtm : shm-mp fix page size
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>
2016-06-14 11:23:58 +03:00
Pavel Emelyanov
67038451a9 ipc: SysVshmem segment can be unaligned
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>
2016-06-01 14:52:22 +03:00
Dengguangxing
f87edfde53 add warning message when joining user namespace
join user namespace is not fully tested yet. So it is
not recommended to use this.

add a warning message when user tries to use join-ns with
user-namespace.

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:22 +03:00
Pavel Tikhomirov
3bc62b36a5 zdtm/netns-dev: fix misprint in hop_limit interval it should be {1, 255}
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:22 +03:00