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

52 Commits

Author SHA1 Message Date
Cyrill Gorcunov
950e788b1c Dump: Add missing ending new lines to pr_perror
pr_perror is not the same as perror and requires
new line at then end.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-10 12:49:55 +04:00
Cyrill Gorcunov
6701296f5a dump: Be ready for absence of output from /proc/pid/children
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 11:45:55 +04:00
Andrey Vagin
4c479da259 Dump and restore current work directory (v2)
CWD is saved as file descriptor with number -1.

v2: use dump_regular_file

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-07 17:16:41 +04:00
Cyrill Gorcunov
d924a240ff make: Drop redundand dependency on parasite.h
There is no such file at all and it forced build
process to re-build every make command passed.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-05 20:36:57 +04:00
Cyrill Gorcunov
485c4b50d1 show: Rework show procedure
Added

 - ability to parse every single file crtools
   understands via magic number

 - dumped memory pages can be rendered in two
   modes -- as a simple set of pages' virtual addresses
   or in hexdummp fashion (via -c command line key).

For example

  ./crtools -s -c -f pages-2557.img

CR_FD_PAGES: pages-2557.img
----------------------------------------
    7fffb44ace20: 00 00 00 00 00 00 00 00  00 00 00 74 65 73 74 2f  |. . . . . . . .  . . . t e s t / |
    7fffb44ace30: 74 65 73 74 2d 73 69 67  61 63 74 69 6f 6e 00 48  |t e s t - s i g  a c t i o n . H |
    7fffb44ace40: 4f 53 54 4e 41 4d 45 3d  6c 6f 63 61 6c 68 6f 73  |O S T N A M E =  l o c a l h o s |
    7fffb44ace50: 74 2e 6c 6f 63 61 6c 64  6f 6d 61 69 6e 00 54 45  |t . l o c a l d  o m a i n . T E |

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-05 15:59:01 +04:00
Cyrill Gorcunov
da61f73263 dump: Test errors on xrealloc result
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-05 13:36:08 +04:00
Cyrill Gorcunov
29e66613cb dump: Drop redundant pr_debug
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-05 13:21:43 +04:00
Pavel Emelyanov
ec8cdcd7cf crtools: Cleanup pstree entry code
After all the child/threads stuff is moved to helpers it is
possible to remove some unneeded code paths and local variables.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 18:39:35 +04:00
Pavel Emelyanov
8340bff864 crtools: Cleanup children stuff parsing
Move all the parsing of /proc/pid/children into a helper to be symmetrical
with the threads parsing.

Error from xrealloc is ignored as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 18:39:22 +04:00
Pavel Emelyanov
5e47e233df crtools: Cleanup threads stuff parsing
Move the whole code dealing with parsing threads at collect_pstree
stage into one function.

The nr_threads calculation is performed inside it based on the amount
of directories in /proc/pid/task, not the Threads: count in status.

Error from xrealloc is ignored by now.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 18:37:59 +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
63fea93076 dump: Switch to /proc/$pid/children parsing to obtain children set
This also depends on kernel's inteface being changed,
so kernel/ is updated as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2011-12-01 18:51:40 +04:00
Cyrill Gorcunov
6661b555b9 dump: Don't forget to close opened file on error path
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:30:53 +04:00
Andrey Vagin
146735f933 Dump direcory descriptor as a file descriptor
If I understand correct, they don't differ in linux.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:24 +04:00
Andrey Vagin
6949e0f09f Dump memory character devices as a file.
It's work for /dev/zero, /dev/null and other simple devices.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:16 +04:00
Andrey Vagin
7553620298 Dump SigBlk instead of SigCgt
It's because this mask will be restored as rt_sigframe->uc.uc_sigmask.
uc_sigmask will be set as current->blocked in sigreturn, so we should
dump SigBlk in this case.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:12 +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
bc1f9d728a Skip a standard destriptor only if it's tty (v2)
ZDTM tests redirect standart descriptors to /dev/null

v2: * Skip tty only if it's a standard descriptor.
    * No strcmps on names.

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:00 +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
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
1c5f981e51 cleanup: dump -- Add warning on unexpected VMA
Instead of simply dropping this dead code, put
a warning here, just to be on a safe side.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-14 18:51:36 +04:00
Cyrill Gorcunov
ba63496330 dump: Update comment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-14 17:22:17 +04:00
Cyrill Gorcunov
db2064811d dump: Add missing newline in error message
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-09 13:00:12 +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
0355f1d23a dump: Don't fail on dumping paths for anon shared mappings
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 13:25:15 +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
2cc7488de2 dump: Make VMA parsing to handle absence of map_files
Needed in testing purposes. Also make free_mappings
being a global one (will need it in restorer).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 22:48:10 +04:00
Cyrill Gorcunov
20ff379ee4 dump: Append threads to the core file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 23:01:42 +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
c475bccd53 dump: Use memzero_p
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 11:27:28 +04:00
Cyrill Gorcunov
2dc583092c dump: Don't forget to close fds
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:43:52 +04:00
Cyrill Gorcunov
af647ce009 dump: Dump threads params as well
We only need registers at the moment

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:43:52 +04:00
Cyrill Gorcunov
611debc312 dump: Add parsing of thread pids
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:43:15 +04:00
Cyrill Gorcunov
b001849a00 dump: Get rid of global vma_area_list
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Conflicts:

	cr-dump.c

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:29:36 +04:00
Cyrill Gorcunov
c60f01b944 dump: Get rid of global pstree_list
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:02:27 +04:00
Cyrill Gorcunov
c2bd177330 dump: Add comments on task seizing and stopping
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-13 18:57:13 +04:00
Cyrill Gorcunov
9b6708e3a3 dump: Don't poke cr fdset with open/close needlessly
Reported-by: Pavel Emelyanov xemul@parallels.com
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-13 16:18:32 +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
Pavel Emelyanov
5a397e8a59 Rework fdinfo readinf to use FILE *
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-12 18:30:04 +04:00
Cyrill Gorcunov
4389c021fc dump, kernel: Add some mm structure members into the dump
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-12 18:05:07 +04:00
Cyrill Gorcunov
ce65f2f718 dump, kernel: Add start/end_code data
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-12 16:02:36 +04:00
Cyrill Gorcunov
f7e6e63b44 kernel, dump: Obtain brk value
Also re-make image to be 2 pages in size
which should be enough for basic params we
need to restore tasks.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-12 09:40:02 +04:00
Cyrill Gorcunov
4b7a318322 dump: Prepare for new core_entry layout
core_entry layout is arch dependant.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-11 01:32:39 +04:00
Cyrill Gorcunov
99466eb328 dump: Add dumping a tasks's flags
We need it to figure out if FPU was used
so that we need to restore context later.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-10 17:05:12 +04:00
Cyrill Gorcunov
2efb66d69a dump: Sanitize dumping message
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-06 14:07:48 +04:00
Cyrill Gorcunov
2f3c929aff dump: Add should_ignore_fd helper
We should ignore tty devices for a while.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-04 14:07:07 +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
8f0af4f8a6 Restore task's command line as well
Note binary format for core file is changed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-01 13:24:34 +04:00