- 06 Feb, 2017 17 commits
-
-
Kirill Tkhai authored
Since transport fd is per-task, this method is not need anymore. Kill it. travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
Move reopen_fd_as() from receive_fd() to this function. Note, that recv_fd_from_peer() has other callers, and all of them are OK with receiving real fds (before, they received arbitrary fds, and they OK with any fds). travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
Don't wait for "prepare" stage of every peer's fd. Just send everything to a peer's global transport socket, and the peer will find appropriate fd, it needs at the moment. travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
For moving to a single transport socket scheme, we should be able to receive a fd, which is not need at the moment, but it will be used in the future. So, we receive a further fd, and then continue to wait the fd, we really need now. v3: Delete excess BUG_ON(). Rename main patch funtion to keep_fd_for_future(). Rename second funtion to task_fle(), and make it have "task" argument. travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
No functional changes v3: Also do real_pid futex initialization travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
No functional changes travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
No functional changes travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
For moving to a single transport socket scheme, we need to be able to differ fds in receive queue from each other. Add a fle pointer as identifier for that. v2: Rebase on compel travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
System call sys_futex() requires that (from futex(2)): "On all platforms, futexes are four-byte integers that must be aligned on a four-byte boundary". travis-ci: success for locks: Mask futexes aligned Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kir Kolyshkin authored
1. LOGROTATEDIR is not used since commit f4e9a1df ("make: don't install service and logrotate configs"). 2. SYSTEMDUNITDIR is not used since commit 10d5e9a4 ("criu: scripts: remove criu service files"). 3. install-tree target was *never* used, makes no sense to keep it. While at it, also - sort the variables in "export" statement to match the order of appearance in Makefile; - don't export DESTDIR (it is exported by default as it always comes from the make command line); - remove unused variable from INSTALL.md. travis-ci: success for Makefile.install fixes Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kir Kolyshkin authored
Commit 6a51c7ec ("make: Allow to install in custom dirs") replaced all := assignments with ?=, effectively disabling the LIBDIR guessing logic (as once a variable is assigned, further ?= make no sense). That commit description says that setting PREFIX from make command line didn't work. I can't find the original bug report but according to GNU make documentation (see [1], [2]) as well as to my best knowledge, any variable set in Makefile can be overridden from the command line, unless "override VAR = value" is used in the Makefile. The result of this patch is LIBDIR is correctly set for distros such as Fedora and Debian, so "make install" works more correct. Surely, any variable can still be overriden from the command line. I have also checked the build of Fedora package from criu.spec with this change -- it works fine. Now, I am not sure why it was not working for the original bug reporter. The only hypothesis I have is he tried to do something like PREFIX=/usr make instead of make PREFIX=/usr If this was the case, it was not a bug but wrong usage. While at it, fix LIBDIR description in INSTALL.md. [1] https://www.gnu.org/software/make/manual/html_node/Overriding.html [2] https://www.gnu.org/software/make/manual/html_node/Override-Directive.html travis-ci: success for Makefile.install fixes Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kir Kolyshkin authored
These variables doesn't need to end with a slash. This helps the next patch. travis-ci: success for More polishing for compel cli Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
They are the same in meaning and may collide on building. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org>
-
Cyrill Gorcunov authored
Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org>
-
Cyrill Gorcunov authored
We gonna share this file between subprojects so lets minimize deps on headers, only syscalls are left here for non libc compiling. travis-ci: success for Common headers Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrei Vagin authored
musl-libc fixed inconsistency between posix and kernl msghdr structures by adding pad-s. It initializes all pad-s before calling recvmsg and sendmsg syscalls. CRIU calls raw system calls from pie code, so we need to intialize pads too. In addition, we don't initialize msg_flags and iov_len. https://github.com/xemul/criu/issues/276 https://travis-ci.org/kolyshkin/criu/builds/198415449Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kir Kolyshkin authored
C compiler might generate calls to memcpy, memset, memcmp, and memmove as it seem fit (so far we haven't seen memmove being required). That means we need to provide our own versions of it for code which is not linked to a libc. We already have a solution for that in commit bdf60512 ("pie: provide memcpy/memcmp/memset for noglibc case") but we faced another problem of compiler trying to optimize our builtin_memset() by inserting calls to memset() which is just an alias in our case and so it lead to infinite recursion. This was workarounded in commit 8ea0ba7d ("string.h: fix memset over-optimization with clang") but it's not clear that was a proper fix. This patch is considered to be the real solution. As we don't have any other implementations of memset/memcpy/memcmp in non-libc case, we can call ours without any prefixes and avoid using weak aliases. Implementation notes: 1. mem*() functions code had to be moved from .h to .c for the functions to be compatible with their prototypes declared in /usr/include/string.h (i.e. "extern"). 2. FORTIFY_SOURCE needed to be disabled for code not linked to libc, because otherwise memcpy() may be replaced with a macro that expands to __memcpy_chk() which of course can't be resolved during linking. https://travis-ci.org/kolyshkin/criu/builds/198415449Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
- 03 Feb, 2017 12 commits
-
-
Dmitry Safonov authored
Now changes in top-Makefile, middle-Makefile will result in a correct recompiling, as it's expected: [criu]$ touch criu/Makefile [criu]$ make <...> DEP criu/arch/x86/sigframe.d DEP criu/arch/x86/sigaction_compat.d DEP criu/arch/x86/crtools.d DEP criu/arch/x86/cpu.d DEP criu/arch/x86/call32.d CC criu/arch/x86/call32.o CC criu/arch/x86/cpu.o CC criu/arch/x86/crtools.o <...> travis-ci: success for Fix rebuild on Makefile changes Reported-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
Result: [japdoll@dsafonov criu]$ touch Makefile [japdoll@dsafonov criu]$ make make[1]: Entering directory '/home/japdoll/tools/criu' PBCC images/macvlan.pb-c.c DEP images/macvlan.pb-c.d PBCC images/autofs.pb-c.c DEP images/autofs.pb-c.d PBCC images/sysctl.pb-c.c DEP images/sysctl.pb-c.d <...> travis-ci: success for Fix rebuild on Makefile changes Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kir Kolyshkin authored
We found a weird case of parasite code dying of SIGSEGV when clang is used as a compiler (see [1] for more details). Apparently, it was caused by clang optimizing our builtin_memset() by inserting a call to memset(). It is a valid compiler optimization, aside from the fact that in our code memset() is defined as a weak alias to builtin_memset(), which of course lead to infinite recursion and stack growth. This might be a bug in compiler, but there are ways to avoid it: 1. Rewrite builtin_memset() in asm (note it needs to be done for every architecture supported). 2. Disable compiler optimizations for this code (say, by using -O0). 3. Declare the pointer inside builtin_memcpy() as volatile. The last approach looks more appealing -- mostly for being simple. [1] https://github.com/xemul/criu/issues/279 travis-ci: success for string.h: fix memset over-optimization with clang Cc: Andrei Vagin <avagin@virtuozzo.com> Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
So, after the patch struct pid will look as: struct pid { struct pstree_item *item; pid_t real; int state; struct { pid_t virt; struct rb_node node; } ns[1]; }; travis-ci: success for Make pstree_item::pid allocated dynamically Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
Add a link from task's pid to pstree_item. Threads have this link set in NULL. travis-ci: success for Make pstree_item::pid allocated dynamically Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
The expression rb_entry(node, struct pstree_item, pid.node) may create a fake impression, that we dereferrence pstree_item for threads too, which is a BUG, but it's not so, because we are only interested in its ->pid field. But anyway, escape of pstree_item, iterate over struct pid, which are more readable. travis-ci: success for Make pstree_item::pid allocated dynamically Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
This will be used to pass MSG_DONTWAIT in next patch. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Kirill Tkhai authored
Replace "-1" return with errno codes. ENOMSG and EBADFD were choosen to do not cross with standard recvmsg() errors (described in its man page). This patch is need as preparation to making recv_msg() be able to be non-block, and return EAGAIN and EWOULDBLOCK in case of no data. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrei Vagin authored
cr_page_server() returns pid, if it is executed as a daemon otherwise it returns an error code. crtools returns 0 only if cr_page_server() returns a positive value, what is obviously wrong. travis-ci: success for crtools: close a signal descriptor after passing a preparation stage (rev6) Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrei Vagin authored
travis-ci: success for crtools: close a signal descriptor after passing a preparation stage (rev6) Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrei Vagin authored
This patch adds the --siganl-fd FD option to specify a file descriptor. CRIU will write '\0' to this descriptor and close it after passing a preparation stage. It is alternative way to demonizing a criu process after a preparation stage. It's imposiable to get exit code, if a process has daemonized. The introduced way allows to wait a preparation stage and to get an exit code. It can be easy used from shell and other script languages. v3: fix a help message v4: Here is a sequence of actions how it can be used: * open a pipe * run a service with the pipe[1] as status_fd * read(pipe[0]) to wait a moment when the service will be ready to accept connections * do a work which requires the service * wait the service process to gets its exit status to be sure that everything okey travis-ci: success for crtools: close a signal descriptor after passing a preparation stage (rev6) Cc: Mike Rapoport <mike.rapoport@gmail.com> Cc: Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
All kernel options, features that depend on kernel version should be checked with `criu check`. Cc: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
- 01 Feb, 2017 11 commits
-
-
Pavel Begunkov authored
This is needed in cases when kernel doesn't support OFD locks. (OFD locks were added in 2014). travis-ci: success for zdtm: Add checkskip scripts for OFD locks 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>
-
Andrei Vagin authored
* Don't send uninitialized data * Close descriptors more carefully * Add comments travis-ci: success for zdtm: improve socket-tcp-close-wait.c Reported-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com> Reviewed-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrey Ryabinin authored
Some distros put 'ip' util in /bin directory. travis-ci: success for tests: add '/bin/ip' to deps in addition to '/sbin/ip' Signed-off-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrey Ryabinin authored
'info' array is off-by-one, nla_parse_nested() requires destination array (i.e. 'info') to have maxtype+1 (i.e. IFLA_INFO_MAX+1) elements: ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffef823e3f8 WRITE of size 48 at 0x7ffef823e3f8 thread T0 #0 0x7f9ab7a3915b in __asan_memset (/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libasan.so.2+0x8d15b) #1 0x7f9ab6d4e553 in nla_parse (/usr/lib64/libnl-3.so.200+0xa553) #2 0x4acfb7 in dump_one_netdev criu/net.c:445 #3 0x4adb60 in dump_one_ethernet criu/net.c:594 #4 0x4adb60 in dump_one_link criu/net.c:665 #5 0x48af69 in nlmsg_receive criu/libnetlink.c:45 #6 0x48af69 in do_rtnl_req criu/libnetlink.c:119 #7 0x4b0e86 in dump_links criu/net.c:878 #8 0x4b0e86 in dump_net_ns criu/net.c:1651 #9 0x4a760d in do_dump_namespaces criu/namespaces.c:985 #10 0x4a760d in dump_namespaces criu/namespaces.c:1045 #11 0x451ef7 in cr_dump_tasks criu/cr-dump.c:1799 #12 0x424588 in main criu/crtools.c:736 #13 0x7f9ab67b171f in __libc_start_main (/lib64/libc.so.6+0x2071f) #14 0x4253d8 in _start (/criu/criu/criu+0x4253d8) Address 0x7ffef823e3f8 is located in stack of thread T0 at offset 264 in frame #0 0x4ac9ef in dump_one_netdev criu/net.c:364 This frame has 5 object(s): [32, 168) 'netdev' [224, 264) 'info' <== Memory access at offset 264 overflows this variable [320, 1040) 'req' [1088, 3368) 'path' [3424, 3625) 'stable_secret' Increase 'info' size to fix this. Fixes: b705dcc3 ("net: pass the struct nlattrs to dump() functions") travis-ci: success for net: fix stack out-of-bounds access in dump_one_netdev() Signed-off-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Acked-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrey Ryabinin authored
Ghost file entry used right after it has been freed: ERROR: AddressSanitizer: heap-use-after-free on address 0x60700000dc50 READ of size 4 at 0x60700000dc50 thread T0 #0 0x46e819 in open_remap_ghost criu/files-reg.c:312 #1 0x46e819 in prepare_one_remap criu/files-reg.c:461 #2 0x46e819 in prepare_remaps criu/files-reg.c:507 #3 0x45af00 in root_prepare_shared criu/cr-restore.c:235 #4 0x45af00 in restore_task_with_children criu/cr-restore.c:1421 #5 0x7efc71e85f0c in clone (/lib64/libc.so.6+0xe7f0c) 0x60700000dc50 is located 32 bytes inside of 80-byte region [0x60700000dc30,0x60700000dc80) freed by thread T0 here: #0 0x7efc7305184a in __interceptor_free (/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libasan.so.2+0x9884a) #1 0x46e4df in open_remap_ghost criu/files-reg.c:309 #2 0x46e4df in prepare_one_remap criu/files-reg.c:461 #3 0x46e4df in prepare_remaps criu/files-reg.c:507 previously allocated by thread T0 here: #0 0x7efc73051b82 in malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libasan.so.2+0x98b82) #1 0x7efc7277a8ea in protobuf_c_message_unpack (/usr/lib64/libprotobuf-c.so.1+0x48ea) #2 0xd528232002838017 (<unknown module>) Just move freeing after the last 'gfe' usage to fix this. Fixes: d0097b2d ("files: Support ghost directories restore") travis-ci: success for files-reg: fix use-after-free in open_remap_ghost() Signed-off-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
Opening /proc/<pid>/pagemap in userns is only available since linux v4.3 or later, after commit 1c90308e7a77 (pagemap: hide physical addresses from non-privileged users). So those tests fail on older kernels: https://ci.openvz.org/job/CRIU/job/CRIU-virtuozzo/job/criu-dev/1402 travis-ci: success for zdtm: do not run cow0x tests in userns Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
For more detailed error description. travis-ci: success for Add multiple devpts support Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
Always use %#x format for ID priting for better readability. travis-ci: success for Add multiple devpts support Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
travis-ci: success for Add "pre-resume" stage Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
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>
-
Andrei Vagin authored
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>
-