- 27 May, 2016 40 commits
-
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
All the dumping code sits in there, so it's time to move the restoring one there too :) Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
We have 3 structures and 2 ways to keep them while doing C/R. Let's unify the vma_area is -- one struct with union and a hash table. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
We now have two places where we if/elseif/elseif/else a vma and take actions -- the prepare_mm_pid and open_vmas. I propose to make this if/... onlce once (while preparing) and set up a callback on vma to be called later (while opening). This requires my patch that doesn't set -1 in alloc_vma or Andrey's patch that does the same. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
Image a process has done shmget(2 pages), then shmat() then mprotect(1 page, ro). In this case criu will dump 1 shmem segment 2 pages long and 2 vmas 1 page each. But on restore time we'll call shmat() for _each_ vma and the very first one will occupy the whole 2 pages space in vm (there's no size argument for shmat, only for shmget) thus blocking the 2nd vma from shmat()-in again. The solution is: 1. check that each shmem segment is attached by the sequence of vmas that cover one w/o holes 2. shmat() only the first one 3. mprotect() all of them if needed (there's no hunks for this step in this path, mprotect is already called in pie/restorer.c and does things well) v2: * List can contain anon shmems (caught by zdtm) * There can be many attachments of a segment (caught by transition/ipc) Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
When testing for queued data present on peers we setup non-blocking mode over them to obtain -EAGAIN if there is no data at all, but I forget to restore former mode on return, ie blocking read. Reported-by:
Andrey Vagin <avagin@virtuozzo.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
For easier reading: we need it for pty queued data only, but this way the code is simplier. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrey Ryabinin authored
Signed-off-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrey Ryabinin authored
Usually unix stream sockets have consistent shutdown state (if one end shutdown for read than other end will be shut down for write). However sometimes it's possible to have stream sockets with mismatched shutdown state. This happens if we connect() already shut down socket (see upcoming sockets03.c test for example). On read()/write() kernel always checks shutdown state on both ends, so from userspace POV sockets with mismatched shutdown state behave the same way as with matched state. So I think that we can just ignore shutdown mismatch during dump, and just restore sockets with matching shutdown state. Process should not see the differences. Signed-off-by:
Andrey Ryabinin <aryabinin@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
The inital mount() call for a bind mount needs to have the MS_REC flag present if the bind mount is recursive. Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
Sting field sysctl_entry.sarg has wrong length in protobuf encoding in netdev-9 image, according to https://developers.google.com/protocol-buffers/docs/encoding : In netdev-9.img binary representation of sarg field is: "1a 2c 32 36 30 37 3a 66 30 64 30 3a 31 30 30 32 3a 30 30 35 31 3a 30 30 30 30 3a 30 30 30 30 3a 30 30 30 30 3a 30 30 30 34 0a c0 f4 a7 01" Field key is 0x1a - means type 2(Length-delimited field), field 3 - that is sarg field. Field len is 0x2c which is 44, first 40-byte "2607:f0d0:1002:0051:0000:0000:0000:0004\0" and then last 4 - "c0 f4 a7 01" where 0xc0 is not utf-8, and that makes crit fail. In sysctl_op we just read() from sysctl so no '\0' is added in the end of the string. So we can zero-init arrays and that will fix the issue. https://github.com/xemul/criu/issues/161 *Alternatively or additionaly we can put '\0' in the end of string in sysctl_read_char to make it harder to make such a mistake in future. Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
use native SYSCTL_TYPE__CTL_32 and SYSCTL_TYPE__CTL_STR v2: add BUILD_BUG_ONS to check SysctlType constants are equal to __CTL_STR and CTL_32, change __CTL_STR to CTL_STR in SysctlType enum. Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
For more convenient log parsing. Reported-by:
Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
Not exported anywhere. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
man of inet_ntop says that INET_ADDR_LEN should not be less than INET_ADDRSTRLEN and INET6_ADDRSTRLEN Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Tikhomirov authored
Because stable_secret sysctl c/r produces a lot of spam error messages in tests: https://github.com/xemul/criu/issues/160 But EIO for these sysctl is valid behavior and no error need to be printed. More general solution will also silence error messages for sysctl_read_{u32,s32,u64}, but the flag CTL_FLAGS_READ_EIO_SKIP is now used only for __CTL_STR and only for stable_secret so we can do silence error only in sysctl_read_char. Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com> Tested-by:
Tycho Andersen <tycho.andersen@canonical.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
It's required when a target path is overmounted by one of child mounts. Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
When we're walking over controllers and their directories we should update the directory at the very end because otherwise we will not match the rest of them once variable is updated. So I desided to simply rewrite the helper. Hopefully it is more clear now. Signed-off-by:
Cyrill Gorcunov <gorcunov@virtuozzo.com> Acked-by:
Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
We run "pre-dump" scripts earlier than calling anything else, so in case if it get failed the plugins cleanup routine hit list structure set into zeros which lead into SIGSEGV when we're trying to walk over. Thus simply init it as empty list. Reported-by:
Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@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
A process can have many vma-s and we can hit rlimit for files. I suggest to dump vma files as soon as possible and close them. v2: remove vm_file_fd from the vma_area structure Cc: Cyrill Gorcunov <gorcunov@openvz.org> 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:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Cyrill Gorcunov authored
Updated version attached. >From 6c0e1522e01e01aa89861862fbdf039a0892b89b Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov <gorcunov@openvz.org> Date: Tue, 12 Apr 2016 20:00:24 +0300 Subject: [PATCH 1/2] tty: Write unread pty buffers on post dump stage When unread data present on peers we currently simply ignore it but actually we can try to fetch it in non(that)destructive way. For this sake at the end of dump procedure (because fetching queued data may go wrong and we will have to write it back, which is heavy, and we need all ttys under our hands) we walk over all collected TTYs and link PTYs peers which indices are matching. Note to not overload tty_dump_info we reuse @list member for new @all_ptys list. Once link established we literally read queued data and flush it into new tty-data.img. If something go wrong at this moment, we stop reading queued data but walk back over already queued ones and write them back to restore former state. Same applies if the dump has been requested to leave task alive. On restore we link peers back and write queued data once peer back to live. Signed-off-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Tycho Andersen authored
See the comment for details, but basically tracefs is automounted by the kernel, so we can just mount debugfs with MS_REC and get the right result. v2: rebase on criu-dev v3: don't use a new fstype->flags, just always set MS_REC in debugfs' ->parse Signed-off-by:
Tycho Andersen <tycho.andersen@canonical.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
Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
(00.170031) Error (files-reg.c:515): `- XFail [.criu.mntns.3xE0jR/15var/tmp/ibmiNsaA.cr.5.ghost] ghost: No such file or directory Reported-by:
Adrian Reber <adrian@lisas.de> Cc: Adrian Reber <adrian@lisas.de> Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
Test-for: c59759345e6e ("mount: dump a file system only if a mount point isn't overmounted") 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>
-
Andrei Vagin authored
"clean mount" is a copy of target mount without child mounts. Currently a clean mount is created when a target mount has children. In this case a target path MAY be overmounted. In this patch, a clean mount is created only if a target path is overmounted. For that we enumerate all children and check that they are not mounted over a target path. Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
static char *cut_root_for_bind(char *target_root, char *source_root) Currently it returns a relative path if source_root is '/' and an absolute path for other cases. Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Andrew Vagin authored
If a mount point has to be bind-mounted to somewhere, we need to have access to it. This patch solves a problem, when the mount point is overmounted. In this case we can open the targret mount point and then use /proc/pid/FD to access it. v2: make a bind-mount from an underlying mount via a file descriptor v3: add a separate buffer to generate path to a file descriptor v4: use the PSFDS contant. Reported-by:
Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Cc: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
-
Pavel Emelyanov authored
When we didn't have tree with pids, the search for parent item was optimized. Nowadays we can just use one rbtree lookup. Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com>
-