Consider when there is a double fork of helpers or zombies, e.g. when a
zombie has a session id which doesn't match its pid. If the child dies and
exits before the grandchild, the grandchild reparents to init, and when the
task dies init doesn't have it in the helper list, so init dies as well,
viz. the log below.
(00.118789) Add a helper 293 for restoring SID 293
(00.118792) Attach 294 to the temporary task 293
...
(01.394403) 294: Restoring zombie with 0 code
...
pie: Task 294 exited, status= 0
(01.434279) Error (cr-restore.c:1308): 12097 killed by signal 19
(01.434420) Error (cr-restore.c:1308): 12097 killed by signal 19
(01.450258) Switching to new ns to clean ghosts
(01.450324) Error (cr-restore.c:2138): Restoring FAILED.
Let's have the helpers reap their children before they exit to avoid this.
v2: block SIGCHLD when waiting on helpers so that it doesn't race with the
SICGHLD handler
v3: * only helpers should collect their children, zombies can't have kids
* don't double decrement nr_tasks in zombie case
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The following error happens when building CRIU on Fedora 22:
CC autofs.o
autofs.c: In function ‘autofs_mount’:
autofs.c:892:9: error: implicit declaration of function ‘add_post_prepare_cb’ [-Werror=implicit-function-declaration]
ret = add_post_prepare_cb(autofs_add_mount_info, mi);
^
cc1: all warnings being treated as errors
Adding forward declaration of add_post_prepare_cb resolves the issue.
Signed-off-by: Mike Rapoport <rapoport@il.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Autofs restore needs to create some shared data structures to be able to pass
data to actual autofs master.
But on mount restore stage shared data is not configured yet.
This list of objects and their actors is processed after all mounts and shared
data are restored to let autofs to create the objects.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Before the nsroot= mount option, we were just getting lucky because the
cgroup superblocks "matched" when inspecting them from userspace, so we
were actually getting a bind mount from the host when migrating from within
cgroup namespaces.
Instead, let's actually do a new (i.e. not a bind mount) for cgroup
namespaces. For this, we need two things:
1. to prepare the cgroup namespace (and thus the cgroups) before the mount
ns, so when the mount() occurrs it is relative to the right cgroup path.
2. not reject cgroup filesystems with no root. A cgroup ns mount looks
like:
223 222 0:22 /lxc/unpriv /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd,nsroot=/lxc/unpriv
i.e. it has /lxc/unpriv as its root, and thus doesn't look rooted to CRIU.
We use the fstype->parse hook to rewrite this root to /, since it
is handled by the cgroup ns infrastructure.
v2: add new fstype->munge hook, allowing fstypes to munge their parsed
mountinfo entries if they want to. this allows us to get rid of the
ugly hacks with FSTYPE__CGROUP everywhere in teh patch.
v3: s/fstype->munge/fstype->parse for FSTYPE__CGROUP
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The target has been broken for some time without complaints from users.
https://lists.openvz.org/pipermail/criu/2016-March/026525.html
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>
To link dynamic libs (libcompel for example).
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
No much point in carrying it in a separate file.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
These tests check for file descriptor being assigned
to the pid which is freed already, so check them
in PID namespace only, otherwise the kernel may
give PID someone else and the check from
commit c4cf5f0b7638a679be65b05bdb8269d34c2a4573
might trigger and stop testing procedure.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Before this would open file named '-' as log:
./criu/criu dump -t 20526 -o -
But now it will print log into stdout. Charming.
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2: set umask to 0000. It's required to generate gcda, gcno files
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We need to adjust free_bytes each time when we change free_bytes.
Fixes#140
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
- option --keep-going is not mandatory if we run a single testcase
- show warning when we use --keep-going with a custom set of testcases
- ignore --keep-going when we run a custom set of testcase (exit on 1st fail)
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In commit 9469dae61c we've dropped implicit cleanups as
a pattern but in images dir we use additional custom
rules so simply drop files built.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Sometimes when running tests manually it's tempting to
prepare the list of tests to run in advance and then
run only those. E.g. -- when testing a new feature
that affects only _some_ tests. This option allows it.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
If makefile is changed itself we've been not detecting it.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Later (find_ext_ns_id, but probably others as well) we depend on the struct
being zeroed in order to figure out whether or not to collect info about
it. Let's make sure it is actually zeroed.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
See comment for details, but basically this mountopt can be completely
wrong in some cases.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
With cleanify helper we remove only they files
we've been generating, not anything else.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Both never worked, we need to pass them as explicit parameter.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Each time I type `make clean` and find that my tags are cleaned
and generated headers/c-files are deleted, I'm getting annoyed.
Mostly it's about protobuf images definitions.
(And then I need to run `make` and `make tags` again which
is painful).
I think, we may separate clean process on two parts, just
like it's done in the kernel (omitting distclean):
o Cleaning all binaries/objects, but leave enough to navigate
o Clean everything compiled/generated/etc.
In this patch pie blobs are still deleted on clean stage - I may
fix it in the later patches.
(they _should_ be regenerated on `make clean && make`)
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>
This will separate clean process on two parts:
- deleting binaries/objects/temp
- deleting generated files
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>
+ ./test/zdtm.py run --all -f best -x maps04 -x cgroup02 --norst --keep always
usage: CRIU test suite run [-h] [-a] [-t TEST] [-T TESTS] [-f FLAVOR]
[-x EXCLUDE] [--sibling] [--pre PRE] [--snaps]
[--dedup] [--nocr] [--norst] [--iters ITERS]
[--fault FAULT] [--sat] [--sbs]
[--freezecg FREEZECG] [--user] [--page-server]
[-p PARALLEL] [--dry-run]
[-k {always,never,failed}] [--report REPORT]
[--keep-going]
CRIU test suite run: error: ambiguous option: --keep could match --keep-img, --keep-going
It worked fine without the --keep-going option.
[xemul: Remove the --keep-going and --report options, the run
of zdtm.py is not of much interest for TAP ]
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It was requested by Andrey.
This patch adds details about failed testcase to a TAP report:
TAP version 13
1..1
not ok 1 - zdtm/static/deleted_unix_sock # flavor h
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
add options --keep-going and --report (if it was absent)
to run full testrun with report creation
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The "criu check" command to check if the kernel is properly configured
to run criu is broken.
The "criu check --ms" command used to be the way to tell criu to check
only for features that have been merged upstream. But recent kernels
have a set of features whose presence doesn't necessarily mean that
dump or restore will fail but rather *may* fail depending on whether
the process tree uses those features.
This patch deprecates --ms and introduces --extra, --experimental,
and --all. See "criu --help" or "man criu" for more info.
Typical use cases are:
$ sudo criu check
<zero or more warnings and errors...>
Looks good.
$ echo $?
0
$ sudo criu check --extra
<zero or more warnings and errors...>
Looks good.
$ echo $?
1
$ sudo criu check --extra
<one or more warnings...>
Looks good but some kernel features are missing
which, depending on your process tree, may cause
dump or restore failure.
$ echo $?
1
$ sudo criu check --feature list
mnt_id aio_remap timerfd tun userns fdinfo_lock seccomp_suspend \
seccomp_filters loginuid cgroupns
$ sudo criu check --feature mnt_id
Warn (cr-check.c:283): fdinfo doesn't contain the mnt_id field
$ echo $?
1
$ sudo criu check --feature tun
tun is supported
$ echo $?
0
Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
From code coverage report, we found that inotify_irmap doesn't test irmap
cache, because we is always able to resolve path from /proc/PID/fd/X.
Current view: top level - criu - irmap.c (source / functions) Hit Total Coverage
Test: criu.info Lines: 40 223 17.9 %
Date: 2016-03-16 Functions: 4 13 30.8 %
This series introduces a new fault to emulate a situation
when a file can't be opened by handle and we have to find
it in the irmap cache/
It's required to test irmap cache. I don't know how to force it
without this patch. Each time when a file can be opened by handle,
its path can be resolved via /proc/PID/fd/X.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
changed per request from Andrey Vagin
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The bug was fixed in libnl-3 3.2.24, but
rhel7 and the Trusty ubuntu don't update this packet yet
commit b50a36bf34e7452377ab9bbb4d1873b68c65bf72
Author: Samuel Gauthier <samuel.gauthier@6wind.com>
Date: Fri Nov 29 09:28:44 2013 +0100
The commit 6a8d90f5fec4 "attr: Allow attribute type 0" intended to
allow the parsing of {netlink,packet,unix}_diag, even if they are
using type 0 for valid attributes.
It lacked this part in nla_parse.
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Fixes#137
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Usually we run CRIU tests automatically using Jenkins CI and it reports status
as PASS/FAIL for overall testsuite on used environment. You should dig into log
files to figure out how many tests were failed and skipped. This patch brings
support of cute reports in TAP (Test Anything Protocol) format.
The sample of report:
TAP version 13
1..242
ok 1 - conntracks # SKIP manual run only
ok 2 - busyloop00
ok 3 - sleeping00
ok 4 - pid00
ok 5 - caps00
ok 6 - wait00
NOTE: report will be generated only when options --keep-going and --report
are specified.
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Introduce an option --keep-going to make ability to run all planned tests and
ignore failed tests. Also with this option zdtm.py will keep image files and
output log for each failed test:
[vagrant at fedora test]$ find sergeyb-xxx -maxdepth 3
sergeyb-xxx
sergeyb-xxx/zdtm_static_bridge_ns
sergeyb-xxx/zdtm_static_bridge_ns/images
sergeyb-xxx/zdtm_static_bridge_ns/images/1
sergeyb-xxx/zdtm_static_bridge_ns/output
sergeyb-xxx/zdtm_static_bridge_ns/images.0
sergeyb-xxx/zdtm_static_bridge_ns/images.0/1
sergeyb-xxx/zdtm_static_bridge_ns/output.0
sergeyb-xxx/zdtm_static_deleted_unix_sock_h
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output.0
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output.1
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>