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

1696 Commits

Author SHA1 Message Date
Cyrill Gorcunov
53c611b630 dump,restore: Use rt_sigaction_t for sys_sigaction
Since we operate with syscalls directly we are
to convert signal's structures between image and
kernel formats, without intermediate glibc layer.

Note this involves chaging sa_entry::flags to u64
(since it's long int value in kernel).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-03 17:24:05 +04:00
Cyrill Gorcunov
9be4034048 image: Introduce struct sa_entry
It's needed to keep singnal handlers on
disk with predefined format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-02 23:06:51 +04:00
Cyrill Gorcunov
2907bb2258 Move rt_sigset_t to include/types.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 23:03:03 +04:00
Andrey Vagin
04f36aed0a Set descriptors to restart a current syscall
If a task is sleep in syscall, it should be restared.
This logic is moved from kernel do_signal().

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 17:50:55 +04:00
Cyrill Gorcunov
fa28f40aaa restore: Tune up the resident code to restore threads via last-pid concept
v2:
 - Pavel reported there is no need to lock/unlock
   last-pid file in cycle, just lock it once before
   threads creation and unlock at the end.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-02 13:41:34 +04:00
Cyrill Gorcunov
20b0e29698 syscall: Add sys_gettid helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 12:07:47 +04:00
Cyrill Gorcunov
b9febd52bc syscall: Add sys_flock helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 12:07:33 +04:00
Cyrill Gorcunov
8d36f08765 restore: Switch to the new ns_last_pid kernel facility while forking children
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-01 18:53:20 +04:00
Cyrill Gorcunov
5e829c8292 parasite: Unify error reporting scheme
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:57:36 +04:00
Andrey Vagin
25434884e1 Dump and restore sigactions (v2)
A parasite code dumps all sigactions in sigact.pid.

v2: remove hard code for sizeof(sigset_t)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:09 +04:00
Andrey Vagin
287b7d2aa9 Generalization execution of parasite code.
It will be used for dumping sigactions too.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:05 +04:00
Cyrill Gorcunov
3d55b9d125 dump: Drop VMA_DUMP_ALL flag
It has been used at very early stage when
no mincore call was implemented. Not needed
anymore -- so drop it out.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-25 18:39:58 +04:00
Pavel Emelyanov
bb3d02c281 crtools: Take MINCORE_ANON pages into account
Reduce the pages-xxx.img file size significantly (from 2.1M to ~100K for simple counter test)
by not dumping private file pages, that have not yet changed from its file prototype.

If you'll have problems with it, just let me know and comment the definition of PAGE_ANON not
to block your work.

This uses the implemented earlier flag from mincore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-25 18:31:18 +04:00
Cyrill Gorcunov
9eeb003766 util: Add K/M/G bytes helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-24 15:07:03 +04:00
Pavel Emelyanov
47b7404d73 crtools: Don't save vma's inode info in image
This one isn't used on restore process, since the file mapped is
stored in the fdinfo part of the images.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 14:03:24 +04:00
Pavel Emelyanov
fb44c9d82b crtools: Don't hold pid on vma image
It's pointless. All vmas are stored in the per-pid image file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 14:03:14 +04:00
Cyrill Gorcunov
64f867f54e dump: Use absolute paths for page dump file
Otherwise the dumpee migh be unable to locate it.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 13:10:37 +04:00
Cyrill Gorcunov
122cae2111 dump: Add -k (kill dumped) option
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-22 22:09:28 +04:00
Cyrill Gorcunov
5aa22f131b dump: Print error codes if dumper failed in parasite section
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-22 20:07:20 +04:00
Cyrill Gorcunov
9263320339 restore: Add write_num_n helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 17:52:57 +04:00
Cyrill Gorcunov
b38205f580 Update PR_ opcodes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 16:47:36 +04:00
Cyrill Gorcunov
b06349fc49 prctl: Rename PR_ entries
Tejun Heo proposed to use more general names
unrelated to checkpoint-restore procedure.

So be it (maybe someone else will need this
entries as well).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 12:54:14 +04:00
Cyrill Gorcunov
777dc994aa types: PTRACE_SEIZE and PTRACE_INTERRUPT already defined in ptrace.h
On linux-3.1.1 (fc16) these constants already defined in system
ptrace.h

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-20 10:31:16 +04:00
Cyrill Gorcunov
d0eec0e271 restore: Drop self-vmas file once it's not needed
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-18 22:30:32 +04:00
Cyrill Gorcunov
d9aa7f021c restore: Add mutexes via futex syscall and order threads creation
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-18 16:09:01 +04:00
Cyrill Gorcunov
01f8f8f4d1 restore: Bring trivial locker back
Threads are better to be restored in serialized
way otherwise if some error happened an error
message will be screwed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-17 00:59:08 +04:00
Cyrill Gorcunov
a095617253 restore: Simplify sigreturn code
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-16 18:19:24 +04:00
Cyrill Gorcunov
11eb2ca409 Add ALIGN helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-16 18:16:12 +04:00
Cyrill Gorcunov
85506595e9 restorer: Drop futex constants
We don't use them yet, no need to carry.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 23:05:36 +04:00
Cyrill Gorcunov
b712182308 Gather file names formats in one place
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 18:35:55 +04:00
Cyrill Gorcunov
0fd17a08cb Bring some order in usage of VMA entries helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 17:12:29 +04:00
Cyrill Gorcunov
bb15450d98 image: Drop tls_array from the image
We use registers set anyway

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 14:57:39 +04:00
Cyrill Gorcunov
35781a8c6d util: Drop redundant vma_area->vma.status assignment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 13:37:17 +04:00
Cyrill Gorcunov
33ea81e606 Drop redundant pstree_item_info
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 13:19:12 +04:00
Cyrill Gorcunov
4619e48574 dump: parasite -- Drop unneeded error codes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:22:40 +04:00
Cyrill Gorcunov
f89f67914e dump: parasite -- Drop unneeded sections
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:21:17 +04:00
Cyrill Gorcunov
72d3d2326a dump: Drop parasite_complete_ip from parasite_ctl
It was used for debug only to be able to work without
task seizing. Not needed anymore.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:15:08 +04:00
Cyrill Gorcunov
417fe5d8e1 image: Drop redundant VMA_FORCE_WRITE
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 11:57:24 +04:00
Cyrill Gorcunov
2c0e5db7eb image: Drop redundant offsetof
Already in compiler.h

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 11:54:01 +04:00
Cyrill Gorcunov
5ae9d9feb8 cleanup: parasite - Drop PARASITE_CMD_RESTORECORE
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-14 18:50:20 +04:00
Cyrill Gorcunov
6a26e75aba cleanup: Drop elf references
We dont use Elf restore anymore, drop it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-13 13:07:00 +04:00
Cyrill Gorcunov
e793eb7557 cleanup: Drop unneeded sources
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-13 13:00:32 +04:00
Cyrill Gorcunov
1e7bbd35de restore: Add threads restoration
Now threads restortion (and TLS as well) works.
Threads test reports the following

    2775 (main): Counter value:    3 tls_data =    1
    2775 (main): ( 0) fsgs_base 7f9597aa46f0
    2775 (main): ( 0) fsgs_base        0
    2775 (thr3): Counter value:    4 tls_data =    4
    2775 (thr3): ( 0) fsgs_base 42c57940
    2775 (thr3): ( 0) fsgs_base        0
    2775 (thr2): Counter value:    3 tls_data =    2
    2775 (thr2): ( 0) fsgs_base 42456940
    2775 (thr2): ( 0) fsgs_base        0
    2775 (thr1): Counter value:    4 tls_data =    3
    2775 (thr1): ( 0) fsgs_base 40c62940
    2775 (thr1): ( 0) fsgs_base        0
    2775 (main): Counter value:    4 tls_data =    1
    2775 (main): ( 0) fsgs_base 7f9597aa46f0
    2775 (main): ( 0) fsgs_base        0
    2775 (thr1): Counter value:    5 tls_data =    3
    2775 (thr1): ( 0) fsgs_base 40c62940
    2775 (thr1): ( 0) fsgs_base        0

as expected.

This commits merges all preliminary commits into
the final one (sigreturn branch was always experimental
and forced update).

Still some problems remain:

1) While creating threads with clone() the
   flags are to be revisited. We use some predefined
   set here but it's not really correct.

2) No setup of pids in PCB thread zone.

3) No restore of FPU.

But at least on some basic tasks restore works well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-12 19:26:40 +04:00
Cyrill Gorcunov
0a26593a3b dump, restore: Add blocked signals mask
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-09 00:29:41 +04:00
Cyrill Gorcunov
566a900e4e restore: Use prctl for vDSO restoration
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 17:53:47 +04:00
Cyrill Gorcunov
76df6d9ed5 syscalls: Add sys_prctl helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 16:39:21 +04:00
Cyrill Gorcunov
da8f61c1c8 dump: Add GS-TLS handling
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 17:44:00 +04:00
Cyrill Gorcunov
8a8850d146 dump: Dump TLS via sys_arch_prctl
As such -- no need for kernel patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 16:29:36 +04:00
Cyrill Gorcunov
3725fd326d syscalls: Add sys_arch_prctl helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 15:24:07 +04:00
Cyrill Gorcunov
d6e7afe3d8 syscalls: Add sys_set/get_thread_area helpers
They are actually banned in kernel for now, but
we might end up needing them, so better to have
them in-place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 14:47:04 +04:00