2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

514 Commits

Author SHA1 Message Date
Pavel Emelyanov
84737e2796 build: Generate most of the pb-desc automatically
These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 21:47:31 +04:00
Pavel Emelyanov
cdce5d216d util: Make set_proc_fd report success/error only
Returning the new proc fd value is useless.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 19:51:02 +04:00
Pavel Emelyanov
6ac4870181 stats: Prepare for collecting restore stats
Restore stats are difficult -- we have to collect them from several
tasks and thus existing plain variables would not work. We'll need
shared memory with stats, so prepre for allocating one.

Other than this -- put call to write_stats() where appropriate for
restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:00:45 +04:00
Andrey Vagin
d5540a2de5 page-server: check that all data have been accepted
Currently criu sends data to the page server, but it doesn't get any
feedback, so it can't be sure that all data have been accepted.

This patch adds a flush command, which requires an answer from the page
server. This command is sent before disconnecting.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-09 15:39:37 +04:00
Cyrill Gorcunov
73c5a0f965 dump: Introduce "post-dump" script action
This is usefull if one needs to do some final action before checkpoint
is complete. For example in case of online migration one may provide
a script which would check the restore procedure on remote note
ended without errors, thus the script returns zero code and criu
simply kills running instance of application.

In turn, if migration failed, the script can return nonzero code
and criu won't kill the application but continue its execution
instead.

https://bugzilla.openvz.org/show_bug.cgi?id=2583

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-22 19:35:28 +04:00
Pavel Emelyanov
0dc835ac02 dump: Move signals dumping into a helper
... fixing erroneous goto on error path :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 20:40:06 +04:00
Pavel Emelyanov
cd0075abbd dump: Don't push parasite-ctl into fns needing pid only
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 20:35:53 +04:00
Pavel Emelyanov
d20089fb32 dump: Merge thread and task parasite-core info dumping
There are parts dumping which is common to thread and task,
and this stuff is represented by parasite_dump_thread structure.

Merge this into parasite_dump_misc and facror out dumping code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 19:47:52 +04:00
Andrey Vagin
c2c44d5261 signals: dump alternate stack as misc parameters
The initilization stage is not good for that, because it can fail.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 17:24:16 +04:00
Cyrill Gorcunov
a18f28d61e restore: Set up zombie name on restore
Otherwise we lost 1:1 mapping between names being
dumped and what user sees after restore.

| 1455 pts/0    T      0:00          \_ ./crtools restore -t 1448
| 1448 ?        Ss     0:00          |   \_ ./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
| 1449 ?        Z      0:00          |       \_ [zombie00] <defunct>
| 1450 ?        Z      0:00          |       \_ [zombie00] <defunct>
| 1451 ?        Z      0:00          |       \_ [zombie00] <defunct>
| 1452 ?        Z      0:00          |       \_ [zombie00] <defunct>

https://bugzilla.openvz.org/show_bug.cgi?id=2635

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-12 18:12:12 +04:00
Andrey Vagin
5336bc13c6 dump: dump tid_addr_clear for thread leaders
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 18:05:27 +04:00
Pavel Emelyanov
5762076dbb dump: Factor out thread_core dumping
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 16:09:23 +04:00
Pavel Emelyanov
a04ccc22a0 dump: Remove unused arg from dump_task_core_all
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 16:06:08 +04:00
Pavel Emelyanov
ae25daf007 dump: Move dump_task_mm out of dump_task_core
Mm used to be in code, so the call was left in that place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 16:05:29 +04:00
Pavel Tikhomirov
9a9424ee10 posix-timer: Add dump functionality
Signed-off-by: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 16:19:28 +04:00
Andrey Vagin
75a3932be6 dump: Return signal mask from parasite on initialization
This mask should be put into sigframe (used by parasite, coming
soon) thus we have to pull one from dumpee early.

Plus, check that signals are blocked for each thread separately

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 20:26:34 +04:00
Andrey Vagin
64ecb2746c dump: save registers when the task is already infected
Otherwise a task can start to handle a signal and registers can be
changed.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 19:28:34 +04:00
Andrey Vagin
9b656a47d0 dump: dumping signals when a task is stopped
Currently it's always stopped, but it will be changed, when a parasite
will be executed as a daemon.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 18:55:33 +04:00
Andrey Vagin
3f48f35bfd parasite: use transparent thread indexes
We have three arrays for thread related data: item->threads,
parasite_ctl->thread and tid_state in parasite.

With this patch a thread will have the same index in all arrays.
The zero index is used for a thread leader.

In this case we don't need to search thread_state in parasite.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 18:47:11 +04:00
Cyrill Gorcunov
0772e47511 pstree: Bind CoreEntry to pstree and fill it with registers early
When parasite daemon mode will be implemented we get deprived of ability
to fetch registers at the late moment of dumping as we were, thus just
bind CoreEntry to pstree item and allocate CoreEntry'ies for every
thread found, once process tree is in seized state.

Then immediately fill CoreEntry'ies with registers. We use prctl
opcode for that but fetch a complete set of registers including
FPU state, and convert them into protobuf format.

Zombie tasks remains untouched, we allocate CoreEntry for them
right at moment of dumping becuase we don't need registers there
to be written on disk.

This way get_task_regs no longer need parasite_ctl argument
and it's zapped.

Still parasite_ctl has own copy of general registers set but
this is because we need them to be in cpu native format unlike
ones kept in CoreEntry.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 18:42:11 +04:00
Cyrill Gorcunov
0ae67a7743 vdso: Escape double dumping of rt-vdso if proxy present
In case if we have created vdso proxy the rt-vdso should
not be dumped because it will be re-created on next restore
anyway. Thus with help of parasite service routine find
the rt-vdso and tear it off from VMAs list.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 13:27:20 +04:00
Cyrill Gorcunov
e44b3dbe84 vdso: Initialize vdso data on startup
During criu startup we need to fill symbol table of own
run-time vdso provided by the kernel. We will need this
data for vdso proxy.

Because this functions are not used in restorer code,
we move them out of PIE (since PIE code must remain
as small as possible).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 13:27:15 +04:00
Andrey Vagin
653053b40c proc: use vma flags for determing vmas with MAP_GROWSDOWN
When a kernel didn't show vma flags, we set MAP_GROWSDOWN for stack
vmas, but it's not reliable. E.g. thread stacks are mapped without
MAP_GROWSDOWN.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-21 19:03:57 +04:00
Cyrill Gorcunov
19ce784db5 dump: Add missing FD_PARMS_INIT assignments
struct fd_parms is reused for two calls, so don't
forget to initialize it before dump_one_reg_file
call.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-18 03:36:01 +04:00
Pavel Emelyanov
a533820b7e dump: Introduce the pre-dump action
With this action criu will seize tasks, grab all its memory into
page-pipes, rest dirty tracker and will then release them. Writing
the memory from page-pipes would occur after tasks are unfreezed
and thus the frozen time should become reasonably small.

When pre-dump is in action, the dirty tracking is forcedly turned
off as well as tasks are resumed afterwards, not killed, by default.

This is a prerequisite for iterative migration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 12:00:40 +04:00
Pavel Emelyanov
b556f01be3 dump: Collect pstree IDs separately from pstree items
For pre-dump we won't need IDs, but will need items only,
thus make these two calls separate.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-14 11:44:36 +04:00
Pavel Emelyanov
c15d4ee66a dump: Cleanup dump_pages_seized arguments and declaration
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 14:09:19 +04:00
Pavel Emelyanov
d7e547dfb7 cr: Remove opts argument from cr_dump_tasks
Options are collected in global variable, no need to have them on stack.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 14:08:55 +04:00
Pavel Emelyanov
1e18128423 stats: Dump-time statistics
Basic timings for dump (freeze, frozen, mem dump).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 13:53:31 +04:00
Pavel Emelyanov
bd1d6186be stats: Write dump stats after dump is finished
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-13 13:51:53 +04:00
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
Kir Kolyshkin
d90d4b1b88 Fix typos in log messages
Someone has to do it, right?..

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:25 +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
Alexander Kartashov
91b48d1297 cr-dump.c: fixed a format string warning on ARM
Use a PRI* format specifier to convert an integer of known size
to a string.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 19:59:39 +04:00
Pavel Emelyanov
ba0ed60368 dump: Reshuffle arguments for dump_task_mm
Will need vpid there soon, so switch to using ctl instead.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-09 19:21:23 +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
Andrey Vagin
c9c1ec7b44 cr-dump: fix memory leak in fill_zombies_pids
CID 996204 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable "ch" 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-05 08:20:36 +04:00
Andrey Vagin
50e94780f4 cr-dump: core_entry_free should free core
CID 996205 (#1-2 of 2): Resource leak (RESOURCE_LEAK)
14. leaked_storage: Variable "core" 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-05 08:19:47 +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
Pavel Emelyanov
75d8b81fd1 ipc: Check for IPC namespace to be dumped when such mapping is
If any task has a sysvipc mapping we should make sure, that the
ipc namespace is dumped as well. Otherwise after restore the task
will die.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 13:09:59 +04:00
Andrey Vagin
2020d3957e dump: prevent dumping if a session leader is outside of the current pidns
A parasite code returns zero sid for such cases.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:11:13 +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
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
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
c03a4c5801 msg: Make final dump/restore more descriptive
Currently dump silently terminates and restore emits some
meaning-less messages in either case. Make these important
messages more informative.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 16:06:26 +04:00
Pavel Emelyanov
7571ff69e1 collect: Properly report tasks collecting error
When we've failed to seize tasks we should report this error to the caller.

Reported-by: Kevin Wilson <wkevils@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 22:02:37 +04:00
Pavel Emelyanov
118526cc0a dump: Missing \n in pr_err message.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:49:18 +04:00
Pavel Emelyanov
21c663dc01 dump: Use pr_err when reporting error about locks in use and no -l option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:27:43 +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