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

5014 Commits

Author SHA1 Message Date
Pavel Emelyanov
4857d0ce7d sockets: Do not call modprobe to make sure diag modules are there
There was a problem with diag modules, that were auto-loaded on dump and
put some data into uevent sockets thus causing the dump to fail on that
socket. The solution that time was to call modprobe in advance to make
sure the diag modules are there.

This turned out to be not nice solution as modprobe may fail if the module
is missing and the requred functionality is built-in.

To handle this for diag stuff it is mush faster and more reliable to ping
the kernel with simple diag request and check that it reqched the required
module.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 18:54:43 +03:00
Pavel Emelyanov
674df19a34 nlk: Add error callback to do_rtnl_req
In the next patch we will need to care about the exact error reported by
the kernel, so add the error callback for this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 18:54:37 +03:00
Pavel Emelyanov
837e38fd73 crit: Fix uninitialized print_hex
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 17:23:47 +04:00
Cyrill Gorcunov
ee3239f946 make: protobuf -- Rework build procedure
Instead of generating intermideate files with .SECONDARY
helper lets calculate proto deps on the fly.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 15:20:44 +03:00
Pavel Emelyanov
c864a31f05 Revert "Fix AUFS pathname handling when branch is not exposed"
This reverts commit 490ca718 to the 2749d9e6 fixes the problem
the other (proper) way.

Conflicts:
	sysfs_parse.c

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 15:03:59 +03:00
Saied Kazemi
2749d9e6ea Rework fixup_aufs_vma_fd() for non-AUFS links
This patch reworks fixup_aufs_vma_fd() to let symbolic links in
/proc/<pid>/map_files that are not pointing to AUFS branch names follow
the non-AUFS applcation logic.

The use case that prompted this commit was an application mapping
/dev/zero as shared and writeable which shows up in map_files as:

lrw------- ... 7fc5c5a5f000-7fc5c5a60000 -> /dev/zero (deleted)

If the AUFS support code reads the link, it will have to strip off the
" (deleted)" string added by the kernel but core CRIU code already
does this.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-22 14:56:40 +03:00
Ruslan Kuprieiev
97743f421c make: fix multithreded compilation
Currently we run into lots of race conditions when building in
multithreded mode.

Reported-by: Mr Jenkins
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-20 17:41:35 +03:00
Ruslan Kuprieiev
a1f626d4ac travis: add libprotobuf-dev
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-20 16:54:02 +03:00
Ruslan Kuprieiev
2823a67a95 make: fix double compilation
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:59 +04: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
96457b178d protobuf: core-x86: mark gregs with hex field option
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:57 +04:00
Ruslan Kuprieiev
d1c88b1e57 protobuf: core: use hex(custom field option) for blk_sigset field
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:56 +04:00
Ruslan Kuprieiev
87da3e3437 crit: add --format hex option
Pavel reported that decimal values for some fields are hard to read,
because people used to see hex values in there. Unfortunately, json
doesn't support hex representation of integers, so we can only store
them as hex strings. Not all field need to be represented as hex
strings, so this set introduces a custom field option called "criu"
to use in our proto files. One should use [(criu).hex = true] to mark
which field should be represented as a hex string. pb2dict module
from pycriu package will look into field options and if he finds that
criu.hex is set to True, it will convert such field to/from hex string.
Though, such behaviour is optional and user can request it by specifying
 --format hex when calling crit decode("crit encode" in its turn, detects
such fields automatically and doesn't require any special cmdline options
to be set).

We need our proto files to compile with both protoc and
protoc-c compilers, which requires creating google/protobuf
directory with a symlink to /usr/include/google/protobuf/
descriptor.proto to make protoc-c and generated c files happy.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:55 +04:00
Ruslan Kuprieiev
5feac80336 protobuf: add opts.proto
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 18:13:54 +04:00
Saied Kazemi
490ca71866 Fix AUFS pathname handling when branch is not exposed
The code that fixes up AUFS pathnames associated with vma entries (see
commit d8b41b6525) should handle cases where an entry does not expose
the branch pathname (e.g., pointing to a device like /dev/zero).

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-19 13:05:12 +03:00
Pavel Emelyanov
7b4a264e28 crit: Small inf/outf evaluation cleanup
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-15 19:51:18 +03:00
Ruslan Kuprieiev
a9ccdccc34 pycriu: images: pb2dict: perform pb<->json conversion properly
Currently we are handling conversion in the simplest way, by
just parsing protobuf text format representation of pb message,
splitting string in half and storing values wrapped in ""-s
in python dict. Which leads to a bunch of errors, like,
for example, when converting bytes fields. It also doesn't
handle types properly.

This patch introduces a proper way to handle pb<->json conversion
by iterating through pb fields and properly storing them in dict
or properly extracting values from dict.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-15 20:46:23 +04:00
Pavel Emelyanov
8878793d39 crit: Fix sk-queues extra handler variable name
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-15 02:07:00 +04:00
Ruslan Kuprieiev
0956230709 pycriu: images: mention raw data images when throwing an 'Unknown magic' exception
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:48 +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
1a30e8800e crit: fix typo
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
7a8ddc0f4a crit: split convert command into decode and encode
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:46 +04:00
Ruslan Kuprieiev
598a83cfd3 pycriu:images: treat pagemap.img as a special one
pagemap.img is the special one, as it starts with an entry
of pagemap_head type and is followed by entries of
pagemap_entry type. Currently we treat pagemap as if
pagemap_head is a payload and pagemap_entry's are
an extra, which is wrong.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:45 +04:00
Ruslan Kuprieiev
4997896bf4 pycriu: images: merge payload field into entry and add extra field to entry if needed
Before:
{
    "magic" : "FOO",
    "entries" : [
        {
            "payload" : {
                "foo" : "bar",
                "bar" : "foo"
            },
            "extra" : "abc"
        },
        {
            "payload" : {
            "foo" : "bar",
            "bar" : "foo"
            },
            "extra" : "abc"
        }
    ]
}

After:
{
    "magic" : "FOO",
    "entries" : [
        {
            "foo" : "bar",
            "bar" : "foo"
            "extra" : "abc"
        },
        {
            "foo" : "bar",
            "bar" : "foo"
            "extra" : "abc"
        }
    ]
}

We don't have any fields named "extra" in our pb msgs and it is
not likely that we will ever have one, so there is no reason to
worry about that.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:44 +04:00
Ruslan Kuprieiev
912f1a5afb crit: print new line if orig_type == bin and using stdout
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:47:43 +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
ec9ab827b1 crit: add install-crit target to Makefile
install-crit uses scripts/crit-setup.py install --prefix=$(DESTDIR)
to act the way the install target expects it too.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:49 +04:00
Ruslan Kuprieiev
def0f49177 crit: add scripts/crit-setup.py
This is a small python scipt that uses distutils to install crit script
and pycriu package.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:48 +04:00
Ruslan Kuprieiev
9d169c550b crit: add crit target to Makefile and *.pyc to .gitignore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:47 +04:00
Ruslan Kuprieiev
d36994c4c3 crit: add crit
crit is a python script that helps user to manipulate criu
images. For now, it can only convert criu images to\from
human-readable format using pycriu.images module.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:47 +04:00
Ruslan Kuprieiev
dfe8f838cf pycriu: add python package
pycriu is a python package, that, for now, consists
of rpc module and images package. rpc module contains
data structures for interacting with CRIU RPC.
images package contains methods for loading\dumping
criu images.

See a big comment below in pycriu/images/images.py file.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:46 +04:00
Ruslan Kuprieiev
e7640ad635 scripts: add magic-gen.py
This script is needed to generate python module from
include/magic.h file, that contains dicts with magic
numbers that we put into our criu *.img files.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-14 20:44:45 +04:00
Pavel Emelyanov
feda34319a tty: Assign empty file_desc_ops to fake file descs
The newer cleanups in fd inherit code need every file-desc
to have non-NULL ops. This hunk was lost in tty code in the
very beginning.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-13 22:19:58 +03:00
Mark O'Neill
af91bfa241 Signed-off-by: "Mark O'Neill" <mao@tumblingdice.co.uk>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 17:04:34 +03:00
Saied Kazemi
296129295a Allow the veth-pair option to specify a bridge
When restoring a pair of veth devices that had one end inside a namespace
or container and the other end outside, CRIU creates a new veth pair,
puts one end in the namespace/container, and names the other end from
what's specified in the --veth-pair IN=OUT command line option.

This patch allows for appending a bridge name to the OUT string in the
form of OUT@<BRIDGE-NAME> in order for CRIU to move the outside veth to
the named bridge.  For example, --veth-pair eth0=veth1@br0 tells CRIU
to name the peer of eth0 veth1 and move it to bridge br0.

This is a simple and handy extension of the --veth-pair option that
obviates the need for an action script although one can still do the same
(and possibly more) if they prefer to use action scripts.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:54:18 +03:00
Christopher Covington
70f28122e5 aarch64: Fix restore for multithreaded processes
The stack handling in the RUN_CLONE_RESTORE_FN macro for
AArch64 was incorrect, resulting in a segfault of the restored
process. With this change the pthread00 test case (and probably
others) runs to completion and passes.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:51:57 +03: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
Pavel Emelyanov
98a9a4c326 shmem: Remove write-only fields from shmem-info
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:47:30 +03:00
Pavel Emelyanov
a1b1959dd1 shmem: Turn shmem-info into shared objects from shremap ones
We have a nasty issue with it. Current code allocates these
entries in shremap area one by one. We do NOT allocate any
OTHER entries in this region, but if we will this array will
be spoiled.

Fortunately we no longer need shmem-infos as plain array,
neither we need one in restorer. So just turn this into plain
shared objects and collect them in a list.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:47:24 +03:00
Pavel Emelyanov
b246ccb181 shmem: Move some code to shmem.c file
The struct and find routine used to be use by restorer code. Now
the former fully uses vmas and fd opened, so we can move the code
into .c file not to spoil global namespace.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:47:17 +03:00
Pavel Emelyanov
455f9b564e fd: Factor out inheriting FDs code
We have two places where we lookup the inherited-fd list
by name and dup() the descriptor found. I propose to factor
out this piece in a single inherited_fd() call. When
we will want to support inheritance for sockets or any
other files we'll simply add the inherited_fd() call
there.

I'm also thinking about moving the call to inherited_fd
into generic level, but the open_path() routine doesn't
allow to do it in a simple manner.

Also we have not yet finished issue with files-vs-inodes
mapping. Keeping all the logic in one function should
make the solution simpler.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:46:51 +03:00
Pavel Emelyanov
8f691c40d5 fd: Mark inherit_fd_lookup_fd static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:46:42 +03:00
Mark A. O'Neill
6d6db9e1aa tun: Small changes I needed to get criu working under 3.18.1 kernel on Centos 6.5 machine.
Signed-off-by: Mark A. O'Neill <mao@tumblingdice.co.uk>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 14:37:11 +03:00
Saied Kazemi
19ffca535c Try to determine the bind mount file for dockerinit
This patch adds code to the contrib/docker_cr.sh helper script for trying
to determine the external bind mount file for dockerinit if the user
has not explicitly specified it via the DOCKERINIT_BINARY environment
variable.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-01-12 13:20:06 +03:00
Andrew Vagin
769d527876 tests: add libaio to LDLIBS
Reported-by: Mr Travis
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 19:59:19 +03:00
Andrew Vagin
ea3e39450a scripts/travis.sh: add libaio-dev for ARM
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 16:30:11 +03:00
Ruslan Kuprieiev
78618b621a check: skip AIO remap error, if --ms is specified
criu check --ms results in an error on a stock fedora 21 kernel.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 15:38:51 +03:00
Pavel Emelyanov
549795a8c1 aio: Fix vma->start printing format on arm
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 15:38:25 +03:00
Andrey Vagin
4836e39256 .travis.yml: add libaio-dev
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 15:36:27 +03:00
Pavel Emelyanov
a25747f95f pie: Fix sizeof's printinf format
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-30 15:12:06 +03:00