2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00
Commit Graph

8651 Commits

Author SHA1 Message Date
Pavel Emelyanov
bee9eacad4 files: Move reg files into files image
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:40 +03:00
Pavel Emelyanov
fe6fa3bec3 image: Introduce files.img and file_entry
There are two goals of this merge. First is to reduce the amount
of image files we generate and scan on restore. The latter is
more importaint, as even if we have no weird stuff like signalfd,
we still try to open this file. So after the merge we try to
open ~15 image files (out of ~30) less %) which is nice.

The 2nd goal is to simplify the C/R support for SCM messages.
This becomes possible with the fact, that all files we have can
be distinguished by their ID only, w/o type. This, in turn,
makes image layout for SCMs much simpler.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:39 +03:00
Pavel Emelyanov
904e7b383b file: Introduce prepare_files()
I'm about to merge all the file images into one big image,
so here's the place that would read it and collect.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:39 +03:00
Pavel Emelyanov
b7b3b19f7e pb: Add a helper to collect single entry
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:39 +03:00
Pavel Emelyanov
41df032e12 Merge pull request #373 from ISilence/master
Update README.md
2017-08-09 13:45:21 +03:00
Pavel Begunkov
447312cf58 docs: Fix errata in README.md
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
2017-08-09 10:10:42 +03:00
Pavel Emelyanov
43d4a83511 Update README.md
(Try to) Fix the readme problems found by the feedmereadmes guys:

* Tuned up the tagline
* Added info about what for, history, competitors, etc.
* Put more links for potential contributors
2017-08-08 15:59:00 +03:00
Pavel Emelyanov
43ed56e312 net: Support "dumping" dummy sit device
This device is an API endpoint, just skip it. Also, prepare the
ground for sit dump.

Issue #11

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-25 22:18:37 +03:00
Pavel Emelyanov
b0b9a97086 criu: Version 3.3
Most of the changes this time are preparation for future
new features and optimizations, that hasn't yet been well
tested and polished.

However, we have several new features. The most important
one is the --tcp-close option to help migration of Docker
containers, that constantly change their IP address.

And, as usually, a set of bugfixes.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v3.3
2017-07-18 21:55:27 +03:00
Cyrill Gorcunov
245b4b3698 files: Don't access value from stack in outer contex
The struct fd_link link allocated in inner context might be
freed before dump call (depending on compiler), instead
use a safer approach.

Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Pavel Emelyanov
e3311ea37b cgroup: Skip unified hier controllers (v2)
The unified hierarchy controller doesn't have any name, so criu hangs
while parsing this sort of strings.

Let's skip those for now, until we implement cgroup2 support.

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

v2: Code comments

Reported-and-tested-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Pavel Emelyanov
3ef5a5e20a sk-packet: Don't open image when not needed
It looks like this call to open_image was left from the
times when we reworked packets sending and collected
them early.

✓ travis-ci: success for sk-packet: Don't open image when not needed
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Bernhard M. Wiedemann
eda4bc554a kdat: allow to override build time
in order to allow for reproducible builds.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Veronika Kabatova
3c62d950e2 Change tcp-close option to negated style
Code for tcp-close option was added after boolean-valued options
were modified to accept their negations as well. Since tcp-close
option works only with boolean values and does not accept any
argument, it should be wriiten in the same manner to allow users
to override the value when using configuration files.

Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Veronika Kabatova
8fcfa59b04 Add long option for verbosity changes
Only long options are supported in configuration files. "-v" is the only
short option which doesn't have a corresponding long option, therefore
users wouldn't be able to setup verbosity in configuration files without
this patch.

Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Alice Frosi
adc47efdd2 zdtm/static/sem: Use "union semun" instead of int
Use "union semun" for semctl() to make testcase also work on s390x.

Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Michael Holzheu
a01d879b62 zdtm/static/fdt_shared: Fix buffer size
The TEST_STRING "Hello World!" has 13 bytes size. Therefore the 10 bytes
used for the buffer size are not sufficient.

Fix this and use sizeof() to be on the safe side.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Michael Holzheu
2f886ca174 criu/mount: Fix flags cast and sizeof(sflags)
The "args" parameter in apply_sb_flags() is unsigned long. Therefore also
use unsigned long for the cast.

The "sflags" variable in do_new_mount() is unsigned long. Therefore use
sizeof(sflags) instead of sizeof(int).

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Michael Holzheu
3ed5c2f0ee criu/files: Fix wait_fds_event() for 64 bit platforms
The htole64() function returns a 64 bit value. This is stored in
a 32 bit integer in wait_fds_event() which results in 0 for big-endian
64 bit platforms. The fuxtex() system call also requires 32 bit values.

Fix this and use htole32() also for 64 bit platforms.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Andrei Vagin
624aa178dc zdtm: don't call Popen() without wait()
We have to collect all zombies

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Adrian Reber
d77d8cc402 fix building with newer glibc
Newer glibc releases have removed SIGUNUSED from bits/signum.h which
breaks building criu on those systems:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8082d91e1c449e0cb137468b731004a5e605c8c6

SIGSYS returns the same value as SIGUNUSED and testing has shown
that criu still successfully completes zdtm with this patch.

Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:27 +03:00
Pavel Emelyanov
ce68a85cee fsnotofy: Do remap resolve in post-prep
The remap is searhced by dev:ino pair that is known only when
root task starts (and opend the remap). The collection stage
is about to happen in crtools, so move the resolve in post-prep.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:47 +03:00
Pavel Emelyanov
c517e4ab07 unix: Move stale unlink into post-prep
The call to unlink() should happen in root task context,
while the collection stage is about to be moved into the
crtools, so keep the stale-unlink piece in post-prep
for a socket.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:47 +03:00
Pavel Emelyanov
62f4275de2 unix: Shift code right (cont)
This is the continuation of the previous patch.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:47 +03:00
Pavel Emelyanov
01e9542fb2 unix: Sanitize peer resolution with post-prep
Having pprep_head built-in it becomes much easier
to do socket-by-socket peer resolution.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:47 +03:00
Pavel Emelyanov
d9d9686f38 restore: Tune up _once stuff
Having ppreh_heads we can simplify the _once helper
by re-using the .next field.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:47 +03:00
Pavel Emelyanov
a9001753c9 unix: Use once helper for post-prep
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Emelyanov
0a820d8db4 restore: Do not allocate heads for post-prep actions
Now the post-prep actions are xmalloc()-ed then added to the list.
Let's make it sit right on the structures that need the post-prep,
this would make some things much simpler and nicer soon.

The approach is inspired by kernel rcu_head-s :)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Emelyanov
d73a08b176 image: Fix "collect happenned" flag
This flag now means "image was opened", while the "empty image"
concept makes this always true. Since there's one user of this
flag, which is obviously incorrect, remove the latter and fix
the former to mean "at least one object was read".

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Andrei Vagin
c0857d2517 zdtm: check /proc/sys/kernel/taint and fail if it is non-zero
We don't want to run tests, if a kernel has a problem. And we want
to know when the taint flag is changed.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Emelyanov
8494d70833 irmap: Duplicate handle memory when queueing for predump
With the recent cleanups in fdinfo parsing the memory
allocation policy for entries has changed, thus keeping
a pointer on the entry handle is no longer valid (it
will be freed soon).

Said that -- duplicate the memory for queued irmap work.

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

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Begunkov
70c0b47d44 zdtm: skip 'tcp-close' tests if restore is skipped
'tcp-close' is a option that replaces connected tcp-sockets with
'closed' ones during restoring, therefore it have no sense without
restore stage. Thus let's skip related tests if the 'norst' flag was
specified.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Begunkov
3c9290d278 files: Fix compilation errors
1: Signed underflow
criu/files-reg.c: In function ‘open_path’:
criu/files-reg.c:1299:14: error: iteration 2147483647
invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  while (count--) {
         ~~~~~^~

2: Uninitialized variable
criu/files-reg.c: In function ‘make_parent_dirs_if_need’:
criu/files-reg.c:1354:13: warning: ‘count’ may be used uninitialized in
  this function [-Wmaybe-uninitialized]

P.S. arch linux 4.7.5-1. gcc (GCC) 6.3.1 20170109

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Emelyanov
e42c769555 proc: Remove unneeded callback arg from parse_fdinfo
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Emelyanov
c14cede697 timerfd: Rework parse_fdinfo not to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Pavel Emelyanov
e5b4ef20fc fanotify: Rework parse_fdinfo not to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Pavel Emelyanov
3150b56ddc inotify: Rework parse_fdinfo not to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Pavel Emelyanov
cd8db2edc5 eventpoll: Rework parse_fdinfo not to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Pavel Emelyanov
54fb48d715 signalfd: Rework parse_fdinfo no to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Pavel Emelyanov
c94d0cacb4 eventfd: Rework parse_fdinfo not to use callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Kirill Tkhai
0dcb780a8f utils: Add "test/zdtm/lib" directory definitions to tags file
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:45 +03:00
Kir Kolyshkin
beda098364 compel: be silent if no errors
In case of success, we want to be silent when on default log level.

This is a time-honored UNIX tradition, who we are to break it?

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Pavel Emelyanov
5cac11310f fsnotify: Fix bad field name in list iterations
Surprisingly, but

offsetof(inotify_wd_entry, node) == offsetof(fanotify_mark_entry, node)

even though both structures have node field in the middle and the
fields sitting above one are totally different.

So the code works, but ... we're risking :)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Pavel Emelyanov
d8dd470367 zdtm: Tests for ghost files with holes
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Pavel Emelyanov
c7ab0cd934 crit: Add support for chunked ghost images
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Pavel Emelyanov
0ce86c3607 ghost: Add chunked ghost files
If the ghost file is too big, it might make sence to try seeking
for holes in it, thus reducing the image size.

We've seen this once for tmpfs files in issue #230.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Pavel Emelyanov
c3cff79cd6 ghost: Fixup mkreg_ghost prototype
We don't need gf there, but will need more than just mode.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:44 +03:00
Cyrill Gorcunov
1ddcd443ba test: shm-unaligned -- Use unique key
For convenient simultaneous run.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:43 +03:00
Dmitry Safonov
3299759865 x86/ia32: fix build with DEBUG=1
GCC isn't happy if we use %rbp as register for local variable
with -ggdb3 option.
Which resulted in the following build error for `make DEBUG=1`:
> In file included from criu/arch/x86/crtools.c:10:0:
> criu/arch/x86/include/asm/compat.h: In function ‘do_full_int80’:
> criu/arch/x86/include/asm/compat.h:50:1: error: bp cannot be used in asm here

Fix it by saving/restoring %rbp around 32-bit syscall manually.
Just while at it - add a comment about r8-r11 clobbers.

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:43 +03:00
Pavel Begunkov
0f5e2217ef zdtm: Check that 'tcp-close' option closes sockets
There are 2 test cases:
1. Connected socket should be restored in the closed state
2. Listening socket state should not change after restore

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:43 +03:00