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

201 Commits

Author SHA1 Message Date
Andrei Vagin
a654e551c9 travis: set permissions for test/, test/static/, test/transition
We need to allow read/write access for these directories to execute
tests in user namespaces. zdtm.py does this too, but it is racy if
we run a few tests in parallel.

------------------------ grep Error ------------------------
(00.748406)      5: Error (criu/files-reg.c:1487): File zdtm/static has bad mode 040777 (expect 040775)
(00.752027)      1: Error (criu/cr-restore.c:1132): 5 exited, status=1
(00.790562) Error (criu/cr-restore.c:1135): 88 killed by signal 9: Killed
(00.790623) Error (criu/cr-restore.c:2019): Restoring FAILED.
------------------------ ERROR OVER ------------------------

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:22 +03:00
Stanislav Kinsburskiy
333373110c systemd-autofs-restart.sh: fix error handling in case of system limitation
Without this patch any error in check_fs_type function is considered as a
grant to process to bind-mount.
This patch splits mount point fs type discovering and comparison to autofs
type, thus allowing to check for discovery errors.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
Andrei Vagin
de2b4261dd pagemap: add an ability to disable pagemap cache
We found that the 3.19 Ubuntu kernel has a bug and
the pagemap cache doesn't work properly on this kernel.

Unfortunately Travis-CI allows to create intancies only with this kernel,
so we need to add this workaround.

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

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
4fd8f39669 travis: catch core dump files in error cases
It is very hard to investigate travis fails, when something is segfaulted.

Let's add our own core file handler which will provide all required
information for us. Now test/abrt.sh shows a process tree,
process mappings, registers and backtraces.

v2: change a variable name
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Thanked-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
cd10a09fee travis: allow to run up to two tests in parallel
It works faster and checks that two criu processes can work concurrently.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Dmitry Safonov
34996312c2 build/nmk: simplify try-cc and return true/false
- simplify: don't use temporary file -- use /dev/null instead
- return 'true' or 'false' -- this way we can use it inside rules
without external call to bash to compare return with 'y', see
the next patch for a use case.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:43 +03:00
Stanislav Kinsburskiy
6e89dbbfcc systemd-autofs-restart.sh: do not treat absence on bindmount as error
There can be autofs direct mount point without target mount on top.
In this case there won't be any bindmount and nothing to restore on top of the
autofs mount point.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:43 +03:00
Andrew Vagin
f3b730d0e2 kerndat: check the TCP_REPAIR_WINDOW option
It's a new option to get/set window parameters.

v2: don't do this check to unprivileged users, because TCP_REPAIR
    is protected by CAP_NET_ADMIN.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-08 15:20:45 +03:00
Pavel Emelyanov
9c7a234b3e travis: Don't run --unshare tests
They are only available on dev branch

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-05 12:42:27 +03:00
Dmitry Safonov
3693c5e6f9 build/nmk: declare build-as as a recursive
So, how it was working:
1. build-as was declared with $$(1) and $$(2) which were expanded
on entering the submake;
2. function $(call build-as,...) performed the second expansion of
build-as.

Cons: build-as works only in sub-makefile, no sub-sub-makefile, no
upper/top makefile.

Simplify this by single $(1).
Then build-as variable will be used _only_ in makefile, not in
sub-makefiles.

This is for now fine, as each file, that calls $(MAKE) with
$(build)=dir or $(call build-as,makefile,dir) will include main.mk
from NMK, which has build-as definition (from include.mk).

In the future, we'll get rid of $(build) and $(build-as) workarounds
as finally switch to building from a global makefile.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 18:38:35 +03:00
Dmitry Safonov
7a3604845d build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.

After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`

Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)

This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 18:38:32 +03:00
Andrew Vagin
99088d6b60 travis: run test/others/exec
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Andrew Vagin
8876c4bbb8 travis: add a docker file to build on Alpine Linux
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
9c46e087ef travis: build tests in a separate job
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
9205fc3dec travis: add more tests to maximise code coverage
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
fc10a4098f travis: set GCOV for zdtm.py too
It's required for collection full report for tests
which are executed in separate mount namespaces.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Dmitry Safonov
d2bb4ee446 Travis: fix yandex URL for packages
Cc: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
dd0a45c352 travis: run userns tests
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Andrew Vagin
5ee1ac1f28 criu: remove FEATURE_TEST_MEMFD
It isn't required, __NR_memfd_create is defined in syscall-codes.h.

With this patch, we can run all tests in travis-ci, because there
a kernel has support of memfd, but __NR_memfd_create isn't defined
in installed headers

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Stanislav Kinsburskiy
a71b27ea79 scripts: fix typo in binary path in systemd-autofs-restart.sh
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:27:02 +03:00
Eugene Kolomeetz
df5f0262ca scripts: terminate systemd-autofs-restart.sh if saved mountpoint is missing
restore_mountpoint() should never be called without saved mountpoint.
If this happens, this is bug in script logic, which needs fixing.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
73a24127e3 scripts: return non zero if save_mountpoint() fails
In such case, we must not proceed: without saved mountpoint, we risk
losing data when restarting automount service (think about tmpfs).
Currently, zero will be returned as exit status of preceeding echo.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
00f8b63b22 scripts: remove bogus command substitution in systemd-autofs-restart.sh
When we want to just execute command (without capturing output), we must
not do it via $(cmd). With such form, shell first gets output of 'cmd',
and then evaluates it. If this is empty string, it is successfully
executed. If not empty, all breaks down.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
e928321399 scripts: detect EOF on read in a usual way in systemd-autofs-restart.sh
When read bultin detects EOF, it sets empty string as value of specified
variable, and returns non-zero exit code. So we can rely just on exit
code, and not check variable value. This is standard approach.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:19:06 +03:00
Eugene Kolomeetz
76a6b0c4bf scripts: call readlink in CT context in systemd-autofs-restart.sh
Now readlink is called in host context, this is obviously wrong.

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Eugene Kolomeetz
1525aee1e4 scripts: single style for command substitution in systemd-autofs-restart.sh
Let's use $(...) form, it is more readable, and used in other places.

Signed-off-by: Eugene Kolomeetz <klm@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Stanislav Kinsburskiy
92d8c31750 scripts: fix strings comparison in systemd-autofs-restart.sh
Otherwise the following errors can be triggered:

/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 64: [: =: unary
operator expected
/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 77: [: =: unary
operator expected

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:16 +03:00
Stanislav Kinsburskiy
49bfd9540d scripts: fix mountinfo parsing in systemd-autofs-restart.sh
Fily system type is not necessarily located in the column number 9.
But look like we can rely on " - " pattern: it's always located immediately
after dash.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
9f89937468 scripts: do not use stat to discover fs type in systemd-autofs-restart.sh
Unfortunatelly, autofs doesn't allow to discover it's type. At least without
accessing master process. That means, that stat can be used to determine
whether some other file system is mounted on top of autofs (which we need to
take a decision whether to move restore fs aside or not), because it simply
stuck.
This patch does fs type discovering by parsing CTs mountinfo.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
40682f1561 scripts: save and restore target mount for autofs service
This patch slightly changes the logic on systemd autofs service restart script:

1) It tries to bind-mount the mountpoint on top of autofs (if any) somewhere
before service restart, and replace new mount point on top of autofs (if any)
by the saved one after.

2) It doesn't exit in case of error, trying to recover as much as
possible in case of failure instead and then continue services restarting.

The reason for introducing new logic is that there can be some other,
stateful, file system on top of autofs (say, tmpfs), which state was restore
during migration.
With current script this state will be lost, while this patch allows to
preserve restored mount point after service restart.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
63d61425b7 scripts: join pid namespace in systemd-autofs-restart.sh
Without correct pid namespace systemctl is not able to determine whether
autofs is active or not.
The reason is unaccessible proc due to mount namespace change without pid
namespace change.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
10ffc78dfb scripts: systemd-autofs-restart.sh added
This script restarts systemd autofs services to workaround a problem, when
systemd doesn't consider autofs mount as own after restore (alien device ID
problem)

v4:
Environment variable NS_PID was renamed to CRTOOLS_INIT_PID

v2:
1) Added different checks: for process with pid, active service, systemd based
container.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Dmitry Safonov
a2de3eb831 travis: add coveralls.io support
I suggest to add support for coveralls.io.
It can't show all coverage, as we don't run all tests on travis,
but still everyone who forked CRIU can see instant coverage of
his Travis build. As a nice feature, it will show code cover
increasing/decreasing just after you push a commit - which
could give you a nice hint about content of a new tests.
For this feature, we need to build CRIU with `make GCOV=1`,
which adds --coverage and disables optimizations.

The resulting report looks like this:
https://coveralls.io/builds/6439346
I was thinking about codecov.io also, but it has fewer community,
less fixed issues on github - so I choose this service.

Just a random fun fact:
file-ids.c covered completely on tests, except -ENOMEM return.
Maybe it worth to run fault injections tests on Travis.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:39 +03:00
Andrew Vagin
66299a0065 zdtm: use flake8 to verify zdtm.py
and fix various warnings. For example, we mix tab and space indentations.

v2: add flake8.cfg

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:35 +03:00
Andrew Vagin
851290bfa1 travis: enable compilation for ppc64le
qemu-static from ubuntu/xenial contains a required fix
and now we can execute compilation for ppc64le in travis.

v2: rebase on criu-dev
v3: set QEMU_CPU=POWER8 to avoid segfaults of qemu-ppc64le-static

> > By default, both qemu and gcc5 produce code on ppc64el which will run on
> > POWER7 platform.  However, in debian gcc build instruction, gcc is explicitly
> > built to produce code for POWER8 platform, which, obviously has additional
> > instructions.

v4: use ubuntu:trusty. xenial and wily has a bug:
Processing triggers for libc-bin (2.21-0ubuntu4.1) ...
/sbin/ldconfig.real: 5: /sbin/ldconfig.real: Syntax error: ")" unexpected
/sbin/ldconfig.real: 5: /sbin/ldconfig.real: Syntax error: ")" unexpected

v5: arm, x86, aarch64 were removed by mistake

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-06 14:38:29 +03:00
Cyrill Gorcunov
3e48109a4d criu: Drop prlimit compat layer
Previously when we've been on early stage we
tried to workaround lack of prlimit libc call
simply providing own implementation,  but it
cause problems on some libc configurations so
simply use rlimit64 and __NR_prlimit64 syscall
directly.

The kernel must support __NR_prlimit64 syscall
and provide rlimit64 structure as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-07 13:58:42 +03:00
Cyrill Gorcunov
6094b643dc nmk: build.mk -- Add @libso-y helper
To link dynamic libs (libcompel for example).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:31 +03:00
Cyrill Gorcunov
4a19618ea2 nmk: build.mk -- Add @hostprogs-y mode
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
e4e2f19d85 nmk: msg.mk -- Add host- messages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
1693e539d5 nmk: build.mk -- Shrink gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cfc37c119c nmk: build.mk -- Drop any-match rule
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cb32e353bb nmk: build.mk -- Fix deps for target mode
Don't forget to call objectify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
cd5f7df520 nmk: build.mk -- Squash gen-rule-x into gen-cc-rules
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
0d1eac7ed4 nmk: Drop rules.mk
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>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
580ca3dd68 nmk: rules.mk -- Fix AFLAGS typo
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Cyrill Gorcunov
06cc12a275 nmk: build.mk -- Fix ar rule for external libs
A typo.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
8994edebe1 nmk: build.mk -- Make process depend on Makefile itself
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>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
4527341928 nmk: build.mk -- On cleanup use cleanup-y only
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>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
b07d304905 nmk: utils.mk -- Add cleanify helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Cyrill Gorcunov
6efe63109c nmk: utils.mk -- Drop redundant spaces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00