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

6324 Commits

Author SHA1 Message Date
Andrew Vagin
46f3869ff6 dockerfile: add libcap-dev
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:13:15 +03:00
Dmitry Safonov
efe35aa39f build/nmk: rename $@-ldflags-y to LDFLAGS_$@
That will complement existing CFLAGS_ and ASFLAGS_.
As no one use it yet (I will use it, do not remove) - no need
for convert-everything patch.

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-02-24 13:12:19 +03:00
Andrew Vagin
2cb4532e26 tests: remove zdtm.sh (v2)
It was replaced by zdtm.py.

v2: remove zdtm.sh from other scripts
    remove fault-injection, because nobody uses it

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:09:57 +03:00
Andrew Vagin
88aaae3ace tests: move non-zdtm tests to tests/others/
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:09:17 +03:00
Andrew Vagin
a47d2917a5 userns: use a correct type for uid and gid
Currently we use int for them, but uid_t and gid_t is unsigned int.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:08:33 +03:00
Tycho Andersen
b7375b1265 tests: add a cgroupns test
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:07:09 +03:00
Tycho Andersen
736a2940ef cgroup: allow dumping non-criu cgsets that don't match the root
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:07:06 +03:00
Tycho Andersen
1b291d8b79 pie: better detection of /proc belonging to pid ns
While this commit is logically part of the "implement cgns support" commit,
it's worth noting this separately I think: since cgns requires each task to
look at its own proc file, we can now no longer dump unprivileged tasks
whose /proc doesn't belong to them.

This is because unprivileged tasks can't mount /proc, so if their /proc
doesn't belong to them and they need to read it (because they're in a
cgns), the pie code can't do anything about it.

For cgns, we could solve this problem by simply fork()ing and setns()ing to
the tasks pid and cgroup namespaces, and then reading the /proc from that
task instead. (And perhaps we should implement it that way so we can still
dump tasks whose /proc doesn't belong to them, although I don't think
that's a common case.)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:07:04 +03:00
Tycho Andersen
6e33d08045 cgroup: add support for cgroup namespaces
cgroup namespaces are imminent to be merged into the kernel (indeed, they
went into and out of 4.5 for minor issues), and will be carried as a
patchset in the ubuntu 16.04 kernel. Here's an attempt at c/r.

There are essentially three key steps:
  * on dump, in parse_task_cgroup, we should ask the task what cgroups it
    thinks it is in (unless it has the same cgroup ns id as its parent, then we
    should just take the prefixes from the parent's set), and set the prefix on
    the cg set
  * add a new restore step, prepare_cgroup_namespace(), which happens in
    prepare_task_cgroup() that does an unshare() if necessary
  * when restoring, in move_in_cgroup, if we're going to restore via usernsd,
    leave the full path. if not, use (cgset->path + len(cgset->cgns_prefix) as
    the path, since we will have already moved into the cgns_prefix and unshared.

Another observation here is that we can support nesting, since these are
restored heirarchically by nature.

v2: * store cgns prefix length instead of full prefix in images
    * set has_cgroup_ns_id conditionally
    * drop unused argument to move_in_cgroup
    * add extra comments about what is happening when unsharing() on
      restore
    * add extra comments about what is happening when computing the actual
      cgns prefix

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:07:02 +03:00
Tycho Andersen
a80dec3fb1 cgroup: add a check for cgroup namespaces
v2: print a warning when cgroup ns is not present.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:07:00 +03:00
Andrey Vagin
f400efb2b2 travis: use docker to build criu (v2)
v2: create a separate job for each arch
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 19:17:24 +03:00
Andrey Vagin
4322e4c35c dockerfile: add Dockerfile.tmpl
Fixes: afae962c668d ("dockerfile: extract a common part in one file")
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 19:17:20 +03:00
Tycho Andersen
6c5bde3b5b travis: run tests on trusty instead of precise
precise's libc headers are extremly old and don't define SYS_*. trusty's
do, so let's run the travis tests there.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 19:17:16 +03:00
Pavel Emelyanov
166a8e8e93 zdtm: Increate dump timeout
Tests are often run in VMs and 5 seconds on loaded environments might
be not enough to catch transition zdtm tests.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 17:56:02 +03:00
Pavel Emelyanov
c07ef80481 jenkins: The "live" subdir is no longer there
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 15:51:07 +03:00
Cyrill Gorcunov
e9beed7bb3 build: zdtm -- Add implicit rules into zdtm building
Current zdtm building procedure depends on impilcit
make fules, so bring them back until we moved to
nmk build engine.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:16:04 +03:00
Cyrill Gorcunov
496b51b64a build: Fix criu executable building
Otherwise linking may be executed twice
as a forced target.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:15:56 +03:00
Ivan Shapovalov
054d451866 cgroup: we won't walk the same path for the same hierarchy twice in add_cgroup(), so BUG() it
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:15:21 +03:00
Ivan Shapovalov
7f0643f9c3 treewide: specify 'python2' instead of 'python' in shebangs of python scripts
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:11:49 +03:00
Ivan Shapovalov
56d563e97d pie: restore madvise flags after aio rings have been created
AIO rings internally are memory mappings, so they may have restorable
madvise bits on them. Create the mappings before restoring their properties.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:11:31 +03:00
Pavel Emelyanov
b2dfdb324f fix compilation after previous commit
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 14:04:30 +03:00
Cyrill Gorcunov
d1f8d02324 criu: pie -- Zap parasite_dump_creds::gids
Fixes #95

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:50:21 +03:00
Andrew Vagin
2253c430d7 userns: close all file descriptors before entering into userns
Cc: Jann Horn <jann@thejh.net>
Reporte-by: Jann Horn <jann@thejh.net>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:47:27 +03:00
Andrew Vagin
6e1726f8fb userns: set uid and gid before entering into userns
> 21.01.2016 02:56, Jann Horn writes:
> Call chain:
>
> cr_dump_tasks -> collect_namespaces(true) ->
> collect_user_namespaces(true) -> walk_namespaces -> collect_user_ns
> -> dump_user_ns -> check_user_ns
>
> This method enters a user namespace with unknown owner with
> euid==(kuid 0). Linux does not guarantee that this is safe; with
> the current upstream kernel, the namespace owner can attach to the
> CRIU process via ptrace and use it to write into /etc/shadow or
> whatever.

Cc: Jann Horn <jann@thejh.net>
Reported-by: Jann Horn <jann@thejh.net>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:47:23 +03:00
Pavel Emelyanov
733c926abb test: Update .gitignore
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:55 +03:00
Pavel Emelyanov
2e13f1f029 test: Get rid of live directory
Move static and transition into zdtm top. We can't move all the micro
tests themselves, as we need to distinguish static from non static (zdtm.py
makes additional checks on static ones).

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:52 +03:00
Pavel Emelyanov
02b22eba8b test: Merge zdtm/live streaming and transition tests
These two sets are the same -- they test something and ask to be
C/R-ed at the time they do it. No other differences.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:50 +03:00
Pavel Emelyanov
d545a2d8fd test: Clean nsroot using zdtm.py script
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:48 +03:00
Andrew Vagin
358857ee45 net: check that open_image() doesn't return NULL
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:17 +03:00
Cyrill Gorcunov
d469c5f865 build: lib-py -- Fix building missing rpc module
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:39:10 +03:00
Dmitry Safonov
e6cc90bf73 build/feature-test: simplify adding a new feature
To add a new feature test - add it to FEATURES_LIST.

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-02-20 13:38:43 +03:00
Dmitry Safonov
e85638fd38 build/nmk: define map and newline
map is very good at generating rules.
Just map gen function to array of it's parameters.
Don't forget to eval the result.

I'll use it in feature-tests generation and in someday coming
compat 32-bit mode - in x86 makefiles.

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-02-20 13:38:26 +03:00
Tycho Andersen
ab04ddc567 restore: initialize uninitialized pointer
Closes #115
Reported-by: Coverity
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:37:37 +03:00
Cyrill Gorcunov
66de7ceb14 build: Alive GCOV option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:37:13 +03:00
Pavel Emelyanov
3cffd523e4 Revert "seccomp: add a --no-seccomp option to disable dumping seccomp"
This reverts commit a98014f306be4b4fefdf01af31e1efa5d83e5e4f.

As per Saied Kazemi, actually dump works without seccomp support
from the kernel on non-seccomped tasks. The only problem was with
criu check, but this would be addressed separately.

Reverting the commit not to burden the API with (yet) unneeded stuff.

Conflicts:
	lib/c/criu.h
2016-02-20 13:35:47 +03:00
Andrew Vagin
4a14b324e5 pipe: typo fix
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:33:27 +03:00
Andrew Vagin
afae962c66 dockerfile: extract a common part in one file
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:33:03 +03:00
Andrew Vagin
1621ba56ac dockerfile: download Packages.gz only once
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:32:55 +03:00
Andrei Vagin
2df0257f26 Dockerfile: don't fail if a binfmt-misc rule already exists
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:32:49 +03:00
Cyrill Gorcunov
b95bc0d1eb build: pycriu -- Move into lib/py
As was intended from the scratch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:32:19 +03:00
Cyrill Gorcunov
8e506041ef build: Bring install back to life
Fixes #114

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-19 14:31:42 +03:00
Tycho Andersen
0e5f234752 parasite: fix format string typo
The pie sprintf implementation doesn't know about `z', so let's just use
%lu instead.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 23:44:25 +03:00
Dmitry Safonov
e55219562e pie/piegen: add space at pr_perror()
As no user does it explicitly, do this in define, it shall look nicer
than:
parasite_blob: Error (pie/piegen/main.c:121): Can't open file file.oNo such file or directory

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:16:46 +03:00
Dmitry Safonov
234191e52e pie/piegen: make -f explicit parameter
One may specify other parameters, but not 'f'.
Piegen should output usage() instead of trying to open "file.o"
as -f is explicit.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:16:36 +03:00
Cyrill Gorcunov
d51539ccd2 build: Rework @dist and @tar generation
Currently our @tar target imples that there
is a tag in form of "vX.X", if such tag is
not present in the repo we're in trouble.

So make it sane

 - if tag present then create tar from this tag
 - if tag is not present simply use git describe helper

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:15:15 +03:00
Cyrill Gorcunov
c1f31142f8 build: lib -- Fix building for C library
- drop unneeded @built-in.o rule
- use proper @CRIU_SO for -soname option
- add dep on version change

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:15:12 +03:00
Cyrill Gorcunov
4854940d6f build: Move versions definitions on top level
- define all versions in Makefile.versions toplevel file
 - rename CRTOOLSVERSION to CRIU_VERSION (and add CRIU_ prefixes)
 - rename versions for C librabry

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:15:09 +03:00
Dmitry Safonov
1b4bd2026f x86/build: use msg-gen function
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:12:40 +03:00
Dmitry Safonov
e6b26e73bc criu/build: include msg.mk in files that use msg-*
This patch fixes accidental dropping of msg-gen, msg-link messages.
Just run make with another warn enabled:
[criu]$ make --warn-undefined-variable 2>&1 | grep msg
  PBCC     images/ipc-msg.pb-c.c
  DEP      images/ipc-msg.pb-c.d
  CC       images/ipc-msg.o
Makefile.config:17: warning: undefined variable 'msg-gen'
Makefile.version:20: warning: undefined variable 'msg-gen'
Makefile:120: warning: undefined variable 'msg-link'
Makefile:149: warning: undefined variable 'msg-link'
Makefile:15: warning: undefined variable 'msg-gen'

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:12:21 +03:00
Dmitry Safonov
5f6c2eb92c nmk/build: separate msg-* printing from .mk files
Some places in criu need printing support, but do not need
common variables redefining, therefore separate msg printing
to msg.mk

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-18 14:12:10 +03:00