2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Commit Graph

729 Commits

Author SHA1 Message Date
Pavel Emelyanov
a038cbd9b8 files: Fix memory overflow checks for shared files.
Otherwise we skip shared segment
overflow on big scales and tests sporadically fail.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-02 01:34:40 +04:00
Pavel Emelyanov
153c033d7e zdtm: Add sleep() to zombie00
When creating zombies we must wait for them to appear to test that we do
support zombies, but not some transient state. But the thing is that we
cannot use wait() or any other synchronous call here, thus we have to
suck and use sleep(1) :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-02 01:34:31 +04:00
Pavel Emelyanov
766a42e316 ptrace: Kill task with -9 explicitly when detaching
Strange fact, but a task seems to live for some time after PTRACE_KILL :(
Don't know yet why this happens, I'm poking Oleg on that, but this one makes
it die right at once.

The streaming file read test passes after this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 22:17:56 +04:00
Cyrill Gorcunov
e61605169f ctrools: Rewrite task/threads stopping engine is back
This commit brings the former "Rewrite task/threads stopping engine"
commit back. Handling it separately is too complex so better try
to handle it in-place.

Note some tests might fault, it's expected.
---

Stopping tasks with STOP and proceeding with SEIZE is actually excessive --
the SEIZE if enough. Moreover, just killing a task with STOP is also racy,
since task should be given some time to come to sleep before its proc
can be parsed.

Rewrite all this code to SEIZE task and all its threads from the very beginning.

With this we can distinguish stopped task state and migrate it properly (not
supported now, need to implement).

This thing however has one BIG problem -- after we SEIZE-d a task we should
seize
it's threads, but we should do it in a loop -- reading /proc/pid/task and
seizing
them again and again, until the contents of this dir stops changing (not done
now).

Besides, after we seized a task and all its threads we cannot scan it's children
list once -- task can get reparented to init and any task's child can call clone
with CLONE_PARENT flag thus repopulating the children list of the already seized
task (not done also)

This patch is ugly, yes, but splitting it doesn't help to review it much, sorry
:(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:49:28 +04:00
Cyrill Gorcunov
ab82c2de98 Revert "ipc: Drop u32[2] from image, simply use u64 all the time"
This reverts commit 4f83d028ff.

It breaks IPC test-case, need to investigate.
2012-02-01 19:27:39 +04:00
Cyrill Gorcunov
63b88720a3 Revert "ctrools: Rewrite task/threads stopping engine"
This reverts commit 6da51eee3f.

It breaks transition/file_read test case
2012-02-01 19:27:28 +04:00
Cyrill Gorcunov
57454c524b Revert "make: Switch to -02 by default"
This reverts commit 501d85193c.

Need to investigate code generated for parasite since dumper fails.
2012-02-01 19:27:17 +04:00
Andrey Vagin
aa19c22e85 make: Link parasite.o and util-net.o
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:27:07 +04:00
Andrey Vagin
d4c67416e9 parasite: transfer image fd in parasite
Don't open image files from parasite.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:26:58 +04:00
Andrey Vagin
13faf4ee7f parasite: create unix socket in parasite for transfering fd (v3)
Before we used absolute pathes to images and wrote logging messages in
stderr of a target process.

Now we are able to create fd and send it to parasite.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:26:50 +04:00
Andrey Vagin
1465fade3b util: move recv_fd and send_fd in a separate file
It will be used in the parasite

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:26:41 +04:00
Andrey Vagin
fd7c44dd86 util: add socket syscalls
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:26:33 +04:00
Cyrill Gorcunov
339ad2d887 files: Get rid of strict-aliasing violations
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 17:35:05 +04:00
Pavel Emelyanov
7050ea2ca8 zdtm: Static pstree test
I'm waiting for Andrey's

* pthread join fix
* infrastructure for fokring in zdtm

to extend it with threads.

Besides, we/me need to fix the seizing of dynamically forking tasks
to write a transition pstree test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 17:29:23 +04:00
Pavel Emelyanov
6da51eee3f ctrools: Rewrite task/threads stopping engine
Stopping tasks with STOP and proceeding with SEIZE is actually excessive --
the SEIZE if enough. Moreover, just killing a task with STOP is also racy,
since task should be given some time to come to sleep before its proc
can be parsed.

Rewrite all this code to SEIZE task and all its threads from the very beginning.

With this we can distinguish stopped task state and migrate it properly (not
supported now, need to implement).

This thing however has one BIG problem -- after we SEIZE-d a task we should seize
it's threads, but we should do it in a loop -- reading /proc/pid/task and seizing
them again and again, until the contents of this dir stops changing (not done now).

Besides, after we seized a task and all its threads we cannot scan it's children
list once -- task can get reparented to init and any task's child can call clone
with CLONE_PARENT flag thus repopulating the children list of the already seized
task (not done also)

This patch is ugly, yes, but splitting it doesn't help to review it much, sorry :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 17:29:13 +04:00
Cyrill Gorcunov
501d85193c make: Switch to -02 by default
And turn on -O0 -ggdb3 only if DEBUG=1.
Optimization was turned off at early
prototype stage so no need to carry it
now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-01 17:23:44 +04:00
Cyrill Gorcunov
6f589a4f6e sockets: Fix a few problems if compiled with DEBUG=1
sockets.c: In function ‘show_one_inet_img’:
sockets.c:151:2: error: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘char *’ [-Werror=format]
sockets.c: In function ‘open_unix_sk_stream’:
sockets.c:925:10: error: unknown escape sequence: '\C' [-Werror]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-01 17:23:44 +04:00
Cyrill Gorcunov
4f83d028ff ipc: Drop u32[2] from image, simply use u64 all the time
This eliminate

 | ipc_ns.c:287:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

and makes code simplier.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-01 17:23:44 +04:00
Cyrill Gorcunov
7197b9467d namespaces: Eliminate uninitialized 'ret' usage
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-01 17:23:44 +04:00
Cyrill Gorcunov
779e8b630d Merge branch 'zdtm' of https://github.com/avagin/crtools
* 'zdtm' of https://github.com/avagin/crtools:
  zdtm: set SA_RESTART everywhere
  zdtm.sh: clean up
  zdtm: print test dir, dump and restore path (if any) in case of error
2012-02-01 17:20:23 +04:00
Andrey Vagin
3f614e4498 restore: fix length of spliced data
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 17:17:58 +04:00
Andrey Vagin
dd73699b37 zdtm: set SA_RESTART everywhere 2012-02-01 16:53:37 +04:00
Andrey Vagin
0981f36179 zdtm.sh: clean up 2012-02-01 16:53:37 +04:00
Stanislav Kinsbursky
795d64574d zdtm: print test dir, dump and restore path (if any) in case of error
v7: cosmetic chages due to public pressure

v6: silly "/" miss fixed

v5: it finally workks as expected

v4: fixed wrong error print after successfull  run on all zdtm tests

v3: spaces removed

v2: print test output file path  (if present)

Print dump and restore file in case of running all tests suit.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
2012-02-01 16:53:37 +04:00
Cyrill Gorcunov
229defc928 Make sure no uninitialized values are used
I've got it if -O2 compilation option used.

 | cr-restore.c:1069:5: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
 | sockets.c:1145:7: error: ‘sk’ may be used uninitialized in this function [-Werror=uninitialized]

In first case 'ret' indeed might be uninitialized, and
in second case "goto err" was called too early. Fix them both.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 15:24:39 +04:00
Cyrill Gorcunov
3876cadad1 make: docs -- Use Makefile.inc
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 15:12:19 +04:00
Cyrill Gorcunov
9993ab395a make: Clean docs on "make clean" as well
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 15:12:11 +04:00
Cyrill Gorcunov
7a7315d09b make: Fix Documentation/Makefile to not rebuild man without change
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 15:12:02 +04:00
Cyrill Gorcunov
44a05e70ec ips_ns.h: Add CR_ prefix to header defines
Reported-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 14:39:01 +04:00
Cyrill Gorcunov
1824611b8e list: Cleanup spaces/tabs mess
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 14:38:49 +04:00
Kir Kolyshkin
c7168143a3 ipc_ns.c: remove hardcoded sizes
Use sizeof() instead.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 02:55:16 +04:00
Kir Kolyshkin
11f2ce03da parse_pid_stat(): use pr_err()
We do not want to use pr_perror() here, because

1. fscanf only sets errno in case it returns EOF
2. we are not really interested in errno value

So use pr_err() instead.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 02:55:16 +04:00
Kir Kolyshkin
1408ead858 Assorted trivial message fixes
* kid -> child
* First letter should be uppercase
* Misc typos in messages and comments

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 02:55:16 +04:00
Kir Kolyshkin
ad3bc05771 uts_ns.c: use pr_perror() where appropriate
There are quite a few cases where we need to print system error string.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 02:55:16 +04:00
Cyrill Gorcunov
ca09995934 A few cleanups to uts_ns
- drop hardcoded numbers, use sizeof
 - drop unneeded local argument

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 23:35:07 +04:00
Cyrill Gorcunov
916f79a64b uts-ns: Add new line between system headers and our owns
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 23:34:58 +04:00
Cyrill Gorcunov
aecc985060 restorer: Don't preceed #defines with tabs
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 23:34:47 +04:00
Cyrill Gorcunov
bbf71707b9 ipc: Add missing ipc_ns.h
Which was missed to add to git index
in one of previous IPC patch series.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 22:42:33 +04:00
Stanislav Kinsbursky
bb6d57e856 IPC: namespace tunables migration test
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-31 22:32:22 +04:00
Stanislav Kinsbursky
c75c33cb86 IPC: restore namespace itself
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-31 22:32:22 +04:00
Stanislav Kinsbursky
5d40ea2ff1 IPC: show dump content
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-31 22:32:22 +04:00
Stanislav Kinsbursky
c826057a9c IPC: dump namespace itself
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-31 22:32:22 +04:00
Stanislav Kinsbursky
9cdfe71921 namespaces: docs updated
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-31 22:32:22 +04:00
Stanislav Kinsbursky
0213d3ec64 namespaces: parametrized namespace option introduced
v2: strlen() check removed from parse_ns_string()

Now '-n' option must be followed by namespaces tags, separated by commas.
Currently, only "uts" namespace is supported.

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-31 22:32:22 +04:00
Cyrill Gorcunov
1e694235b4 zdtm: Drop pthread00 test for a while
It requires properly syncs in test case
itself so I need to rewrite the test code
(which I'm going to do pretty soon).

Meanwhile drop this test-case.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
2012-01-31 19:48:34 +04:00
Cyrill Gorcunov
7705df5397 crtools: Make fdset operations robust against open() errors
There are two cases for cr_fdset_open

 - It might be called with already allocated
   memory so we should reuse it.

 - It might be called with NULL pointing out
   that caller expects us to allocate memory.

If an open() error happens somewhere inside cr_fdset_open
it requires two error paths

 - Just close all files opened but don't free memory
   if it was not allocated by us

 - Close all files opened *and* free memory allocated
   by us.

In any case we should close all files opened so close_cr_fdset()
helper is splitted into two parts.

Also the caller should be ready for such semantics as well and
do not re-assign pointers obtained but simply test for NULL
on results.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-31 19:15:32 +04:00
Kir Kolyshkin
6c1e5978c4 hex_dump(): fix address printing
- Fix printing the same address on every line (ie p+i, not p).
 - Use GNU %p to print pointer, to avoid messing with width etc.
   Side effect: 0x is added, hope that's ok.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 17:19:00 +04:00
Cyrill Gorcunov
a9ba9732c9 hex_dump: Convert argument to long
To eliminate format problem

 | util.c:60:10: error: format ‘%lx’ expects argument of
 | type ‘long unsigned int’, but argument 2 has type
 | ‘unsigned char *’ [-Werror=format]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 16:54:03 +04:00
Kir Kolyshkin
cced37daff files.c: fix printf format warnings
files.c: In function ‘collect_fd’:
files.c:111:2: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘u64’
files.c: In function ‘open_fd’:
files.c:348:3: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘u64’
files.c: In function ‘receive_fd’:
files.c:425:5: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘u64’
files.c:425:5: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘u64’

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 15:57:34 +04:00
Kir Kolyshkin
6c9d6a86a4 sockets.c: fix printf format warnings
sockets.c: In function ‘try_dump_socket’:
sockets.c:366:3: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘__ino_t’

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-31 15:57:25 +04:00