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

5675 Commits

Author SHA1 Message Date
Cyrill Gorcunov
60f6ec7dd6 files-reg: Rework strip_deleted helper
Make it handle both postfixes and return
non-zero code if stipping happened.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:26:01 +03:00
Cyrill Gorcunov
4f8f97e0bd mount: mount_info -- Drop unused @is_file
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:25:14 +03:00
Andrey Vagin
311e927b5c test: execute other tests in a new session
The main reason is to execute tests without a control termnal and avoid
a case when tests try to use the --shell-job options.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:13:47 +03:00
Andrey Vagin
ad80227a37 test/mem-snap: wait util a zdtm test isn't stopped
before checking results.

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:13:43 +03:00
Tycho Andersen
0ac4c13e60 fix typo
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:17:58 +03:00
Cyrill Gorcunov
40ed330c88 kcmp: Stop showing ids tree
Useless, at least in the form present
now it's unreadable anyway. So stop
welling out the logs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:17:31 +03:00
Cyrill Gorcunov
db70a415ed mount: propagate_mount -- Add braces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:15:50 +03:00
Saied Kazemi
91a82fde71 Add OverlayFS support to docker_cr.sh
The main purpose of this patch is to add OverlayFS support to docker_cr.sh
for external checkpoint and restore.  It also does a bit of cleaning
and minor enhancements.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:14:32 +03:00
Cyrill Gorcunov
5c18267ddf proc-parse: Fix line merging
Seems was a typo.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:18:19 +03:00
Cyrill Gorcunov
8c9e15560a mount: Shrink lookup_nsid_by_mnt_id
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:18:09 +03:00
Cyrill Gorcunov
69657701c4 mount: overlayfs -- Shift code left in __lookup_overlayfs
Also use is_root_mount() helper instead of opencoded
strcmp("./", m->mountpoint) and -Ex error codes in
ERR_PTR.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:17:54 +03:00
Cyrill Gorcunov
8603ae77f8 mount: Shrink mnt_entry_free a bit
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:17:02 +03:00
Cyrill Gorcunov
3ae67d7b3a mount: Move mount_info and ext_mount to mount.h
It's quite unclean while this structure lives
in proc_parse.h, which only have to fill this
structure on procfs read, but real handling
is inside mount.c. Move it as appropriate.

Same time ext_mount structure should be moved
into a header as well with sane @list name
used instead of @l.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:47 +03:00
Cyrill Gorcunov
291e632e60 mount: Reorder declarations
- gather structs on top
 - then extern vars

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:05 +03:00
Cyrill Gorcunov
17dc1fea57 mount: Align members of mount_info
This a way easier for reading.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:04 +03:00
vkonyashkin
4cf4acc598 criu tests: It's necessary to align data to use MOVAPS command
It 's necessary to align date, because the operand of movaps command
must be aligned on a 16-byte (128-bit version) boundary or a general-protection
exception (#GP) will be generated.

Signed-off-by: vkonyashkin <vkonyashkin@parallels.com>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:02 +03:00
Andrew Vagin
1f97db8a0b other/overlayfs: don't use the shell-job option
Jenkins runs all tests in a new session without a control terminal.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-12 17:23:56 +03:00
Andrew Vagin
8086675625 test/rpc: compile test-c
Fixes: 94928cf85d81 ("test/rpc: include unistd.h")
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-12 10:25:58 +03:00
Cyrill Gorcunov
61d00a140c service: Add ghost limit setting from request
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 17:45:03 +03:00
Cyrill Gorcunov
c5d485c94b lib: Add helpers to setup ghost limit
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 17:44:53 +03:00
Cyrill Gorcunov
7c98cb37ad protobuf: rpc -- Add @ghost_limit option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 17:44:44 +03:00
Cyrill Gorcunov
ced8f88401 opts: Allo to specify the maximum size of ghost files
For example we hit a case where systemd carries journal
file with 4M in size.

https://jira.sw.ru/browse/PSBM-38571

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:51:11 +03:00
Cyrill Gorcunov
1bdb8298d0 util: Fix mega/giga typos
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:49:43 +03:00
Andrey Vagin
1676c86d7d zdtm.sh: add ability to use a freezer cgroup
It allows to freeze processes faster

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:47:53 +03:00
Andrey Vagin
8ea020388e dump: use freezer cgroup to seize processes (v4)
Without using a freezer cgroup, we need to do a few iterations to catch
all tasks, because a new tasks can be born. If new tasks appear faster
than criu collects them, criu fails. The freezer cgroup allows to
solve this problem.

We freeze the freezer group, then attaches to tasks with ptrace and thaw
the freezer cgroup. We suppose that all tasks which are going to be
dumped in a specified freezer group.

v2: fix comments from Christopher
Reviewed-by: Christopher Covington <cov@codeaurora.org>

v3: refactor task_seize

v4: fix comments from Pavel

Cc: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:47:51 +03:00
Andrew Vagin
69b093add1 seize: set cr_errno in collect_pstree
Before cr_errno was called from open_pid_proc(), but
now it isn't called if a root task doesn't exist.

Reported-by: Mr Jenkins
Fixes: b9b0730cb12e ("ptrace: split task_seize into seize_catch_task and seize_wait_task")
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:39:01 +03:00
Andrew Vagin
94928cf85d test/rpc: include unistd.h
gcc -c test.c -I ./
test.c: In function ‘recv_resp’:
test.c:18:8: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
  len = read(socket_fd, buf, MAX_MSG_SIZE);
        ^
test.c: In function ‘send_req’:
test.c:45:6: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  if (write(socket_fd, buf, len)  == -1) {
      ^
test.c: In function ‘main’:
test.c:165:2: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
  close(fd);

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-10 16:38:35 +03:00
Pavel Emelyanov
4a895813ae ptrace: Fix compilation after prev patch
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 15:03:43 +03:00
Andrey Vagin
e0bc24ec97 zdmt: enable tmpfs tests
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:42:03 +03:00
Andrey Vagin
8fd50f35b9 dump: dump tmpfs from a target userns
It's required to dump uid-s and gid-s from this userns.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:42:02 +03:00
Andrey Vagin
011231af3b util: add ability to execute programs in a specified userns
It's required for dumping tmpfs, where we use tar to save content.
If we need to execute tar from a proper userns to get right uid-s and
gid-s for files.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:42:01 +03:00
Andrey Vagin
9a8ca1cfff mount: convert uid and gid properties according with userns
uid and gid are shown in the init userns. We are going to restore mounts
in a target userns, so we need to set these options in the target
userns.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:42:00 +03:00
Gabriel Guimaraes
aabba6b20c Adding overlay-bug test
This test checks that the OverlayFS fixup for CRIU works correctly
by dumping and restoring a process that has an open file in an
OverlayFS mounted directory. This should work no matter if the
Kernel has the OverlayFS bug or not.

Signed-off-by: Gabriel Guimaraes <gabriellimaguimaraes@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:31:16 +03:00
Gabriel Guimaraes
dbaab31f31 Workaround for the OverlayFS bug present before Kernel 4.2
This is here only to support the Linux Kernel between versions
3.18 and 4.2. After that, this workaround is not needed anymore,
but it will work properly on both a kernel with and without the bug.

The bug is that when a process has a file open in an OverlayFS directory,
the information in /proc/<pid>/fd/<fd> and /proc/<pid>/fdinfo/<fd>
is wrong, so we grab that information from the mountinfo table instead.

This is done every time fill_fdlink is called.
We first check to see if the mnt_id and st_dev numbers currently match
some entry in the mountinfo table. If so, we already have the correct mnt_id
and no fixup is needed.

Then we proceed to see if there are any overlayFS mounted directories
in the mountinfo table. If so, we concatenate the mountpoint with the
name of the file, and stat the resulting path to check if we found the
correct device id and node number. If that is the case, we update the
mount id and link variables with the correct values.

Signed-off-by: Gabriel Guimaraes <gabriellimaguimaraes@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 14:30:41 +03:00
Andrey Vagin
b9b0730cb1 ptrace: split task_seize into seize_catch_task and seize_wait_task
It's preparation to use a freezer cgroup for freezing tasks.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 13:47:11 +03:00
Ruslan Kuprieiev
46e8aeed12 rpc: add constants for cgroups modes
Signed-off-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-07 13:46:14 +03:00
Pavel Emelyanov
22378ea3bc service: Fix compilation after prev patch
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-06 15:00:34 +03:00
Andrey Vagin
2f172c8b24 crtools: split cr-dump.c in two files
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-06 14:31:06 +03:00
Hui Kang
3d1e8c6883 Enable manage cgroup modes in criu service
Signed-off-by: Hui Kang <hkang.sunysb@gmail.com>
Looks-good-to: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-06 14:28:54 +03:00
Andrey Vagin
231b61d692 zdtm: don't skip userns test cases
Currently we skip all userns tests if "criu check" fails. This code was
written when the "freature" options of criu check didn't exist.

Currently we add userns tests only if "criu check --feature userns" passes.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 18:32:57 +03:00
Cyrill Gorcunov
7bda5bd649 sk-unix: Fix memory leak on error path
Dynamically allocated @name doesn't release
if error happened.

 | ** CID 129898:    (RESOURCE_LEAK)
 | /sk-unix.c: 505 in unix_process_name()
 | /sk-unix.c: 509 in unix_process_name()
 | /sk-unix.c: 519 in unix_process_name()

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:45:37 +03:00
Andrey Vagin
098e3a2f8f zdtm: replace sockets03 on socket_dgram_data
They should do mostly the same, but the first one checks nothing after
c/r.

v2: remove sockets03 from Makefile
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:44:44 +03:00
Andrey Vagin
c674906f69 sk-unix: queuer should be set for peer
because we are going to restore data of peer.

Anyway this is wrong, because we need to restore a message with a sender
address.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:44:34 +03:00
Andrey Vagin
bbc2cbc419 zdtm: check that data in unix dgram sockets are restored correctly
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:44:20 +03:00
Andrey Vagin
6ae3539f4c zdtm: check that a sender address is restored
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:42:37 +03:00
Andrey Vagin
528cbe3705 zdtm: check one end of socketpair with data (v2)
This test fails currently, because these data are not restored.

v2: remove the test from the execution list.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-05 13:42:28 +03:00
Christopher Covington
f9ae6d9dd4 Replace remaining hard-coded TASK_SIZE use
If we want one CRIU binary to work across all AArch64 kernel
configurations, a single task size value cannot be hard coded. While
trivial applications successfully checkpoint and restore on AArch64
kernels with CONFIG_ARM64_64K_PAGES=y without this patch, replacing
the remaining use of the hard-coded value seems like the best way to
guard against failures that more complex process trees and future uses
may expose.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-03 17:14:19 +03:00
Christopher Covington
1438f013a2 Pass task_size to vma_area_is_private()
If we want one CRIU binary to work across all AArch64 kernel
configurations, a single task size value cannot be hard coded. Since
vma_area_is_private() is used by both restorer blob code and non
restorer blob code, which must use different variables for recording
the task size, make task_size a function argument and modify the call
sites accordingly. This fixes the following error on AArch64 kernels
with CONFIG_ARM64_64K_PAGES=y.

  pie: Error (pie/restorer.c:929): Can't restore 0x3ffb7e70000 mapping w>
  pie: ith 0xfffffffffffffff7

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-03 17:14:18 +03:00
Christopher Covington
7451fc7d23 restorer: Replace most hard-coded TASK_SIZE use
If we want one CRIU binary to work across all AArch64 kernel
configurations, a single task size value cannot be hard coded.
This fixes the following error on AArch64 kernels with
CONFIG_ARM64_64K_PAGES=y.

  pie: Error (pie/restorer.c:772): Unable to unmap (-): -1211695104

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-03 17:14:17 +03:00
Christopher Covington
c0c0546c31 kerndat: Introduce task_size variable
If we want one CRIU binary to work across all AArch64 kernel
configurations, a single task size value cannot be hard coded.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-03 17:14:15 +03:00