2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 21:07:43 +00:00

1696 Commits

Author SHA1 Message Date
Pavel Emelyanov
5b343b40eb kerndat: Introduce the storage of kernel run-time info
One of such things we use right now is the device for anon shmem
mappings backing. In the furure this can be extended to check for
various kernel features.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 13:02:09 +04:00
Pavel Emelyanov
af03e7d564 page-pipe: Print full layout of page-pipe in log (in debug loglevel)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:26 +04:00
Pavel Emelyanov
3307bfd8f1 restore: Restore memory from stack of snapshots
This one is a little bit more tricky that dump. On restore we
should open the chain of pagemap-s (by "parent" links). Then for
every pagemap with in_parent set we should go to parent and ask
for the page. Parent, in turn, should properly determine where
the respective page is in his pagemap and position the page.img's
position respectively.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:22 +04:00
Pavel Emelyanov
60fc6abfd7 cr: Preparations for snapshot
1. Directory with images may have a "parent" symlink pointing to the
   place where the previous snapshot is
2. Each pagemap will have "in_parent" bit, which means, that the
   pages for this pagemap entry are not in the respective page.img
   but in parent
3. New --leave-running option to use with --snapshot not to kill
   tasks after snapshot

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:15 +04:00
Pavel Emelyanov
757f9c570f page-read: New abstraction for restoring pages
Now we have 2 forms of storing pages -- legacy pages.img and
new pagemap + pages image. We'll have one more (ovz) and the
pagemap + pages will be stacked (snapshot restore). Thus it's
handy to have this as an page-reader object.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:12 +04:00
Pavel Emelyanov
eb5a378855 page-xfer: Write holes and non-holes in sorted way
The pagemap.img contains sorted iovs. Need to keep this array also
sorted even if holes are in there for simpler read on restore.

Separate ->write_hole callback since dump of hole and non-hole
will differ significantly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:10 +04:00
Pavel Emelyanov
e5e537954c page-pipe: Support holes in page-pipe iov map
Holes are regions, that don't have pages in them (i.e. -- no
pages in pipes). These holes are in separate iovs array since
we should have straight arrays of iovs for non-holes, which is
in turd required to push it into vmsplice in _one_ chunk.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:07 +04:00
Pavel Emelyanov
6ff0edadcd img: Open images "at" functionality
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:03 +04:00
Andrey Vagin
13a8e60bca cr-dump: collect mount points in the target namespace
Information about mount points is used for dumping fanotify.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 22:06:48 +04:00
Pavel Emelyanov
2ab06c9c5a tcp: Schedule tcp socket for repair-off with proper fd
The fd in -> open callback is temporary (the files restoring
engine will re-open one under some other fd). But since we
add this fd to future repair off, this off will fail working
on wrong fd.

Move scheduling for repair-off into port-open where the corrent
fd is known.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 21:10:37 +04:00
Pavel Emelyanov
64d039dc29 tcp: Print error reported from sys_setsockopt
We use pr_perror, but after direct syscall calling the
errno is not initialized (and in PIE it doesn't even exists).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 19:50:08 +04:00
Andrey Vagin
6a49f82fb6 mount: free all parts of mnt entries
mnt_entry contains a few strings and they should be release too

CID 996198 (#4 of 4): Resource leak (RESOURCE_LEAK)
20. leaked_storage: Variable "pm" going out of scope leaks the storage
it points to.

CID 996190 (#1 of 1): Resource leak (RESOURCE_LEAK)
13. leaked_storage: Variable "new" going out of scope leaks the storage
it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-10 01:26:59 +04:00
Pavel Emelyanov
5cae819d8c img: Get rid of open_image_ro helper
O_RSTR flag should be used instead for regular open_image

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-09 19:22:21 +04:00
Pavel Emelyanov
2f7a7bbd8d mem: Use ctl's vpid, not the one from arguments
This saves some space on stack.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-08 17:59:29 +04:00
Pavel Emelyanov
fb9b0f500a parasite: Use struct pid on parasite_ctl
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-08 17:56:48 +04:00
Pavel Emelyanov
64249d5a8a mem: Move memory dump routines from parasite-syscall.c into mem.c
There's going to be a LOT of code in there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-08 17:39:21 +04:00
Pavel Emelyanov
e44f10a6b4 parasite: Externalize some parasite-executing fns
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-08 17:38:49 +04:00
Pavel Emelyanov
4edabd3d4f mem: Don't export parasite_mptotect_seized
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-08 17:28:30 +04:00
Andrey Vagin
30a7de3513 cr-dump: move core_entry_free closer to core_entry_alloc
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-05 08:19:24 +04:00
Andrey Vagin
a6c5953a80 clang: add an exception for BUG_ON_HANDLER
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:21 +04:00
Cyrill Gorcunov
6a0f92577c headers: util.h -- Move memory helpers to xmalloc.h
To reuse them outside of crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 21:15:27 +04:00
Cyrill Gorcunov
3165fd7886 headers: list.h -- Add hlist helpers
hlist is suitable for hash operations so
extent list.h code. I need it for converter
and this allow me to reuse this header.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:29:25 +04:00
Cyrill Gorcunov
7db78063f8 headers: image.h -- Drop asm/types.h inclusion
This header consists of a number of constants
and a few macro helper. No need to make it
asm/types.h dependant. Instead only include
<stdbool.h> for bool definition as required
by forward fdinfo_per_id (I think this declaration
should live in somewhere else place, not sure
where yet, so I left it untouched).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:29:15 +04:00
Cyrill Gorcunov
1525447752 headers: Add err.h header
Instead of bloating util.h lets move ERR_
helpers to own err.h header. This allow
to reuse it where needed without util.h
inclusion.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:27:51 +04:00
Cyrill Gorcunov
fd3f33f5d2 headers: image.h -- Drop unused entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:27:24 +04:00
Pavel Emelyanov
73d7e283a7 show: Filter -D output with --pid option
Show only image info relevant to given pid. Also reuse
the introduced --pid argument for exec action.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 11:58:15 +04:00
Andrey Vagin
6ed19e31a7 dump: unprotect vmas for dumping content
VMA-s may be protected against read, so rights for such VMA-s should be
changed for dumping and protected back after dumping.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-30 00:17:03 +04:00
Andrey Vagin
aaad8054ee sk-inet: drop proto from struct inet_sk_desc
It isn't required anymore

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:20 +04:00
Andrey Vagin
d2b1d6f2aa socket: prevent dumping of sockets if they are not collected
The idea is simple. If the collection of given type of sockets failed,
crtools can't be sure, that it's able to dump such sockets correctly.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:18 +04:00
Andrey Vagin
d274025e42 util: encode and decode errno into pointer
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:17 +04:00
Pavel Emelyanov
87d0d61e41 lock: Show long option in log message about using one
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 20:17:59 +04:00
Pavel Emelyanov
25ef419982 tty: More descriptive log message about --shell-job requirement
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 20:11:00 +04:00
Pavel Emelyanov
cbf0ba9f48 inventory: Kill inventory.img file in case of failed dump
This will result in more sane error in case restore is launched
on such semi-complete images.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 16:16:25 +04:00
Pavel Emelyanov
b5dfd452cc dump: Be more specific about inability to dump 32bit tasks on x86
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:43:27 +04:00
Pavel Emelyanov
421d46f79e pages: Accept pages images from versions v0.4 and below
After reworkring the way pagemap is stored the backward compatibility
was not preserved for patches simplicity. Time to return it back.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 13:12:02 +04:00
Pavel Emelyanov
f52d53c585 unix: Make more descriptive error logging for ext socket restore failure
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:32:53 +04:00
Andrey Vagin
04f8a1a53e sockets: restore netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:24:00 +04:00
Andrey Vagin
b9e6a27c3d sockets: dump netlink sockets
All info about bound sockets are got via socket diag interface.
All connected sockets are automatically bound.
For other sockets only protocol must be dumped, which is got
with help getsockopt.

A netlink sockets with pending data are not supported yet and
probably will not be supported in a near future.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:59 +04:00
Andrey Vagin
b17c9f64c5 sockets: use socket diag for collecting netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:14 +04:00
Andrey Vagin
47b9c69f26 crtools: add netlink_diag.h
This header is taken from kernel sources.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:13 +04:00
Andrey Vagin
dda97cf711 crtools: add constants for a netlink image
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:11 +04:00
Andrey Vagin
1eb24a0ae2 crtools: add a function for showing netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:22:47 +04:00
Andrey Vagin
149a5a5e5a protobuf: add image for netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:22:46 +04:00
Andrey Vagin
bc3089983a restore: collect signals from zombies (v4)
Each zombie sends SIGCHLD to parent. crtools restores all pending
signals, so all other signals should be collected.

Here is a problems, that signals SIGCHLD can be merged, but crtools
should be sure, that all signals are collected.

For that a zombie locks a global zombie_lock, which is released by
parent.

This operation should be done between CR_STATE_RESTORE and
CR_STATE_RESTORE_SIGCHLD.

Here is one more CR_STATE_RESTORE_ZOMBIES, whic is used for waiting all
zombies.

v2: clean up
v3: rework synchronization
v4: rework without additional CR_STATE-s

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:10 +04:00
Andrey Vagin
c2b081102b restore: read core.img before forking to know a child state
It's necessary to get a number of zombies.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:41 +04:00
Andrey Vagin
7a8729fff5 crtools: restore pending signals (v4)
Read siginfo-s from images and send them to itself by sigqueueinfo.

Thread signals cannot be restored in restore_thread_common, because
it blocks SIGCHLD, which used for error detecting.

v2: Don't remap task_args and thread_args
v3: fix error handling
v4: cosmetic clean up

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:38 +04:00
Andrey Vagin
ab65ba0afd crtools: dump pending signals (v4)
PTRACE_PEEKSIGINFO is used for received pending signals,
then all signal are sent back and saved in a image.

v2: rework according with the new kernel interface
v3: rework according with the newrest kernel interface
v4: fix error handling

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:37 +04:00
Andrey Vagin
84176c0805 crtools: add image contants for pending signals (v2)
v2: rename images

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:36 +04:00
Andrey Vagin
6e528bd1bc crtools: add a callback to show signal=*.img
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:34 +04:00
Andrey Vagin
187e1617a8 protobuf: add a new description for saving siginfo-s
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:33 +04:00