Real ino is u32, while parameters are int. Fix that
to prevent crap with overflows.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CID 163487 (#1 of 1): Unused value (UNUSED_VALUE)
assigned_pointer: Assigning value from old_name to pe->name here, but that stored value is overwritten before it can be used.
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>
xemul: There's bfd over pagemap images:
mike: Yes, but the bfd caches raw protobuf data, while the in-memory pagemap
caches unpacked PagemapEntrie's. There's indeed some duplication, but
you anyway have to go through 'bread -> unpack' to use pagemap.
Also we read the entire pagemap and then close the image thus freeing
the bfd cache.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
======================= Run zdtm/static/socket_aio in h ========================
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
Start test
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
./socket_aio --pidfile=socket_aio.pid --outfile=socket_aio.out
Run criu dump
=[log]=> dump/zdtm/static/socket_aio/24/1/dump.log
------------------------ grep Error ------------------------
(00.003450) Error (util.c:665): exited, status=3
(00.009104) Error (util.c:665): exited, status=3
(00.024564) Error (util.c:665): exited, status=3
(00.024598) Error (netfilter.c:88): Iptables configuration failed: Success
(00.024625) Error (cr-dump.c:1297): Dump files (pid: 24) failed with -1
(00.025117) Error (cr-dump.c:1605): Dumping FAILED.
------------------------ ERROR OVER ------------------------
Wait for zdtm/static/socket_aio to die for 0.100000
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Now we have many tests with the crfail flags. When criu dump fails,
criu may create image files, but doesn't fill them.
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We can call fchdir into the taget directory and call chroot(".")
v2: fix one more comment speaking about proc
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Trying to migrate containers with tomcat and running ab as a test client
(ab -n 1000000 -c 20 http://url/to/test) criu sometimes exited with an
error if in-flight connections were detected. Criu can handle sockets
listening and with established connection. In-flight connections can
happen on sockets which do not yet have a full established connection
(SYN, SYN-ACK, and the last ACK is missing).
This adds a new option to criu:
--skip-in-flight this option skips in-flight TCP connections.
if TCP connections are found which are not yet completely
established, criu will ignore these connections in favor
of erroring out.
With this option criu will skip sockets in this state and let's the client
handle the re-connection.
Signed-off-by: Adrian Reber <areber@redhat.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Makefile:305: warning: overriding recipe for target 'shm-unaligned.pid'
Makefile:290: warning: ignoring old recipe for target 'shm-unaligned.pid'
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CID 161665 (#1 of 1): Uninitialized pointer read (UNINIT)
14. uninit_use: Using uninitialized value vma.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CID 161664 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable re going out of scope leaks the storage it points to.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
CRIU dump should fail if criu can't handle something.
v2: add a separate patch to remove noauto for a few tests
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Looks like noauto was set by mistake for these tests
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This allows pre-dump scripts to know CT root_item pid
and enter into its namespaces.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This one is a little big ugly, see comments for details. At some point we
should invent a better way to do these special cases, since we have them
for freezer, cpuset, and now devices. Perhaps something like fstype, where
you can ask the cgroup how to restore itself.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In particular add support for the new controllers:
* perf_event (nothing here, but may be used by the perf tool so we should
keep it)
* net_cls
* net_prio
* pids
Also add support for many more memory properties that were not implemented
in the first pass, but the container may use.
Note that this commit omits the "devices" controller, because that needs to
be checkpointed and restored in a special way.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This is listed as a global prop, so we don't need to list it individually.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We'll use this in the next patchset where we want to dump global properties
of the freezer cgroup, but none of the special ones for this cgroup,
because they're handled separately.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
to remove forward declarations and create better grouping
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
List "unix_sockets" is used to link external sockets.
Change this, to link all unix sockets there. To differ
really external sockets in fix_external_unix_sockets(),
we may check for socket's already_dumped value.
This may be useful to traverse over all unix sockets
in a namespace.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Export current to allow to use find_unused_fd()
from everywhere.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
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>
The s_dev as well as mnt_id may change during container
migration, so exclude them from the comparision.
Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
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>
It can be dead-lokced:
#0 0x00007fafbf49f6ac in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007fafbf44af1c in _L_lock_2460 () from /lib64/libc.so.6
#2 0x00007fafbf44ad57 in __tz_convert () from /lib64/libc.so.6
#3 0x00000000004022e2 in test_msg (format=0x404508 "Receive signal %d\n") at msg.c:51
#4 <signal handler called>
#5 0x00007fafbf3f2483 in __GI__IO_vfscanf () from /lib64/libc.so.6
#6 0x00007fafbf408f27 in vsscanf () from /lib64/libc.so.6
#7 0x00007fafbf4032f7 in sscanf () from /lib64/libc.so.6
#8 0x00007fafbf449ba6 in __tzset_parse_tz () from /lib64/libc.so.6
#9 0x00007fafbf44c4cb in __tzfile_compute () from /lib64/libc.so.6
#10 0x00007fafbf44ae17 in __tz_convert () from /lib64/libc.so.6
#11 0x00000000004022e2 in test_msg (format=format@entry=0x40458c "PASS\n") at msg.c:51
#12 0x0000000000401ceb in main (argc=<optimized out>, argv=<optimized out>) at ptrace_sig.c:172
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Seems @rpc-> part has been sneaked out (forgot to
push into index), as result it built fine locally,
but not when applied from the patch.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
For handling --cgroup-props, --cgroup-props-file and
--cgroup-dump-controller from RPC interface.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I found the meaning of comparing basename-s for mounts in mount_qual(),
which was removed in v2.1-49-gbcf40bf.
I think it was an attempt to detect siblings (propagated mounts).
Actually it's wrong to compare only basenames for such mounts and
we need to generate full paths for them.
For example:
28 25 0:25 / /sys/fs/cgroup/devices rw shared:10 - cgroup cgroup rw,devices
29 28 0:49 / /sys/fs/cgroup/devices/101/xxx/yyy ...
38 35 0:25 /101 /sys/fs/cgroup/devices/ rw master:10 - cgroup cgroup rw,devices
39 38 0:49 / /sys/fs/cgroup/devices/xxx/yyy ...
28 and 38 are in the one shared group. 29 and 39 siblings and probably
one of them was mounted and another one was propagated.
This patch adds a function to generate a sibling mount point and
use it to propagate mounts
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
mount.c is too big already and the next patch adds one more such functions
with a few unit test, so it's better to add one more source file.
v2: fix compilation on arm and ppc
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This lock will have to be moved into the libsocr which is
not nice, so pull this out of the restore_tcp_queues.
And, since we're extending the section anyway, pull it away
from sk-tcp.c at all. Makes the code a little bit cleaner.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Convert criu images to coredumps and check if they are
readable by readelf.
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In automated tests we use test/crit-recode.py because of performance
benefits(no need to launch python interpreter more than once), but
manual test is still useful for manual testing, so lets make it
work again.
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This patch introduces a new subproject called "criu-coredump". The name
is pretty much self-explanatory, it allows generating coredumps from
criu images. Coredumps are readable and usable by gdb. The structure is
something in the middle of kernel-generated and gdb-generated core dumps.
This is a first iteration of core-dump patch series. It introduces
ability to generate gdb-operatable core dump only for x86_64 machines.
To support other architectures there will be a set to introduce proper
structures for notes section of the core dump. It is also worth noting,
that we still leave some notes(SIGINFO primarily) not fullfilled, as
I still need to figure out what to put in there in our case, where no
signal is involved in triggering core dump generation and other
caveats like zeroed vvar(we have problems with it withing CRIU itself
as well as gdb has some difficalties with it) and vsyscall vmas.
One can already use produced core dump with gdb, there is also
a quick simple demo https://asciinema.org/a/18936 .
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
For example in containers case there might be a number
of controllers mounted on the node which we should not
carry inside image when container is migrated. So
add ability to dump predefined controllers only
specified via command line --cgroup-dump-controller
option.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>