The main idea is to be able to operate with container
at the moment where its processess and resources are
already restored but the processes are not yet in
running state, ie just before we kick them.
Beside the need of tuning up beancounters (which is vz7
specific feature) this might be useful to make some
additional debug tests from the script.
We can't reuse ACT_POST_RESTORE action or move it because
we can kill the restored processes here and resume them
on a source side as avagin@ explained.
[ xemul: In between POST_RESTORE and PRE_RESUME ghost files
are cleaned up (an a little bit more), so two separate
stages are required and the latter one cannot fail. ]
travis-ci: success for Add "pre-resume" stage
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The test has to do nothing during c/r.
======================= Run zdtm/static/socket_aio in ns =======================
Start test
./socket_aio --pidfile=socket_aio.pid --outfile=socket_aio.out
Run criu dump
Run criu restore
5: Old maps lost: set(["7f0a5188a000-7f0a5188f000 ['rw-p']"])
5: New maps appeared: set(["7f0a51884000-7f0a5188f000 ['rw-p']", "7f0a51883000-7f0a51884000 ['---p']"])
Send the 9 signal to 97
Wait for zdtm/static/socket_aio(97) to die for 0.100000
Reported-by: Mr Jenkins
travis-ci: success for zdtm/socket_aio: add a synchonization between processes
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CID 174800 (#1 of 1): Out-of-bounds write (OVERRUN)
5. overrun-local: Overrunning array buf of 1024 bytes at byte offset 1024 using index n (which evaluates to 1024).
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CID 174774 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: return 1;.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
They pass in userns, so we can run them by default.
travis-ci: success for zdtm: run more tests in userns
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
If we have two sockets and send an upd message from one to another,
we can't be sure that it will be delivered immediately,
there is a change to get from recv(..., MSG_DONTWAIT) EGAIN.
This message is handled asynchronously in a kernel space, so
there may be a small timeout before we get it from another socket.
v2: fix socket6_udp too
Reported-by: Mr Travis
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
If desc is empty we should not try to eval it,
otherwise it would lead to exceptio. So test
for its size as well.
travis-ci: success for zdtm.py: Fix eval error if empty desc file provided
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It is an rudiment of zdtm.sh. Now we don't add ps to a test root
and we want to avoid forks in tests where it isn't supposed to be
called.
travis-ci: success for zdtm: don't call ps from tests
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The previous test uses only libsoccr_restore. This test
creates a tcp connection, then it dumps and restore it.
travis-ci: success for soccr: add one more test to check libsoccr_save/libsoccr_restore
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
travis-ci: success for series starting with [1/1] locks: Check syscalls return values in lock probing
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In some old distros -m state doesn't work correctly and test fails
because test output diverges from expected results. Here we replace
obsoleted -m state with -m conntrack.
travis-ci: success for series starting with [v2,1/2] test: replace cat in Makefiles with awk
Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
cat *.pid works when we have only one running process at any moment.
That's because pidfiles contain no newlines and cat will just
concatenate content of all files present in directory. So, e.g., if we
have pidfiles:
31338
31359
31880
31884
31889
cat will build following string from those pidfiles:
3133831359318803188431889
Obviously, kill would fail to send signals to processes, because it's
now a single big number, which cannot be unambigously split back in
general case.
That's where awk comes in. We don't need to modify C part of tests to
print newlines at end of file. We just order awk to print content of
each file, which adds a newline at end - problem solved, kill can once
again parse, which PIDs it get and send proper signals to them. Also,
should be completely safe for zdtm.py, because it doesn't use Makefiles
and sends signals on it's own.
travis-ci: success for series starting with [v2,1/2] test: replace cat in Makefiles with awk
Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This helps cleanup cr-time mounts a little bit.
travis-ci: success for mount: Add ->collect callback
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Introduce fstype->sb_equal and move btrfs-specific checks
into it.
travis-ci: success for mount: Sanitize sb comparison code
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Before:
[~]# criu check lazy_pages
Looks good.
[~]# criu check --feature lazy_pages
Error (criu/kerndat.c:588): Lazy pages are not available
After:
[~]# criu check lazy_pages
Error: excessive parameters for command check
...skipped usage() output...
Just a little improvement, not to mislead anyone.
Cc: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
There are 3 tests that cover the following cases:
1. single OFD lock
2. overlapped OFD locks
3. inhertited OFD locks
Tests logic is similar to logic of tests for other lock types.
OFD lock specific header-only library was added to avoid code
duplication in the tests.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>