2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Commit Graph

4982 Commits

Author SHA1 Message Date
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
Andrey Vagin
f42ba40f27 jenkins: exclude maps04 from the criu-iter job
This job does three iterations. We need to write about 0.5Gb of images
for maps04.  This is too much for our test VM and other tests start fail
due to timeout.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:17:00 +03:00
Cyrill Gorcunov
fd07bc7791 cpu: Add 'ins' mode to --cpu-cap option
In this mode we test if target cpu has all features present
in image file but do not require bit to bit match: target cpu
may be a new one with more features present.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:15:46 +03:00
Pavel Emelyanov
bbc38f3dac zdtm: Simple test for AIO ring
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:44 +03:00
Pavel Emelyanov
9594595096 check: Add check for remapable AIO rings
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:42 +03:00
Pavel Emelyanov
2694a74a00 aio: Restore AIO contexts
Restoring AIO is quite simple. Once all VMAs are put in
their places we can call io_setup() to let kernel create
the context back and then move the ring into proper place.

Another thing we should "restore" is the context ID. But
the thing is, upon ring creation kernel repots the ring
start address as this ID. And there's a patch in the -next
tree that changes the ID when we remap the ring. That
said after AIO context creation and ring remap we need
to check that the new ID is seen by the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:40 +03:00
Pavel Emelyanov
08c204820f aio: Dump AIO rings
When AIO context is set up kernel does two things:

1. creates an in-kernel aioctx object
2. maps a ring into process memory

The 2nd thing gives us all the needed information
about how the AIO was set up. So, in order to dump
one we need to pick the ring in memory and get all
the information we need from it.

One thing to note -- we cannot dump tasks if there
are any AIO requests pending. So we also need to
go to parasite and check the ring to be empty.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:36 +03:00
Pavel Emelyanov
80cf042695 x86: Add io syscalls
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-26 18:13:33 +03:00
Cyrill Gorcunov
f165bdc93c cpu: x86 -- Fix --cpu-cap=fpu handling on restore mode
Our CPU_CAP_s are bitmaps so if cpuinfo image is present
but we require only FPU to check we need to check this
bit being sole on comman line.

It was a typo in first place which caused statement to
be false always (it's not a problem though and not a
@stable candidate because with this mistake we fall
into strict match cpu mode).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-25 21:12:05 +03:00
Andrey Vagin
2fd795b61c zdtm/cwd02: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Mr Jenkins
Fixes: 7dbd38dbc9 ("zdtm: set additional groups along with uids and gids")
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-25 21:10:58 +03:00
Andrey Vagin
79c4b74705 arm: fix compilation on ARMv7
/tmp/ccq2xzf8.s: Assembler messages:
/tmp/ccq2xzf8.s:5748: Error: thumb conditional instruction should be in IT block -- strexeq r1,r2,[r3]'

Cc: Alexander Kartashov <alekskartashov@parallels.com>
Cc: Ruslan Kuprieiv <kupruser@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-25 21:10:35 +03:00
Pavel Emelyanov
86c0c5fb99 proc: Allocate and get vma fstat in vma_get_mapfile
We will need to detect aio mappings soon, so this is a preparation,
that makes future patching simpler.

Also move aufs stat-ing into aufs code to keep more aufs logic in
one place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-25 21:10:15 +03:00
Andrew Vagin
f4282b478a zdtm/cwd01: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Mr Jenkins
Fixes: 7dbd38dbc9 ("zdtm: set additional groups along with uids and gids")
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-24 19:15:04 +03:00
Andrey Vagin
18d40fddd6 zdtm.sh: set correct path for dump files (v3)
Don't use an uninitialized variable to create a path pattern.

v2: fix the comment
v3: don't use readlink -m, which isn't supported by busybox

Cc: Christopher Covington <cov@codeaurora.org>
Reported-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-24 19:13:17 +03:00
Andrew Vagin
7f4afef2cf arm: fix compilation on ARMv6
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Tested-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:41:33 +03:00
Andrew Vagin
fa992b9d6a zdtm: execute mntns_root_bind only if mnt_id is shown
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:40:53 +03:00
Ruslan Kuprieiev
2802618efa test:libcriu: add cr_errno test
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 17:39:00 +03:00
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