2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

4346 Commits

Author SHA1 Message Date
Pavel Emelyanov
a9f765894e files: Support ghost devices
When we have opened and unlinked chr or blk device, we
shouls also take care of their rdev value. Thus -- new
field in image and some new steps on dump and restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:28:56 +04:00
Pavel Emelyanov
8e21401aa2 files: Split ghost collecting routine
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:28:41 +04:00
Pavel Emelyanov
731dc18332 zdtm: Pick up some tests that pass
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:14:14 +04:00
Pavel Emelyanov
0198590c5a zdtm: Factor out starting the test via Makefule
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:52 +04:00
Pavel Emelyanov
2fc837917f zdtm: Don't build test for the 2nd time
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:51 +04:00
Pavel Emelyanov
8eb1d662bf zdtm: Factor out getting pid of test
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:49 +04:00
Andrew Vagin
693bf79ffd test: add a script for jenkins to execute non-zdtm tests
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:17 +04:00
Andrew Vagin
2eb0a6b6cb test/meme-snap: remove an nonexistent target
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:11 +04:00
Pavel Emelyanov
f6111769c3 zdtm: Introduce per-test criu options
Some tests require custom options for dump and restore. Instead
of hard-coding test names into zdth.sh, introduce the $test.opts
file from which zdtm would pick the needed options.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:36 +04:00
Pavel Emelyanov
6021378ca6 zdtm: Introduce $cpt_args
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:35 +04:00
Pavel Emelyanov
3d14c71c52 zdtm: Rename $args into $gen_args
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:33 +04:00
Pavel Emelyanov
3b71200cd5 zdtm: Remove unused ARGS variable
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:28 +04:00
Pavel Emelyanov
b429492dbc rst: Include criu/include/ptrace.h instead of system one
On ARM some PTRACE_... constants are not declared in sys/ptrace.h file.
They are in linux/ptrace.h, but on x86 this file somewhat conflicts with
the sys/ one. For now fix ARM compilation by using criu/ one and think
of it later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-01 19:48:23 +04:00
Pavel Emelyanov
bd93f9b49a .git: Add vdso01 and pdeath_sig into gitignore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-01 17:44:28 +04:00
Pavel Emelyanov
84eb0a1927 criu: Restore tasks as siblings in swrk
Andrey validly pointed out, that restoring pdeath_sig is not
compatible with criu_restore_child() call -- after criu restore
children, it will exit and fire the pdeath_sig into restored
tree root, potentially killing it.

The fix for that could be -- when started in swrk more, criu can
restore tree not as children tasks, but as siblings, using the
CLONE_PARENT flag when fork()-ing the root task.

With this we should also take care about errors handing -- right
now criu catches the SIGCHILD from dying children tasks, and
since we plan to create them be children of the criu parent (the
library caller) we will not be able to catch them. To do so we
SEIZE the root task in advance thus causing all SIGCHLD-s go to
criu, not to its parent.

Having this done we no longer need the SUBREAPER trick in the
library call -- tasks get restored right as callers kids :)

Some thoughts for future -- using this trick we can finally make
"natural" restoration of shell jobs. I.e. -- make criu restore
some subtree right under bash, w/o leaving itself as intermediate
task and w/o re-parenting the subtree to init after restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
2014-07-01 16:16:07 +04:00
Pavel Emelyanov
fba8aae300 zdtm: Tech that pdeath_sig is preserved
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-07-01 16:16:06 +04:00
Pavel Emelyanov
5e9c57a13d criu: Dump and restore pdeath_sig value
The implementation is pretty straightforward. When dumping per-thread
misc data with parasite, collect one, then write in thread_core_info.

On restore wait for creds restore and put the value back (some creds
changes drop it to zero).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-07-01 16:16:04 +04:00
Pavel Emelyanov
8e11c8ec11 libcriu: Pi compilation -- add PR_SET_CHILD_SUBREAPER constant
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 15:27:14 +04:00
Pavel Emelyanov
7dfcf2a4cb test: Test how criu_dump_iters from library works
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:29:56 +04:00
Pavel Emelyanov
7a2698cfe8 libcriu: Introduce the criu_dump_iters() call
Perform dumping but with preliminary iterations. Each
time an iteration ends the ->more callback is called.
The callback's return value is
	- positive -- one more iteration starts
	- zero     -- final dump is performed and call exits
	- negative -- dump is aborted, the value is returned
back from criu_dump_iters

Inside callback one may (well, should) call criu_set_
function to alter the details of next iterations. In
particluar, then prev and next images directories should
be changed.

The @pi argument is an opaque value that caller may
use to request pre-dump statistics (not yet implemented).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:29:52 +04:00
Pavel Emelyanov
7aee2619c6 test: Cleanup libcriu tests makefile
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:29:35 +04:00
Pavel Emelyanov
43e5d05134 libcriu: Ability to fetch arguments from notifications
After a bit more thinking I found a way to fetch arguments
from notifications -- pass opaque value into callback and
provide a set of calls for exploring one.

With this we can

a) provide more data if service supplies additional fields
   in the future
b) not check the action name to decide whether or not the
   requested argument is available

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:28:55 +04:00
Pavel Emelyanov
5cea861d7f test: Add test for notifications via libcriu
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:28:54 +04:00
Pavel Emelyanov
4562c3df57 libcriu: Add ability to request for notifications from service
This is achieved by supplying the callback. Every time a notification
arrives the callback is called. Return value of 0 means continue,
any other value aborst the request and the value is reported back
to the caller (from criu_dump/criu_restore calls).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:28:52 +04:00
Pavel Emelyanov
714dfdb7d9 test: Add lib.c to libcriu tests
Just some common stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:48 +04:00
Pavel Emelyanov
5d75c52356 test: Rename libcriu run_sub.sh -> run.sh
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:47 +04:00
Pavel Emelyanov
022afe8b2f test: Clean old libcriu tests
New ones cover more and can be used in Jenkins

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:45 +04:00
Pavel Emelyanov
afa47b23aa test: Tune libcriu tests launcher (v2)
v2:
* introduce the run_test helper
* fix overall result detection

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:43 +04:00
Pavel Emelyanov
fd214e0031 test: Helper for checking child exit status
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:42 +04:00
Pavel Emelyanov
f929839ab8 test: Add test for self dump
It's derived from test.c, but is more self-contained
and explicitly checks for both C and R results.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:26:40 +04:00
Pavel Emelyanov
a137d9fd58 test: A simple test for criu_restore_sub call v2
Which is at the same time the demonstration of how to do the trick.
v2:
* remove stupid sleep 1 synchronization
* run internal version of child, not the external script

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-06-27 14:24:37 +04:00
Pavel Emelyanov
24d2f56fad lib: Implement the criu_restore_child() call v2
It fully uses the swrk action of criu. The problems, that caller may
have is that the restored tasks die _before_ libcriu's call returns.

v2:
* rename _sub to _child
* unblock sigchild before execl-ing criu

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:24:36 +04:00
Pavel Emelyanov
b6f6426bef lib: Tossing bits around
This is to prepare a send-and-recv routine that works on existing socket.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:24:35 +04:00
Pavel Emelyanov
d30521a3cf crtools: Add internal "swrk" action
To help restoring tasks from images as kids to the caller, we can
do the trick.

1. Caller sets himself as child reaper with PR_SET_CHILD_SUBREAPER prctl
2. Caller makes sure criu binary is suid-ed and owned by root
3. Caller forks and calls execv() on criu asking it to restore
4. Criu finishes restore and exits. All its kids get reparented to the
   criu's parent, i.e. -- to the library caller.
5. Caller stops being subreaper

In order to make the execv() and arguments passing simpler I propose
to execv() the service worker function, that accepts options via socket.

This is good for two reasons.

1. We don't have to construct CLI options in libcriu
2. We reuse other service's facilities, such as security checks,
   ability to dump, pre-dump and other stuff

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:24:33 +04:00
Pavel Emelyanov
8f05162bb4 libcriu: Add add_veth_pair call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:22:34 +04:00
Pavel Emelyanov
1a5a034413 libcriu: Add add_ext_mount_map call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:22:33 +04:00
Pavel Emelyanov
3f4447d72e libcriu: Add simple missing criu_set_ calls
These are just copy the value on RPC message and
do nothing more.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:22:32 +04:00
Pavel Emelyanov
a09396cca5 libcriu: Add criu_set_root to header
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-27 14:22:31 +04:00
Filipe Brandenburger
2812d04d29 make: fix "make criu" after arch-specific vdso broke it
Building criu with "make criu" on a clean tree was not working, failing on:

  make[1]: *** No rule to make target `arch/x86/vdso-pie.o'.  Stop.
  make: *** [arch/x86/vdso-pie.o] Error 2

git bisect traced the regression to commit c473461d24fd (vdso: Make it arch
specific) which apparently dropped the rule to build $(ARCH_DIR)/vdso-pie.o
using the pie rule.  Restore the dependency for "make criu" to work again from
a clean tree.

Tested:
$ git clean -fdx
$ make criu

Fixes: c473461d24fdfcd25542b427829a37fd2f0facb5

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-26 16:32:53 +04:00
Chris J Arges
c05b7f4153 Ensure LDFLAGS is passed to CC not LD.
If we build with something like:
make LDFLAGS="-Wl,-Bsymbolic-functions"

We'll get an error because the LDFLAGS are being passed to LD when they
should be pased to CC.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-26 16:29:28 +04:00
Filipe Brandenburger
64dc66c29f dump: do not fail dump when robust_lists are disabled
Robust lists may be disabled, for example if the "futex_cmpxchg_enabled"
variable in the kernel is unset.

Detect that case by checking that both "get_robust_list" and "set_robust_list"
syscalls return ENOSYS and do not make criu dump fail in that case, but simply
assume an empty list, which is consistent with the syscalls not being
available.

Tested: Successfully ran the zdtm test suite on a kernel where the
"get_robust_list" and "set_robust_list" syscalls are disabled.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 19:57:32 +04:00
Saied Kazemi
bbb3299f03 cg: skip name= in cgroup named hierarchies
Skip the string "name=" when recreating cgroups directories in cgyard.
For example, systemd's entries in cgroup.img are:

	name: "name=systemd"
	path: "/user/1000.user/4.session"

When creating systemd subdir, named= should not be part of the name.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 19:56:37 +04:00
Andrey Vagin
6f45c38c18 mount: parse devpts options
The newinstance options isn't shown in mountinfo. Currently it is
detected in devpts_dump. It is added only for root mounts and it
isn't added for bind-mounts. So mounts_equal(a, b, true) returns false
for such mounts and criu doesn't understand that they should be
bind-mounted.

Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Cc: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 19:51:01 +04:00
Andrey Vagin
44356b37f2 mount: simplify devpts_dump
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 19:50:59 +04:00
Cyrill Gorcunov
817bf78523 zdtm: posix_timers -- Add definition of CLOCK_BOOTTIME
On PI we've noticed that CLOCK_BOOTTIME might not be defined
in system headers, so ship own one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 19:37:01 +04:00
Cyrill Gorcunov
1764db0fa1 zdtm: Make arch specific tests to have \Space at the end
Otherwise we might have a clash

| Execute zdtm/live/static/vdso01ns/static/pipe00

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 16:49:16 +04:00
Andrew Vagin
8b58c98086 files: Fix compilation on PI (a2)
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 16:08:06 +04:00
Tycho Andersen
4a012f1478 Fix typo
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 14:13:27 +04:00
Andrey Vagin
f5b67f5148 files: Fix compilation on PI
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 14:13:00 +04:00
Cyrill Gorcunov
905ceac7c5 zdtm: Add arch specific tests
To be able to run specific tests depending on
architecture we're executing on.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-25 14:11:50 +04:00