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

68 Commits

Author SHA1 Message Date
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
Andrey Vagin
baf69d6757 Don't overwrite sigaction magic
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-01 18:26:35 +04:00
Andrey Vagin
c04cffb7ce Restore pipe flags
pipe_loop00 passed with this patch.

When we restore a regular fd (not pipe) we do use flags
directly in open() call.

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:20 +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
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
Cyrill Gorcunov
f139959ead restore: Don't use +x permission for .out files
We don't execute them anymore.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 01:22:37 +04:00
Cyrill Gorcunov
7ce2761007 restore: Check for incomplete reading of vma-entry
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 01:18:01 +04:00
Cyrill Gorcunov
2beec2268b restore: Update error messages
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 01:12:38 +04:00
Cyrill Gorcunov
7b8dee7275 restore: Use pr_perror instead of plain perror
This prints line number as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-23 00:56:58 +04:00
Cyrill Gorcunov
46083e9e00 restore: Don't forget to skip data on attached pipes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-22 13:12:30 +04:00
Cyrill Gorcunov
6357ad403f restore: Fix up message on fixing maps
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 20:38:35 +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
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
ce40f5d96f restore: Fix restoration of anonymous shared vmas
And rename prepare_and_execute_image to
prepare_and_sigreturn which is more appropriate
name here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-14 17:23:23 +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
3e72543422 restore: Handle process tree correctly
pstree file is a single one for all processes and
threads so skip non-matched entries correctly.

This brings testee test back to life.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-13 12:57:16 +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
20c3bf1033 restore: 32k of stack memory is enough
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 01:44:40 +04:00
Cyrill Gorcunov
275e97c77d restore: Increase the stack size for cloned processes
Wasted a couple of hours trying to resolve this non-obvious
issue. It's because bootstrapping the restorer code might
requre more memory than 16K on stack. Strictly speaking
we need a compile time constant here and BUG_ON.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 22:58:18 +04:00
Cyrill Gorcunov
b78c664bca restore: Fixup pstree reading
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 20:18:38 +04:00
Cyrill Gorcunov
3b7a4cbe09 restorer: Start using sigreturn_restore
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 19:14:28 +04:00
Cyrill Gorcunov
cb7a9a524d restore: Add restorer bootstrap mmap hint
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-06 01:49:57 +04:00
Cyrill Gorcunov
b69aeb9a26 restore: Don't continue on opening vmas file failure
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-05 01:39:21 +04:00
Cyrill Gorcunov
2ae009ac1b restore: Don't forget to free temporary self VMAs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 19:11:27 +04:00
Cyrill Gorcunov
f63777d2be restorer: Setup rt_sigframe to a proper address
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 15:24:40 +04:00
Cyrill Gorcunov
489745f235 restore: A number of fixups and debug printing
An idea is to align restorer size to be sure it
wont be stripped in a middle of code.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 11:58:45 +04:00
Cyrill Gorcunov
dfe814aa58 restore: Unmap running VMAs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-27 18:59:21 +04:00
Cyrill Gorcunov
57971f721d restorer: Some preliminary work initiated on mmap heuristics
Just to not lose the snippet.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-27 00:57:01 +04:00
Cyrill Gorcunov
aaf3291e00 restore: Dump current VMAs
Restorer needs to know which VMAs
to unmap before map a new set.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 22:50:46 +04:00
Cyrill Gorcunov
214b8a6a27 restore: Update memory size needed for restorer code
Since VMA areas are allocated with page granularity
better to reflect this in mmap request. This would
allow the restorer to do munmap on page boundaries.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 18:13:06 +04:00
Cyrill Gorcunov
66c1464e40 restore: Drop unneded variables
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 18:07:33 +04:00
Cyrill Gorcunov
168d8cf17d restore: restorer is finally alive
No real restore code yet, but at least it
produce message ;)

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 17:35:50 +04:00
Cyrill Gorcunov
791f2c8c25 restore: Call for indirect execution
Doesn't work at moment but just to have
a snapshot point.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 11:16:00 +04:00
Cyrill Gorcunov
ae41bc9d2a restore: Add restore_core_args facility
More convenient instead of manual offset calculations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 00:30:41 +04:00
Cyrill Gorcunov
0133a23a5e restore: Add opening core file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-25 21:25:42 +04:00
Cyrill Gorcunov
63e08215aa restore: Add restorer test
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 22:23:06 +04:00
Cyrill Gorcunov
0259dd01c0 restore: Use open_fmt_ro helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:56:21 +04:00
Cyrill Gorcunov
f8ad351f4d util: Make open_fmt being more general
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:51:41 +04:00
Cyrill Gorcunov
26857cc4e5 util: Move various helpers there
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:43:21 +04:00
Cyrill Gorcunov
f08ba92df2 restore: Update real_pid comment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-13 18:15:09 +04:00
Cyrill Gorcunov
d2f505f52c restore: Add some more comments
Add comments on real_pid member and pipe users counters.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-13 17:31:52 +04:00
Pavel Emelyanov
c416a033f9 Rename execute_image to prepare_and_execute_image
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-13 15:46:04 +04:00
Pavel Emelyanov
1f14766919 Generalize file opening
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-12 18:34:15 +04:00
Cyrill Gorcunov
609e431376 Add cr_options structure
We will need more options since the
tool should support both cgroups freezer
and a regular task stop/dump/restore/continue
transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-04 01:50:19 +04:00
Cyrill Gorcunov
a00ef142f8 Use pr_err for error printing
To follow kernel style

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-09-30 14:37:12 +04:00
Cyrill Gorcunov
65e9402d47 restore: Fix pipes restore if both pipe ends are used by former process
In case if the former process used both pipe ends we fall
into endless loop since the 'users' never reaches 1. So
to resolve this during the pipe collectioning we check if
both pipe ends were used by a former process and if so --
we connect first pipe end immediately in create_pipe and
connect the rest via  attach_pipe.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-09-30 09:00:45 +04:00