2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-02 15:25:21 +00:00
Commit Graph

800 Commits

Author SHA1 Message Date
Stanislav Kinsbursky
f3253a40d2 checkpoint: IPv4 listening sockets dumping support 2012-01-18 12:38:58 +04:00
Stanislav Kinsbursky
654216c1df checkpoint: generalize netlink requests code
This is a precursor patch. Netlink request code is mostly the same for any
kind of sockets. Only 2 places differs: request creation and callback address.
This patch parametrizes netlink call function with a pointer to a request
structure, request size and receive callback, which replaces hard-coded unix
sockets parts.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 12:38:54 +04:00
Cyrill Gorcunov
74bb5d9a26 Merge branch 'stas-make' into dev
* stas-make:
  make: fix parasite deps
  make: cleanup deps files usage
  make: cleanup deps files mess
  make: cleanup targets mess
  cr-dump: remove unnessesary parasite header

Conflicts:
	Makefile

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 22:17:00 +04:00
Stanislav Kinsbursky
cebc7de227 make: fix parasite deps
Remove explicit parasite targets dependence on deps files and use them as
makefile parts.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:15:02 +04:00
Stanislav Kinsbursky
d1df3f60f9 make: cleanup deps files usage
Objects does not depend on dep files. Dep files provide rules to build object
files. Thus we need to include dep files.
This also leads make to rebuild dep files (if required) before an other
targets.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:51 +04:00
Stanislav Kinsbursky
b8f57e0b35 make: cleanup deps files mess
Only two files (parasite-syscall.c and cr-dump.c) depends on parasite code.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:37 +04:00
Stanislav Kinsbursky
d9c107d7a3 make: cleanup targets mess
Targets should be defined after variables

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:23 +04:00
Stanislav Kinsbursky
7f2cd4b18a cr-dump: remove unnessesary parasite header
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:12:36 +04:00
Andrey Vagin
476fbbb6f8 restorer: make messages readable
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
31fb055220 restorer: make BUG_ON more informative
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
2cd82bc7ff restorer: move log descriptor from crtools (v2)
v2: add FIXME for linking restorer-log.c and restorer.c by ld
    I don't know how to do it now.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
74e23867bd restorer: correct indentions
The previouse patch doesn't change it to simplify review

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
014841825a restorer: isolate restorer like parasite (v4)
Before this patch the restorer's code is linked in crtools and then
we copied functions from it. In this case all function should
be inline and we can't use a global variables.

I suggest to make it like parasite. The restorer's code is isolated in
own file and will be copied wholly.  The restorer's code is compiled as
position-independent code, so we can use functions and global variale
(E.g. to save descriptor for log messages).

v2: correct indentions in a separate patch
v3: introduce a variable restore_task_exec_start symmetrical to
    restore_thread_exec_start
v4: don't give command in restorer_thread()

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
f05e2dcc1f restorer: don't use printk in restorer
BUG_ON_HANDLER from util.h may be used in restorer.
E.g. #include <util.h>
     #include <lock.h>

Now the process will be segfaulted and you can find a line
number in assemgler code. We will print messages a bit late.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
c266644150 tasks: synchronize restoration of tasks (v2)
This patch prepares code to handle errors. In the near future
we will handle SIGCHLD. If a restore of one task fails, we will
send a signal to other for completing.

For this we should have ability to wait until all task wills be
restored. This patch does it.

v2: Don't wait children.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
fb177e0312 restore: generalize mechanism of remapping memory to restorer (v2)
Sometime we want to have a shared mapping in restorer. E.g. A storage
for shared memory entries. This entries contains locks, which should
be released in restorer.

v2: fixed according to Pavel's comments

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:07:58 +03:00
Cyrill Gorcunov
31e99b7b37 restore: Drop uneeded code
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:52:14 +04:00
Cyrill Gorcunov
55d491fb0e restore: Use non sys_ versions of libc functions
There is no need to use sys_ versions of libc functions
when we run in non relocated code. It's a leftover from
early testing time. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:52:04 +04:00
Andrey Vagin
1494dbdf63 files: correct message
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:50:39 +04:00
Andrey Vagin
feae91fe9d files: restrict number of fdinfo_list_entries
We allocate only one page for fdinfo_list_entries.
In the future we will be able to resize this memory.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:50:20 +04:00
Andrey Vagin
c1e69464dc file: remove crap from prepare_fdinfo_global
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:49:57 +04:00
Andrey Vagin
fd4b542e01 files: typo fix
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 11:48:29 +04:00
Cyrill Gorcunov
5eda66dd6d zdtm: Add vDSO test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 02:45:53 +04:00
Pavel Emelyanov
139a2ee27b fdinfo: Rewrite fd prep/open/recv via switch-base state-machine
Yet again -- this makes code easier to understand from my POV.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 23:52:19 +04:00
Pavel Emelyanov
7f5da73198 fdinfo: Remove unused variables from receive_fd
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 23:51:53 +04:00
Pavel Emelyanov
a2d5b88150 fdinfo: Open special fdinfos in a separate helper
Makes code easier to read.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 23:51:33 +04:00
Pavel Emelyanov
d1b3fd09b3 fdinfo: fd_is_special helper for maps and cwd
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 23:51:12 +04:00
Pavel Emelyanov
e2d8aec7f5 files: Named constant for cwd fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 23:50:50 +04:00
Cyrill Gorcunov
b3c6742a7a restore: Use xmalloc instead of plain malloc
And add error checking

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 14:31:25 +04:00
Pavel Emelyanov
2e31cb1f8e restore: Close and drop shmem remap fd
Reprimand to commits bd8b2b0f and d0a6e9a1 authors for not
cleaning after themselves...

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:44:06 +04:00
Pavel Emelyanov
a28d53f4e1 restore: Don't init master thread args
This one is skipped at restore and leaves an open core file
in target task's fdtable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:57 +04:00
Pavel Emelyanov
368c4a508b restore: Close ns_last_pid file fd
Otherwise it pops up after restore in target task's fdtable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:49 +04:00
Pavel Emelyanov
09a7273e04 restore: O_TRUNC file instead of unlink
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:41 +04:00
Pavel Emelyanov
af3616d0ce util: Sanitize get_image_path
Make it shorter and simpler and use one in open_image_ro_nocheck.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:33 +04:00
Pavel Emelyanov
8c9c575ab4 util: Move get_image_path to util.c
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:23 +04:00
Cyrill Gorcunov
4baff50c90 zdtm: Add pthread00 test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 13:43:13 +04:00
Andrey Vagin
8cc08ada8e cr-restore: don't close image fd in create_pipe
create_pipe() may restore up to 3 descriptors. They may be both ends
of pipes and a target descriptor. The image fd may hold any of them.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 12:01:33 +04:00
Cyrill Gorcunov
579e241c3b Revert "restore: pipes -- Allow to reuse descriptors"
This reverts commit 46c613cc7d.

Andrey posted a proper fix for it. Moreover, the problem in first
place was initiated by a parasite application running during test
case, crtools knows nothing about.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-16 12:01:23 +04:00
Cyrill Gorcunov
46c613cc7d restore: pipes -- Allow to reuse descriptors
It's perfectly fine to reuse descriptors here,
since we use plain pipe() call and it migh choose
the descriptor which we need after.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 23:37:20 +04:00
Pavel Emelyanov
b2cfd095fb zdtm: Make cmdline a little bit more user-friendly
Add the -l option to show the list of tests
Make the default zdtm/live/ prefix when running individual test

Now you can do it like

# sh ./zdtm.sh           for running all tests
# sh ./zdtm.sh -l        to list available tests
# sh ./zdtm.sh <test>    to run test <test>, e.g. "static/pipe00"

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:54:37 +04:00
Cyrill Gorcunov
9330ce170a Add tools/commit-bot.sh
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:45:54 +04:00
Pavel Emelyanov
6babc5c17b files: Show file ID in -s output
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:37:49 +04:00
Pavel Emelyanov
f899d0407a files: Handle the absence of ID in proc fdinfo
This makes crtools correctly abort when working on wrong kernel.
Otherwise all the open files will have the same (garbage) ID and
the subsequent restore will result in broken app.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:37:39 +04:00
Pavel Emelyanov
cc14c6eb61 pstree: Sanitize pstree image opening on restore
The old code carried the path through the stack. Now we have
pstree_pid and handy helpers to get one.

Tested by pipes00 test from zdtm (it forks).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:37:27 +04:00
Cyrill Gorcunov
f80694deed proc_pase: Make sure we may scan up to 15 symbols in name
And do not use strcpy, better to stick with strncpy.

Moreover, to be on a safe side make proc internal
buffer big enough even for "(%16s)" format, it's
hardly possible that the kernel ever change stat
format but just to be on a safe side.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:37:17 +04:00
Cyrill Gorcunov
a9969dcf72 restore: Format printing in restore_pipe_data
To align data with previous callers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:36:52 +04:00
Cyrill Gorcunov
05c142c0f5 proc_parse: Make sure the fields in parsing stream do match
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:36:40 +04:00
Cyrill Gorcunov
976c092c3f show: Drop redundant \n in pr_img_tail
Before

# ./crtools -s -f unixsk-12713.img

CR_FD_UNIXSK
----------------
fd    8 type  2 state  7 namelen   17 backlog   17 id  79422 peer      0 --> test-socket-conn
fd    9 type  2 state  7 namelen   23 backlog   23 id  79423 peer  79423 --> test-socket-bound-conn

----------------

After

# ./crtools -s -f unixsk-12713.img

CR_FD_UNIXSK
----------------
fd    8 type  2 state  7 namelen   17 backlog   17 id  79422 peer      0 --> test-socket-conn
fd    9 type  2 state  7 namelen   23 backlog   23 id  79423 peer  79423 --> test-socket-bound-conn
----------------

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:36:27 +04:00
Cyrill Gorcunov
893f5099cb show: Drop redundat rendering of process tree
Leftover from merging stage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 22:36:18 +04:00
Cyrill Gorcunov
fd0802ab66 proc_parse: Drop ending ')' from format
%s specificator eats it and matching stream fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-15 01:42:08 +04:00