- 01 Aug, 2016 40 commits
-
-
Dmitry Safonov authored
I think, we can simplify criu's makefile by moving packages checks out to special makefile. Now we only need to make criu's target depend on 'check-packages'. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
Impact: use /dev/null as $(CC) output, drop temporary file. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
277 } >>> >>> CID 164718: Memory - corruptions (OVERRUN) >>> >>> Overrunning array "stackbuf" of 2048 bytes at byte offset 2048 using index "ret" (which evaluates to 2048). 278 stackbuf[ret] = '\0'; Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
267 if (stack < 0) { 268 pr_perror("couldn't log %d's stack", pid); >>> >>> CID 164721: Resource leaks (RESOURCE_LEAK) >>> >>> Variable "f" going out of scope leaks the storage it points to. 269 return -1; Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
The root yard is used to clean up ghost files. Now try_clean_remaps() is called from depopulate_roots_yard(), so the code about switching mount namespaces was moved to depopulate_roots_yard(). v2: call clean_remaps() when processes are restored in the host mount namespace. Now depopulate_roots_yard() is called from the root task before finishing CR_STATE_FORKING. I moved it to the criu process and do it after clean_remaps(), because clean_remaps() uses the roots yard. It's called after openning all files, because only at this moment we can be sure that all link remap files can be removed. restore_task_with_children() | restore_root_task() ----------------------------------------------------------------------- depopulate_roots_yard() | restore_finish_stage(CR_STATE_FORKING) | prepare_fds() | open_vmas() | | restore_switch_stage(CR_STATE_RESTORE_SIGCHLD) | clean_remaps = 0; If something fails between CR_STATE_FORKING and CR_STATE_RESTORE_SIGCHLD, try_clean_remaps will be called(). try_clean_remaps() try_clean_ghost() rst_get_mnt_root() print_ns_root() snprintf(buf, bs, "%s/%d", mnt_roots, ns->id); it uses mnt_roots, actually it is what we called the roots yard. Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
It looks like, it's possible that cores for some threads were allocated, but not for all - allocation failed in pstree_alloc_cores(). And after that we will dereference NULL pointer as pstree_free_cores() doesn't check pointer: pstree.c:28:6: warning: Access to field 'tc' results in a dereference of a null pointer (loaded from variable 'core') if (core->tc && core->tc->timers) ^~~~~~~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
plugin.c:123:3: warning: Potential leak of memory pointed to by 'd' dlclose(h); ^~~~~~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
path.c:98:2: warning: Value stored to 'len' is never read len -= off; ^ ~~~ path.c:99:2: warning: Value stored to 'path' is never read path += off; ^ ~~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
There is call to close_page_read on open_pages_image_at failure, also on failure of init_pagemaps. pmes[] is uninitialized here and free_pagemaps() will try to walk them and call xfree(). Which surely would lead to crash. pagemap.c:317:6: warning: Branch condition evaluates to a garbage value if (pr->pmes) ^~~~~~~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
cr-restore.c:1516:9: warning: Value stored to 'pid' during its initialization is never read pid_t pid = item->pid.real; ^~~ ~~~~~~~~~~~~~~ cr-restore.c:1570:9: warning: Value stored to 'pid' during its initialization is never read pid_t pid = item->pid.real; ^~~ ~~~~~~~~~~~~~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
... cr-dump.c:515:9: warning: Potential leak of memory pointed to by 'mme.vmas' return ret; ^~~ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
Should we like, free them? cgroup.c:890:11: warning: Potential leak of memory pointed to by 'cg.sets' return -1; ^ Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
There is a bug, that if vsnprintf() wrote nothing to buffer: that may be xstrcat(0, "%s", "") or something like that, than vsnprintf's return value is 0, which will be lesser than delta. The code before would do following: o first cycle: 1. relocate str to new (str is not allocated anymore) 2. vsnprintf() retured 0, delta is greater. o second cycle: 1. relocate previously freed str to new..^C ^C Segmentation fault (core dumped) Weeell, I do think, we can do better job here. Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
This is a little bit of a hack. The problem is that we can't actually write this value if memory.use_hierarchy is set, which it is by default. Additionally, we can't do a hack like unsetting memory.use_hierarchy and then writing this, because if the bit is set on the parent, unsetting it will fail. So the restore *can* succeed if things are configured correctly initially, but won't by default, which is annoying for the tests. Plus in the case of systemd, there are child cgroups, so we can't ever unset the root's memroy.use_hierarchy anyway, meaning we could never actually restore correctly. Instead, let's just not try to write the default value, which is probably what everyone is using anyway. Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> CC: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
In all kernels, memory.use_hierarchy must be written before there are child cgroups. In 3.11, memory.swappiness must be written before there are child cgroups, so let's consider it a "special" property for all kernels. Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> CC: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
and move fs.mqueue.xxx from get_shared_memory_info to get_messages_info Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
we already have 3/5 fs.mqueue.xxx sysctls so why not have all: /proc/sys/fs/mqueue/msg_default is a read/write file for setting/getting the default number of messages in a queue value if attr parameter of mq_open(2) is NULL. If it exceed msg_max, the default value is initialized msg_max. /proc/sys/fs/mqueue/msgsize_default is a read/write file for setting/getting the default message size value if attr parameter of mq_open(2) is NULL. If it exceed msgsize_max, the default value is initialized msgsize_max. v2: remove check if kernel has sysctls as we do not support such an old kernel(v3.5) Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Error (arch/x86/crtools.c:83): Failed to get auxval, err: 0 ==2103== Conditional jump or move depends on uninitialised value(s) ==2103== at 0x46F073: seize_wait_task (ptrace.c:238) ==2103== by 0x437592: cr_exec (cr-exec.c:137) ==2103== by 0x41F6FC: main (crtools.c:789) Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
[root@fc22-vm criu]# ./criu/criu exec -t 27573 dup21 3 0 Error (cr-exec.c:164): Unknown syscall [dup21] [root@fc22-vm criu]# echo 0 0 Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
It is required for the other/exec test Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
Before these patch one need to zero-init char buffer before giving it to sysctl_op, it can be convenient to remove these restriction. Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
In a previous patch, we skipped zombies, but our pre-dump doesn't support stopped tasks (Why does it not support them?), so let's handle tasks which have parasite_ctl. Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
The directory that the tests run in on jenkins is: /var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static which makes the whole path too long. This commit makes the whole path: /var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static/del_standalone_un.test/sock which is 105 chars, less than 108 of sun_path. Closes #191 Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
We already have 3 bool-s on this struct and are going to have the 4th %) Time to turn this into classical flags. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
When freezing, sometimes we can fail due to a timeout. If this is the case, sometimes it can be a kernel bug where tasks are deadlocked. It would be useful to know the kernel stacks to see where tasks are hung if they are. Note that this is racy: a task might still freeze while we are logging the various stacks, so we might miss things. But in the case of a deadlock, it should catch what's wrong. v2: log all stacks instead of just the unfrozen tasks Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000435744 in cr_pre_dump_finish (ret=0) at cr-dump.c:1452 1452 pr_info("\tPre-dumping %d\n", ctl->pid.virt); (gdb) bt #0 0x0000000000435744 in cr_pre_dump_finish (ret=0) at cr-dump.c:1452 #1 cr_pre_dump_tasks (pid=pid@entry=24) at cr-dump.c:1556 #2 0x000000000041f665 in main (argc=<optimized out>, argv=0x7ffda430e818, envp=<optimized out>) at crtools.c:753 https://github.com/xemul/criu/issues/189 Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Stanislav Kinsburskiy authored
WIth current code we have smth like 1) If file was opened with O_WRONLY, this mode is simply lost. 2) If file was opened with O_RDWR, but mapping is private, resulting mode will be O_RDONLY The correct place to get fd open flags for file mappings is /proc/<pid>/map_files. An attempt tp speculate on "shared" and "maywrite" bits doesn't garantee, that file will be opened with correct permissions on restore. Here is an example: Process mapping (read/write): # cat /proc/481943/maps | grep 7f7108077000-7f7108078000 7f7108077000-7f7108078000 rw-p 00001000 00:35 7 <snip> 1) Before suspend: # ls -l /proc/481427/map_files/7f7108077000-7f7108078000 lrw------- <snip> /proc/481427/map_files/7f7108077000-7f7108078000 -> <snip> 2) After restore: # ls -l /proc/481943/map_files/7f7108077000-7f7108078000 lr-------- <snip> /proc/481943/map_files/7f7108077000-7f7108078000 -> <snip> Write bit is lost. This patch set vma->e->fdflags as /proc/<pid>/map_files/<vma> open mode. Signed-off-by:
Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
In case of `criu exec`, we do not insert parasite daemon inside task. So, we don't have the daemon which could unmap itself and by that reason, we should unmap remote_map with hands (raw syscall). Cc: Andrew Vagin <avagin@virtuozzo.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
It's quite boring to add your test to .gitignore and one may forget to do that boilerplate -- put this labour on computer. For that I make real targets for tests instead of implicit and add test's binary name to .gitignore on make stage. Also added *.pidns to .gitignore -- do not wanna do this as separate trivial patch. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Dmitry Safonov authored
static/transition tests are built with implicit rules. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Currently we mark a mount namespaces as populated when a target process (ns_pid) switches into it. But if a process inherited the right namespace from a parent, it doesn't call do_restore_task_mnt_ns() and a namespace can remain unmarked. af55c059 ("mount: fix a race between restoring namespaces and file mappings") After this patch we could simplify logic around ns_populated. Currently it's a futex, but nodoby waits on it. We can set ns_populated when we are going to close namespace descriptors. To avoid additional locks, we can do this when all task pass the forking stage and don't start the next stage. v2: add a comment why we wait a CR_STATE_FORKING stage Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
v2: open two sockets, one "on top" of the other v3: also drop unnecessary unlink(), we can just rely on rename() Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
For standalone unix sockets, listen() will fail if we haven't called bind() with an actual address. If we remove the name on dump, we won't call bind(), and thus sockets in this state will fail to restore. v2: temporarily rename a unix socket out of the way if necessary in order to bind() correctly and then delete it (e.g. when there are two unix sockets bound "on top" of each other) v3: remove extra unlink(), do the real unlink() in bind_unix_sk() so we only need to do it once Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
This is suitable for debugging problems. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-