2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 12:57:57 +00:00

7582 Commits

Author SHA1 Message Date
Begunkov Pavel
34c9119acd locks: Add ofd locks c/r
OFD locks logic reuses existing locks c/r functionality.

https://github.com/xemul/criu/issues/42
travis-ci: success for series starting with [1/2] locks: Add ofd locks c/r
Signed-off-by: Begunkov Pavel <asml.silence@gmail.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-01 17:37:11 +03:00
Andrei Vagin
cf72cedd5f Revert "zdtm: use a unix socket instead of a pipe to synchronizer processes"
Unfortunately the kernel wakes up only one waiter even
if they waits with MSG_PEEK, so the introduced scheme doesn't work.

Reported-by: Mr Jenkins
travis-ci: success for Revert "zdtm: use a unix socket instead of a pipe to synchronizer processes"
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-25 10:45:21 +03:00
Dmitry Safonov
d9486bd720 arm/pie/build: do not produce relocatable parasite object
With `-r` option relocation to parasite_service
was not made on ARM:
0x76dbc018:	bl	0x76dbc018		0xebfffffe
(You may saw it with objdump also).

This leaded to hang at "Putting tsock" message:
(01.368297) ----------------------------------------
(01.368321)
(01.368339) Collecting fds (pid: 13503)
(01.368360) ----------------------------------------
(01.368535) Found 3 file descriptors
(01.368564) ----------------------------------------
(01.368648) Dump private signals of 13503
(01.368708) Dump shared signals of 13503
(01.368761) Parasite syscall_ip at 0x10000
(01.369605) Set up parasite blob using memfd
(01.369641) Putting parasite blob into 0x76cc5000->0x76e1f000
(01.369755) Dumping GP/FPU registers for 13503
(01.369818) Putting tsock into pid 13503

Link against lib.a which also fixes build for aarm64.

Reported-by: alex vk <avankemp@gmail.com>
Reported-by: long.wanglong <long.wanglong@huawei.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Backported-from-criu-dev-by: Dmitry Safonov <dsafonov@virtuozzo.com>
2017-01-23 16:05:01 +03:00
Pavel Emelyanov
e6156f31dd criu: Version 2.10
So, this time we had TCP transitional states support, but it was
in semi-finished libsoccr library :) And in order to have the TCP
C/R fixed we fixed the library and are now ready to release them
both.

Said that, two main features of the Waxwing release are

* libsoccr -- the library for TCP sockets C/R
* TCP transitional states C/R

Also we have a set of bugfixes, caught performance issue on Xen
and a little bit more.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2.10
2017-01-16 12:06:01 +03:00
Pavel Emelyanov
a97be820a4 criu: Disable breakpoint-based restore temporarily
As described in issue #268, breakpoints degrades restore performance
in Xen guests. Untill we find out what's going on we disable them.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:12:41 +03:00
Pavel Emelyanov
b9b34d4276 soccr: Add call to release the soccr handler
It's the same as libsoccr_resume, but doesn't mess with
the socket file descriptor. Just release the handle.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:07:10 +03:00
Andrei Vagin
1fb852bb20 soccr: add a test
This test construct both ends of tcp connections and
check that it works in both directions.

travis-ci: success for soccr: add a test
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:50 +03:00
Pavel Emelyanov
d9132d45cc tcp: Move TCP-repair checking code into cr-check.c
travis-ci: success for series starting with [1/2] tcp: Move window checking code into cr-check.c
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:50 +03:00
Pavel Emelyanov
044a29af63 tcp: Move window checking code into cr-check.c
travis-ci: success for series starting with [1/2] tcp: Move window checking code into cr-check.c
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:50 +03:00
Andrei Vagin
67d548e9fe tcp: bind tcp sockets after enabling the repair mode
Only sockets in the repair mode can be bound to the same
port a few time, what is required to restore tcp connects.

v2: move bind() into libsoccr
v3: fix an error message
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:50 +03:00
Pavel Emelyanov
8664130b17 soccr: Move src/dst address from _data
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Pavel Emelyanov
ff4e387b09 soccr: Move queue pointers from _data
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Pavel Emelyanov
4b9b56b235 soccr: Introduce flags for memory passing
There will be calls that return objects from inside library
and vice versa -- accept objects from caller. Let's have a
flag controlling who's going to free the mem in question.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Pavel Emelyanov
332b945f79 soccr: Rename API calls to save/restore
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
ed5081041c soccr: don't dereference data before null check
CID 173075 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking data suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

travis-ci: success for soccr: don't dereference data before null check
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
f3e3958bb0 soccr: restore queues from soccr
Looks like it is internal logic too, so it may be better to move into the library too.

travis-ci: success for soccr: restore queues from soccr
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Mike Rapoport
a35e84d82b scripts/install-debian-packages: add libnet-dev
travis-ci: success for scripts/install-debian-packages: add libnet-dev
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
63e128a968 test: skip pre-dump images in socket-tcp*.hook
These hooks opens inetsk.img, but it doesn't exist if
processes were pre-dumped.

travis-ci: success for test: skip pre-dump images in socket-tcp*.hook
Reported-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
1a89b88c08 zdtm: check sequence numbers for tcp sockets
They have to be the same on each iteration.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
d61c75bc5d zdtm: add test cases on TCP_SYN_SENT
travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
950b33c82e zdtm: add a test for unconnected tcp sockets
Check source and destination addresses for closed tcp sockets.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
7ce065a186 zdmt: add more checks into socket-closed-tcp
Check source and destination addresses for closed tcp sockets.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrey Vagin
16644f731b zdtm: check sockets in the TCP_CLOSING state
TCP_CLOSING both sides have shutdown but we still have
            data we have to finish sending

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrey Vagin
903ed07084 zdtm: add test cases on TCP_CLOSE_WAIT and TCP_LAST_ACK states
TCP_CLOSE_WAIT remote side has shutdown and is waiting for
               us to finish writing our data and to shutdown
               (we have to close() to move on to LAST_ACK)

TCP_LAST_ACK   out side has shutdown after remote has
               shutdown.  There may still be data in our
               buffer that we have to finish sending

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrey Vagin
7c07a7fb4b zdtm: add test cases on TCP_FIN_WAIT* states
TCP_FIN_WAIT1 our side has shutdown, waiting to complete
	  transmission of remaining buffered data

TCP_FIN_WAIT2 all buffered data sent, waiting for remote
	  to shutdown

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
f0f2496da0 tcp: add support for synsent
libsoccr knows how to restore these sockets.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
5cb2893f0e tcp: allow to dump intermediate closing states
soccr already knows how to restore this sockets.

CRIU has to ...:
* unlock all packets with the SOCCR_MARK mark
* request half-closed socket via socket_diag
* transpit src and dst addresses to libsoccr

v2: remove SOCCR_FLAGS_ACKED_FIN
travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
e7f03fbae1 inet: dump source and destination addresses for closed sockets
If a socket has been closed, it still has both addresses and
we need to dump them.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
6e68374369 soccr: add support for syn-sent sockets
For that we restore all sockets properties and then
disable the repair mode before calling connect() and
the kernel will sent a syn packet and move the socket
into the sys-sent state.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
b1751244aa soccr: add support for half-closed sockets
A socket is in one of half-closed states, if it sent a fin packet
or it received a fin packet.

CRIU plays with fin packets to restore half-closed states too.

When we need to sent a fin packet from a socket, we can call
shutdown(SHUT_WR). When a fin packet has to be restore in
a received queue, criu generate a fin packet and send it via
a raw ip socket.

A raw packet is sent with the SOCCR_MARK mark to be able
to not block it.

v2: remove the SOCCR_FLAGS_ACKED_FIN flag
    introduce sets of bits for different actions with fin packets

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
fd2995cc5b soccr: move connect from criu to soccr
We will need to disable the repair mode before connect()
to restore syn-sent sockets. And even now connect() looks
like a part of internal logic of libsoccr.

travis-ci: success for series starting with [01/21] build: install libnet-dev
v2: remove libsoccr_set_sk_data_unbound() from soccr.h
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
cdc6f4c107 soccr: add source and destination addresses to libsoccr_sk_data
These addresses will be used to restore half-closed sockets,
we will need to send a fake fin packet for that.

And in the next patch connect() will be moved into soccr.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
a73eb5300d soccr: add prefixes for log messages and print errno
loge() will start a message with "Error:" and
logd() will start a message with "Debug:".
logerr() will add strerror(errno) to the end of messages.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
cb7948d9ef inet: dump actual states of tcp sockets
We get sockets from task_diag, then we block network and dump sockets.

A socket state can be changed between first two steps, so lets get
a socket state on the third step and dump it.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
beb57e9524 make: add deps for libsoccr
Without this patch when we change libsoccr, criu isn't rebuilt.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
d9d3dc7a09 criu: check whether tcp_repair can be enabled for half-closed sockets
Originally the repair mode could be enable only for sockets
in closed and established states. Starting with the 4.10 kernel,
it is possible to enable the repair mode for all connected sockets
and now we can dump syn-sent and half closed sockets.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:46 +03:00
Andrei Vagin
aec9eb921f build: install libnet-dev
It will be used to generate tcp packets for restoring half-closed sockets.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:43 +03:00
Adrian Reber
6d07a4f95b soccr: add '\n' to all loge/logd
Some of the loge messages where missing a '\n'. For consistency this
adds '\n' to all messages which were missing it.

travis-ci: success for libsoccr debug/info messages (rev2)
Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Dmitry Safonov
c8729c220d criu: enable soccr logging
Initialize logging function and log_level for libsoccr.
Otherwise all soccr messages are skipped.

travis-ci: success for libsoccr debug/info messages
Reported-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Tycho Andersen
d0762eff04 build: only generate soccr config.h if necessary
Without this, any rebuild fails with:

make[1]: Entering directory '/home/ubuntu/criu'
make[1]: Entering directory '/home/ubuntu/criu'
  GEN      .gitid
  GEN      criu/include/config.h
  GEN      /home/ubuntu/criu/criu/include/version.h
make[1]: 'compel/plugins/std.built-in.o' is up to date.
make[1]: Leaving directory '/home/ubuntu/criu'
ln: failed to create symbolic link '/home/ubuntu/criu/soccr/config.h': File exists
Makefile:217: recipe for target '/home/ubuntu/criu/soccr/config.h' failed
make: *** [/home/ubuntu/criu/soccr/config.h] Error 1
make: *** Waiting for unfinished jobs....
make[1]: Entering directory '/home/ubuntu/criu'
make[1]: 'compel/compel-host' is up to date.
make[1]: Leaving directory '/home/ubuntu/criu'
make[1]: Leaving directory '/home/ubuntu/criu'

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Cyrill Gorcunov
207bbd891f soccr: Generate config.h dynamically
Otherwise there is a broken symlink which makes tags/etags unhappy.

travis-ci: success for soccr: Generate config.h dynamically (rev5)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
[extended .gitignore, maked link relative to sources]
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Dmitry Safonov
f92b8d9c44 soccr: rectify Alpine build
Made a symlink to CRIU's generated config.h, played with
moving some code to soccr.h header.
Changed types from u32 to uint32_t, otherwise we should
include CRIU's "int.h" in soccr, but I'm lazy to add that.

Cc: Pavel Emelyanov <xemul@virtuozzo.com>
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>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
51e301571a soccr: Add soccr.h's comments
TODO: Write proper man page/doc.
TODO: Document that the library spoils the reuseaddrs option on socket.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
c5de18a399 soccr: Handle connection state
For now we only support ESTABLISHED state, so this is mostly
a preparation for the future extention.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
cab3f17645 soccr/tcp: Restore queues using library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
826a86e496 soccr/tcp: Restore socket's info after binding it
With window parameters, we have stuff to restore before
queues and after queues.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
611dc707e2 soccr/tcp: Restore socket's info before binding it
In TCP repair some stuff should be restored before calling
connect/bind on socker and some -- after it.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
efdcf3776a soccr/tcp: Prepare connection info for restore
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
c08eb3dde1 soccr/tcp: Read queues contents using library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
d98c0ea67c soccr/tcp: Fill actual connection info using the library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00