- 02 Mar, 2018 40 commits
-
-
Mike Rapoport authored
Currently, if pipe is shared between lazy and non-lazy PPBs lazy migration fails because data that should be transfered on demand is spliced into the images. Preventing pipe sharing between PPBs of different type resolves this issue. In order to still minimize pipe fragmentation, we track the last pipe that was used for certain PPB type and re-use it for the PPB of the same type. Signed-off-by:
Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
Fixes: commit 925451c12b2e ("zdtm/x86: Add a mxcsr preserving fpu test") Signed-off-by:
Dmitry Safonov <0x7f454c46@gmail.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
criu/sk-packet.c:443:3: error: 'strncpy' output may be truncated copying 14 bytes from a string of length 15 strncpy(addr_spkt.sa_data, req.ifr_name, sa_data_size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/img-remote.c:383:3: error: 'strncpy' specified bound 4096 equals destination size strncpy(snapshot_id, li->snapshot_id, PATHLEN); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/img-remote.c:384:3: error: 'strncpy' specified bound 4096 equals destination size strncpy(path, li->name, PATHLEN); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/files.c:288:3: error: 'strncpy' output may be truncated copying 4095 bytes from a string of length 4096 strncpy(buf, link->name, PATH_MAX - 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/sk-unix.c:239:36: error: '/' directive output may be truncated writing 1 byte into a region of size between 0 and 4095 snprintf(path, sizeof(path), ".%s/%s", dir, sk->name); ^ criu/sk-unix.c:239:3: note: 'snprintf' output 3 or more bytes (assuming 4098) into a destination of size 4096 snprintf(path, sizeof(path), ".%s/%s", dir, sk->name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/mount.c:2563:3: error: 'strncpy' specified bound 4096 equals destination size strncpy(path, m->mountpoint, PATH_MAX); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ criu/cr-restore.c:3647:2: error: 'strncpy' specified bound 16 equals destination size strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
fs.c:78:5: error: 'strncpy' specified bound 64 equals destination size [-Werror=stringop-truncation] strncpy(m->fsname, fsname, sizeof(m->fsname)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
As it's aligned to 16, all structures that contain it should be also aligned to 16. In the kernel there is no such align as there two separate definitions of i387_fxsave_struct: one for ia32 and another for x86_64. Fixes newly introduced align warning in gcc-8.1: In file included from compel/include/uapi/compel/asm/sigframe.h:7, from compel/plugins/std/infect.c:13: compel/include/uapi/compel/asm/fpu.h:89:1: error: alignment 1 of 'struct xsave_struct_ia32' is less than 16 [-Werror=packed-not-aligned] } __packed; ^ It doesn't change the current align of the struct, as containing structures are __packed and it aligned already *by fact*. It only affects the function users of the struct's local variables: now they lay aligned on a stack. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
It helped a bit to debug Skylake ptrace() bug, let's put it in. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
Ugh, I've spent 25 mins at 4 A.M. to figure out why the tests are failing. And the reason is stupied me, who defined a new flag after 0x8 as 0x16, not as 0x10. Simplify those definitions for such simple-minded living creatures like Dima. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
On Skylake processors and kernel older than v4.14 ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, iov) may return not full xstate, ommiting FP part (that is XFEATURE_MASK_FP). There is a patch which describes this bug: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1318800.html Anyway, it's fixed in v4.14 kernel by (what we believe with Andrey) this: https://patchwork.kernel.org/patch/9567939/ As we still support kernels from v3.10 and newer, we need to have a workaround for this kernel bug on Skylake CPUs. Big thanks to Shlomi for the reports, the effort and for providing an Amazon VM to test this. I wish more bug reporters were like you. Reported-by:
Shlomi Matichin <shlomi@binaris.com> Provided-test-env: Shlomi Matichin <shlomi@binaris.com> Investigated-with: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
Mere cleanup. For Skylake workaround I'll call one after another, so it's better separate it in a small helpers. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
get_task_regs() needs to know if it needs to use workaround for a Skylake ptrace() bug. The next patch will introduce a new flag for that. I also thought about making 3 versions of get_task_regs() and adding them to ictx->get_task_regs() depending on the flags.. But get_task_regs() is a private function and infect_ctx is a uapi.. So, let's just pass context flags to get_task_regs(). Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
As we anyway define save_regs_t for other purposes, use it in the function declaration. To unify infect_ctx style, add make_sigframe_t. Mere cleanup. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
We need to know if ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, iov) returns xsave without FP state part. Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Dmitry Safonov authored
Error-path for failed fork(). Looks originally forgotten, oops! Also print a message on failed fork(). Signed-off-by:
Dmitry Safonov <dima@arista.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
We ignore restore_one_*notify() error code, while we mustn't. Make open function fail when we can't restore them. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Imagine, we have to restore inotify with watch descriptor 0x34d71d6. Then we have: 1.235021 5578: fsnotify: Watch got 0x1 but 0x34d71d6 expected ... ... 527.378042 5578: fsnotify: Watch got 0x34d71d3 but 0x34d71d6 expected 527.378042 5578: fsnotify: Watch got 0x34d71d4 but 0x34d71d6 expected 527.378042 5578: fsnotify: Watch got 0x34d71d5 but 0x34d71d6 expected Stop doing this and stop generating GBs of debug messages. We already have print message before restore_one_inotify(). Let's add just one more after it. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Radostin Stoyanov authored
Signed-off-by:
Radostin Stoyanov <rstoyanov1@gmail.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
This test makes looped unix sockets queues and tries to iterate over them after the restore. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Everything is ready. Message queue restores are in the second stage of open for all types of unix sockets. We just need to make scm wait before restore_unix_queue() and allow to dump such scm context. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
When we allow unix sockets sent over unix sockets, dump_sk_queue() may dump and resolve some peers. So, we need run it firstly and avoid linking our peer_node to peer's peer_list. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Similar to previous patch, this makes the second end of dgram socketpair to be open till post open. This allows to delay restore of message queue. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
This makes the second end of socketpair to live till post_open. We need it alive if we want to restore message queue later. Otherwise, we do not have a queuer, which fd is used to actually write messages. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Extract the functionality, which makes socket memory initialization. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
This function will be used to allocate id for fake files (don't confuse with fake fds, e.g. fles). Suggested-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
restore_sk_common() may shutdown a socket, and queuer won't be able to connect to it. So, this action must be postponed. We have this problem since long ago, but we are lucky we haven't bumped in it. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Use pointer to the queuer instead of its id. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Actually, there is no functional changes. We just postpone restore of the queues. This will be used in the further patches to restore unix sockets sent over unix sockets. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
After previous patch, master and slave ends of socketpair are owned by the only task. So, we may avoid using of send_desc_to_peer() of the second end, and just reopen it with right pid. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
We're going to split interconnected pair restore on two stages. Since we need the second end to restore message queue in (future) post open, we add it to the process, who is owner of the first end. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Since new file engine was introduced, we don't care which particular pid should be master or slave. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
This adds a new argument and changes debug print (it will be used for any fle, not only for scm). Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
This functional allows to make a fle a master on the time of collection. We will use it to add fake files when we need to do this after add_fake_fds_masters(). This will be used to add second end of socketpair as a fake fle (as the first end is placed in the right place, we will force add the second end there). See next patches. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Since this function is used by standalone sockets only, we move it to appropriate place. No functional changes. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Since epoll restore is split in two parts, epoll_create() does not depend on another files state. Since epoll is created, it can be sent to everywhere. So, there is no circular dependences, and we allow epolls sent over unix socket. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
Create socketpair and epoll. Add one end of the socketpair to epoll and then twice send it over another end. After restore check, that epoll can be received via socket, and that it contains event. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
Builds for s390x fail due to a qemu bug. Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Andrei Vagin authored
$ make lint flake8 --config=scripts/flake8.cfg test/zdtm.py test/zdtm.py:323:19: F841 local variable 'e' is assigned to but never used Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Kirill Tkhai authored
waitpid() does not return child pid, when child has not exited. So, we can't use it to find pids of children. Signed-off-by:
Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Tikhomirov authored
We should close cwd_fd on error paths, found by Coverity Scan: *** CID 187162: Resource leaks (RESOURCE_LEAK) /criu/mount.c: 1370 in open_mountpoint() 1364 */ 1365 pid = clone_noasan(ns_open_mountpoint, CLONE_VFORK | CLONE_VM 1366 | CLONE_FILES | CLONE_IO | CLONE_SIGHAND 1367 | CLONE_SYSVSEM, &ca); 1368 if (pid == -1) { 1369 pr_perror("Can't clone helper process"); >>> CID 187162: Resource leaks (RESOURCE_LEAK) >>> Handle variable "cwd_fd" going out of scope leaks the handle. 1370 return -1; 1371 } 1372 1373 errno = 0; 1374 if (waitpid(pid, &status, __WALL) != pid || !WIFEXITED(status) 1375 || WEXITSTATUS(status)) { Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-
Pavel Tikhomirov authored
close_safe can operate uninitialized fd in case of error in switch_ns, found by Coverity Scan: *** CID 187164: Uninitialized variables (UNINIT) /criu/mount.c: 1313 in open_mountpoint() 1307 err: 1308 return 1; 1309 } 1310 1311 int open_mountpoint(struct mount_info *pm) 1312 { >>> CID 187164: Uninitialized variables (UNINIT) >>> Declaring variable "fd" without initializer. 1313 int fd, cwd_fd, ns_old = -1; 1314 1315 /* No overmounts and children - the entire mount is visible */ 1316 if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) 1317 return __open_mountpoint(pm, -1); 1318 Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
-