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

6324 Commits

Author SHA1 Message Date
Pavel Emelyanov
70c3c92874 mount: Rework bool insert_roots argument
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-27 16:34:17 +03:00
Pavel Emelyanov
5ff440924b files: Remove unused args from dump_dead_process_remap
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-27 16:34:07 +03:00
Tycho Andersen
5dc64eb61f gitignore: ignore some more generated testcases
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-21 16:14:26 +03:00
Andrew Vagin
101775b158 seize: remove extra \n from the error message
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-21 16:12:50 +03:00
Andrew Vagin
4429a4c914 seize: don't detach from a task if a freezer cgroup is set
criu detaches from tasks in freezer_detach() in this case

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-21 16:12:48 +03:00
Andrew Vagin
15c9eb220e seize: detach from all processes before waiting the root task
We need to detach from all processes before waiting the root
task, because one of these processes may collect processes from a
target pid namespace. The pid namespace is destroyed only when all
processes have been killed and collected.

https://jira.sw.ru/browse/PSBM-43089
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-21 16:12:44 +03:00
Kirill Tkhai
2f80e54cd9 zdtm: Add suid flag to binfmt_misc test
This fixes the following test error:

    FAIL: binfmt_misc.c:111: mount failed (errno = 1 (Operation not permitted))

CRIU tests (./test/zdtm.py run -a) passed.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 15:33:25 +03:00
Pavel Emelyanov
a85aeb7fd0 ns: Remove __rst_new_ns_id
There's only one user of it, so better to reshuffle the arg set.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:11:06 +03:00
Pavel Emelyanov
b8a9122d89 fds: Remove unused arg from close_old_fds()
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:10:29 +03:00
Tycho Andersen
0420e09908 tmpfs: don't try to dump mountpoint at 0 fd
If we happen to get 0 as the fd for the mountpoint, there is an error:

(00.280617) Dumping task cwd id 0x2b root id 0x2b
(00.280697) mnt: Dumping mountpoints
(00.280702) mnt:        132: 34:/ @ ./run/lock
(00.280714) mnt: Path `/run/lock' resolved to `./run/lock' mountpoint
tar: /proc/self/fd/0: Cannot open: Not a directory
tar: Error is not recoverable: exiting now
(00.283581) Error (util.c:666): exited, status=2
(00.283598) Error (mount.c:1220): mnt: Can't dump tmpfs content

Instead, let's not ever use 0 as the mountpoint fd.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:09:30 +03:00
Igor Sukhih
eec66f3d30 criu [PATCH] post-setup-namespaces
Introduce post-setup-namespaces action script

It needed to have possibility to run cutom script after mount
namespace is configured

Signed-off-by: Igor Sukhih <igor@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:08:22 +03:00
Andrew Vagin
ef8d4cf285 service: add support for the --external option
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:07:31 +03:00
Tycho Andersen
751a4982a9 dump: add some stray newlines to pr_infos
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:06:01 +03:00
Kirill Tkhai
25b88d10d9 binfmt_misc: Make debug printed using pr_debug()
It's a debug message, and it shouldn't be printed with
pr_perror(). Also, we interested in debug in the both
cases: magic and extensions.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:05:09 +03:00
Kirill Tkhai
bd27328b7d zdtm: Add binfmt_misc test
Generate random binfmt_misc entries of different types
and check that they remain registered after the signal.

v2: pr_perror() in cleanup, .desc file and TST_DIR in Makefile

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-20 11:04:47 +03:00
Laurent Dufour
ef074d3ff4 ppc64: introduce CPU feature checking operations
This patch introduces basic CPU feature checking for PowerPC.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 21:11:36 +03:00
Laurent Dufour
406edb007b zdtm/test: Fix live/static/netns-nf dependency
This test calls iptables to set a new packet filter using a shared
library libxt_standard.so. Unfortunately, depending on the
distribution we are running on, this shared library may be stored on a
different place.

This patch allows this test to be run on Debian like systems.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 21:10:35 +03:00
Laurent Dufour
6b13731d02 zdtm.py: Add optional dependency support
Depending on the distribution, binaries or shared libraries a test is
dependent of may not be stored at the same place.

This patch introduces the ability to define option in the dependency
list, by separating the optional target names by a '|' character.

For instance the dependency of test may be described this way:
{'flavor': 'ns', 'deps': [ '/bin/foo|/usr/bin/foo' ], 'flags': 'suid'}

Note, there shouldn't be any spaces around the '|'.

If none of the optional dependency is satisfied, an error is raised.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 21:10:31 +03:00
Pavel Emelyanov
6853c480ad mem: Handle the case when kernel doesn't support dirty track reset
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Tested-by: Adrian Reber <adrian@lisas.de>
2016-01-18 21:09:07 +03:00
Pavel Emelyanov
d7684252c8 kdat: Handle pagemaps with zeroed pfns
Recent kernels allow for user to read proc pagemap file, but zero
pfns in it. Support this mode for user dumps.

https://github.com/xemul/criu/issues/101

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2016-01-18 21:07:06 +03:00
Laurent Dufour
40184b9797 zdtm: Use /usr/bin/diff instead of /bin/diff
The descriptor for test netns-nf and netns are referencing /bin/diff.
On Fedora this is a hard link to /usr/bin/diff created during the
install of the package diffutils. However this hard link doesn't exist
on Debian like systems.

Referencing /usr/bin/diff works in both cases.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 21:05:51 +03:00
Tycho Andersen
c89fecfd6c remap: fix dead pid remap of /proc/<pid>
It turns out we can't just test for /proc/<pid>, because the kernel appends
(deleted), since the directory is actually deleted (vs. something like
/proc/1/mountinfo, where the file still exists in the unlinked directory,
so there is no (deleted)). See comment for details.

v2: s/ret/is_dead in /proc/<pid>/xxx test, split tests to correctly test
    both cases

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 20:53:30 +03:00
Andrew Vagin
ec8db4cb6c test/session00: close a signal pipe in all processes
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 20:01:29 +03:00
Pavel Emelyanov
d2183bb3eb fix compilation after previous commit
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 17:01:38 +03:00
Pavel Emelyanov
2449656e10 util: Optimize vaddr_to_pfn
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 16:21:21 +03:00
Andrew Vagin
9c327c3128 zdtm/chroot: wait when a child closes a descriptor
A static test should not change its state during C/R.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 16:20:48 +03:00
Sergey Bronnikov
a57fba056e make: update target to measure code coverage
This patch updates Makefile for measuring code coverage in CRIU.

criu binary should be compiled with option --coverage and linked with -lgcov
option. lcov utility creates HTML pages containing the source code annotated
with coverage information.

make GCOV=1
make test
make gcov
Look at gcov/html/index.html

Changes:
- disable optimization on compilation for gathering coverage data
- mention an option for coverage in help
- cleanup the files produced for code coverage
- make path to coverage files produced by tests in ns independent on environment
- add an option lcov_branch_coverage as branch coverage disabled by default

Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 16:19:54 +03:00
Andrew Vagin
4ea3acb03c zdtm/session00: wait when a child closes fd
A static test should not change its state during C/R

===================== Run zdtm/live/static/session00 in ns =====================
Start test
./session00 --pidfile=session00.pid --outfile=session00.out
Run criu dump
Run criu restore
7: Old files lost: set(['4'])
7: New files appeared: set([])
############# Test zdtm/live/static/session00 FAIL at fds compare ##############

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 16:12:47 +03:00
Vijaya Kumar K
db0cc36417 zdtm: Correct syscall numbers for fanotify00 testcase
Define correct syscall numbers for fanotify_init
and fanotify_mark for arm64.

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 15:51:03 +03:00
Vijaya Kumar K
8a7c006bdd define macro for stack alignment
Replace stack alignment magic constant with
__stack_aligned__ macro.
Also align stack for sigaltstack test case.

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-13 15:50:42 +03:00
Andrew Vagin
831f7b9191 tty: use PRIx64 to print dev_t
dev_t is %ul on x86_64 and %ull on arm32

tty.c: In function 'get_tty_driver':
tty.c:247:2: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'dev_t' [-Werror=format=]
  snprintf(id, sizeof(id), "tty[%lx:%lx]", rdev, dev);

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-30 17:59:19 +03:00
Pavel Emelyanov
0e891b3b0d zdtm.py: Force per-test logs if report is requested
Otherwise non-parallel jenkins jobs miss the error logs in e-mails

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-30 17:06:27 +03:00
Andrew Vagin
0f6e2a66fc arch: define the readlinkat syscall for all architectures
Cc: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Fixes: c9448e1ff7d3 ("arm: Fix wrong system call number")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 17:33:45 +03:00
Vijaya Kumar K
6aede7f18b zdtm: Align stack pointer for arm64
arm64 requires stack pointer to be aligned to 16 bytes.
Update all test cases that are using clone system call
to have 16 byte aligned stack pointer.

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:53:28 +03:00
Vijaya Kumar K
cda3a0799b restorer: Update RESTORE_ALIGN_STACK for arm64
arm64 requires stack to be aligned to 16 bytes.
update RESTORE_ALIGN_STACK macro to always align
to 16 bytes.

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:53:22 +03:00
Vijaya Kumar K
1a5296e537 restore: Align stack to 16 bytes for arm64
arm64 expects stack to be aligned to 16 bytes.
If stack pointer is not aligned clone system call
fails during restore.

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:53:17 +03:00
Vijaya Kumar K
c9448e1ff7 arm: Fix wrong system call number
System call number 78 corresponds to readlinkat.
Where as 78 is mapped to readlink() in syscall.def for
arm.

With this patch, use sys_readlinkat instead of sys_readlink
and update syscall.def to point syscall number 78 to readlinkat()
instead of readlink()

Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:53:13 +03:00
Dmitry Safonov
9405d4a4cf criu-log: introduce print_once
Impact: small cleanup

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:51:28 +03:00
Dmitry Safonov
0ce8e42995 kerndat: do not report errors on feature test
prepare_loginuid() called on kerndat_loginuid where it tests for
loginuid restore feature. Let's omit error printing for feature test.

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:51:23 +03:00
Andrey Vagin
4864996ed8 dump: write an inventory image after dumping all processes
Currently if criu segfaulted, the inventory image isn't removed and
we can't detect that images are incomplete.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:50:38 +03:00
Andrew Vagin
98cc46fc13 test: add a new test to check external terminals
It's an example how it can be used

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:48:47 +03:00
Andrew Vagin
df0be41e05 zdtm: add a new test to check inherited tty-s
v2: set a control terminal
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:48:36 +03:00
Andrew Vagin
4bab48fb39 tty: allow to dump and restore external terminals (v2)
Now we can use the --inherit-fd option to mark external terminals on dump
and to tell which file desdriptors should be used to restore these terminals.

Here is an example how it works:
$ setsid sleep 1000

$ ipython
In [1]: import os
In [2]: st = os.stat("/proc/self/fd/0")
In [3]: print "tty[%x:%x]" % (st.st_rdev, st.st_dev)
tty:[8800:d]

$ps -C sleep
  PID TTY          TIME CMD
 4109 ?        00:00:00 sleep

$ ./criu dump --external 'tty[8800:d]' -D imgs -v4 -t 4109
$ ./criu restore --inherit-fd 'fd[1]:tty[8800:d]' -D imgs -v4

v2: add missed break
    remove @non_file from tty_driver

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:48:10 +03:00
Andrew Vagin
6280625aac crtools: add ability to set list of external resources
This option is used to mark external resources on dump.

Currently it's going to be used to handle external tty-s,
but in a future it can be used to any type of resources.

We can have a few ways to restore external resources and
we will have a separate options to say how to restore each type.

For example, we can use --inherit-fd to restore external
file descriptors.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:47:56 +03:00
Andrew Vagin
2245a43393 tty: use a pair of dev and rdev to identify a terminal
We can't use only a terminal device, because we can not distinguish
two pty-s from different mounts in this case.

$ mount -t devpts -o newinstance xxx pts1
$ mount -t devpts -o newinstance xxx pts2
$ stat pts1/0
Device: 27h/39d	Inode: 3           Links: 1     Device type: 88,0
$ stat pts2/0
Device: 28h/40d	Inode: 3           Links: 1     Device type: 88,0

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:47:46 +03:00
Andrew Vagin
5d75e1f4cf jenkins: add a script to check inherit file descriptors
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:45:13 +03:00
Pavel Emelyanov
ea68c33fff mnt: Allow for external mounts to be fsroot ones
Right now if we bind-mount / of some FS into container and want this
to be 'external' mount, criu would refuse to dump this mountpoint.

Tune the check in validate_mounts() to always accept any external mps
regardless of whether they are fsroot or not.

https://github.com/xemul/criu/issues/93

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Tested-by: Dengguangxing <dengguangxing@huawei.com>
2015-12-28 13:12:04 +03:00
Andrew Vagin
9dc7155b73 zdtm.py: unfreeze test processes before killing them
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-28 13:11:28 +03:00
Andrew Vagin
20592acef7 syscall: use a correct type for timer_t
timer_t is (void *) in glibc, but timer_t is (int) in kernel.
When we call system calls, we need to use timer_t from kernl.

https://github.com/xemul/criu/issues/98
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-28 13:11:04 +03:00
Andrey Vagin
fc3dadfb34 mount: Fix spelling error in a error message
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-28 13:10:25 +03:00