2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00
Commit Graph

1856 Commits

Author SHA1 Message Date
Pavel Emelyanov
2660b810d9 packet: Rings support
There's no way (currently) to check that the ring got restored.
Will do it once we implement mapping of a packet socket and
tcpdump app test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:55 +04:00
Pavel Emelyanov
398bec28a9 zdtm: Test for packet fanout
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:34 +04:00
Pavel Emelyanov
4ee3345beb packet: Support fanout
This one may be present and may be not, thus it's optional in the image.
The C-binding we use report the field absense in the parsed stream via
the has_xxx field, but in the google docs it's stated, that

	"When a message is parsed, if it does not contain an optional
	 element, the corresponding field in the parsed object is set
	 to the default value for that field."

Thus, I also declare the default value for it to be not zero as 0 is
a valid fanout configuration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:27 +04:00
Pavel Emelyanov
12b826dce9 packet: Update diag header with fanout and rings
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:25 +04:00
Pavel Emelyanov
277f0f2cc5 parasite: Remove unneeded headers from parasite.c
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:19 +04:00
Cyrill Gorcunov
318c45d4c3 inotify: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:57 +04:00
Cyrill Gorcunov
deea62cd3c epoll: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:49 +04:00
Cyrill Gorcunov
f5fcea4201 eventfd: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:43 +04:00
Andrey Vagin
2d42c544ae dump: save all vdso pages (v2)
If a vdso page was not accessed before dump, it's not present
and now it doesn't save in a dump image.
The vdso area is restored as VMA_ANON, it isn't an actual vdso more,
so when a not-present vdso page is accessed, a zero page would be mapped.

For this reason we should save all vdso pages in a image.

v2: make code more clear

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:13:19 +04:00
Andrey Vagin
5a0038a9eb sk-unix: fix connection to external sockets
Don't need to wait external sockets, they should exist.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 14:52:00 +04:00
Pavel Emelyanov
98759c76bb unix: Don't poll-wait on unix peer to be bound
Long time ago the conn jobs were implemented in a bad
manner -- they tried to connect to peer until it succeeds
sleeping in the middle.

Time to stop doing so and switch to proper futex-based
waiting for bound event.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 16:51:25 +04:00
Pavel Emelyanov
c2bb8404fb packet: Fix collection logging
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 16:10:29 +04:00
Cyrill Gorcunov
19672e9cd1 files: Rename argument to sock
It's unclear why we've had two different names
for same argument. Moreover, "tsk" is definitely
misnamed feature.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 15:43:22 +04:00
Pavel Emelyanov
969ca6d9bf shmem: Get rid of static array of dumped shmem areas
These are used by single process, no need in keeping them in
such a strange way. Plus, turn this array into a hash table
for better search.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 00:20:58 +04:00
Pavel Emelyanov
9554b482c2 util: Introduce the shmalloc helper
This one allocates a memory, that will be shared (MAP_SHARED)
between all the subsequent children. This can now be just used
for fd resote, later it will be required at inet socket port
binding.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-16 20:41:34 +04:00
Pavel Emelyanov
69acf64f57 packet: Add support for mclists
The implementation is rather straightforward. One thing to note
is that non-single membership of each type is not supported. It
can be done, but I'm unaware of any software doing so.

Note: the pb show routine should be tuned to support showing bytes.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 21:04:49 +04:00
Pavel Emelyanov
712979a475 pb_show: Don't show all unknown fields as boolean
Broken by 92b6d86c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 20:53:35 +04:00
Pavel Emelyanov
7e3463a855 packet: Add PACKET_COPY_THRESH into dump/restore
No test for it, sorry :( There's no easy way to check it works.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 19:41:58 +04:00
Pavel Emelyanov
fb5a5671c8 sock: Do strict socket family checks when looking up collected socket
We hash socket with inode and family, but search only by inode. Well,
yes, family should match, since all sockets are in one sockfs in kernel,
but let's make sure _we_ did things right by checking the family as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 19:16:12 +04:00
Andrey Vagin
da2ebabf86 zdtm.sh: check that the util "ip" containes our patches
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:50:19 +04:00
Pavel Emelyanov
fb57cd126e proto: Add comments describing why we need two IDs for unix and inet sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:45:40 +04:00
Pavel Emelyanov
4ff60cd870 packet: Switch to use packet diag module
It's in net-next already and does provide all we currently
need (and more). Implementation is like for inet and unix
sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:39:21 +04:00
Andrey Vagin
b50861327e zdtm: don't compile tests with --static
zdtm.sh copies all required libraries in a new root

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 15:06:49 +04:00
Pavel Emelyanov
29f6d62a8a pb: Init fsize to make compiler happy
protobuf.c: In function ‘pb_show_msg’:
protobuf.c:384:68: error: ‘fsize’ may be used uninitialized in this function [-Werror=uninitialized]
protobuf.c:247:9: note: ‘fsize’ was declared here

The warning about 'may be uninitialized' is false -- the BUG() is a never-returning function.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:52:21 +04:00
Stanislav Kinsbursky
96b62808ff protobuf: use pretty output for inet sockets
v4:
1) Only address specificator ('A') left

New custom specificators:

'A': output as socket address

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:50:48 +04:00
Stanislav Kinsbursky
694576723c protobuf: use pretty output for pstree
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:40 +04:00
Stanislav Kinsbursky
3904b402bb protobuf: "pretty" engine
v2:
1) parser updated to properly parse strings like this: "11:%x 1:%d"

Protobuf generic show function now accept a string with pretty specificators.
The string have to look like below (an example):

"0:%d 3:%u"

where numbers with colon specifies field number (the same number as in
proto-file) and "%[a-zA-Z]" specifies output format.
If pretty specificator for specified for a field, then it will be used for
output instead of generic hexidecimal view.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:21 +04:00
Stanislav Kinsbursky
50ff74ffa9 protobuf: show field cleanup
Let's pass field structure to show functions. Hope, it makes the mess less
anoying...

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:40 +04:00
Stanislav Kinsbursky
ed9cbaf412 protobuf: field showing routine split
Will be usefull later with "pretty" show support.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:03 +04:00
Stanislav Kinsbursky
92b6d86c7e protobuf: helper for show function selection introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:49 +04:00
Stanislav Kinsbursky
f64633bd7d protobuf: service helper for show routine introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:47 +04:00
Stanislav Kinsbursky
3f1b07f5a7 protobuf: move data pointer to field structure
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:47 +04:00
Stanislav Kinsbursky
ea5f645463 protobuf: structure for currently showing field introduced
"depth" variable was moved to field structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:29 +04:00
Stanislav Kinsbursky
248a97c160 protobuf: rename type for show functions
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:10 +04:00
Stanislav Kinsbursky
d84dc289a7 protobuf: remove carriage return from unknown object print
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:55 +04:00
Stanislav Kinsbursky
691bbdad4b protobuf: change pb_pr_field_t to pointer
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:43 +04:00
Stanislav Kinsbursky
621afa560d zdtm: fix compile error in case of NEW_IPC_NS is not set
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:24:06 +04:00
Cyrill Gorcunov
f7c22fc771 make: Build crtools with -O2 by default
Enable debugging only if DEBUG=1 provided.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:22:49 +04:00
Cyrill Gorcunov
1663d74996 make: Add -fno-strict-aliasing
Since we use some kernel tricks for CMSG_FIRSTHDR
some compilers (in particular gcc version 4.4.5
20110214 (Red Hat 4.4.5-6)) do complain about strict
aliasing.

Thus pass -fno-strict-aliasing to be on the same
coast as kernel is.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:22:42 +04:00
Pavel Emelyanov
3ae36e700f restore: Don't mess with last_pid when restoring pidns init
When we fork a pidns init there's no need in specifying its pid,
as it will be autogenerated to 1. Clean the code not to mess with
the last_pid sysctl at all in that case, rather than just omitting
the write into it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:09:20 +04:00
Andrey Vagin
6aaf65642b zdtm: move all logic about namespaces from test_init in libzdtm
A test will be executed in new set of namespaces if the environment
variable ZDTM_NEWNS is set. A pid of the root task will be written in
$ZDTM_PIDFILE and a root fyle system will be changed on $ZDTM_ROOT.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:56:20 +04:00
Andrey Vagin
aabb56bd66 crtools: write a pid of a root task in a specified file
When we restore a pid namespace the root task will get some unknown pid
in the original (i.e. -- the ns crtools a launched from) one. To find
this pid out one can use this option -- it will make the pid obtained by
the new init to be written into a pid file.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:54:00 +04:00
Andrey Vagin
a5ac06f503 net: define PACKET_TIMESTAMP
It's required for compiling on RHEL6

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:50:37 +04:00
Andrey Vagin
d0476ea93b sockets: fail if an unsupported socket is in a dumped netns
If netns is dumped, crtools fails if it collects unsupported sockets.

If netns isn't dumped, crtools will fail only
if an unsupported socket should be dumped.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:49:21 +04:00
Andrey Vagin
acf73093df sk-inet: save the socket option IPV6_V6ONLY (v2)
Most part of services (ssh, httpd, ...) create two separate sockets
one for ipv4 and one for ipv6. If IPV6_V6ONLY isn't dumped, bind() returns
EADDRINUSE

v2: use do_dump_opt and initialize yes = 1

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:46:43 +04:00
Andrey Vagin
6afafb12ca sk-inet: if a source port isn't zero, a socket should be bound (v2)
Now crtools checks address, but it may be zero. For example,
a listen socket is bound to zero address to accept connections
from any addresses.

v2: add a comment about zero port

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:39:23 +04:00
Pavel Emelyanov
51133437c9 fd: Remove per-filetype make_gen_id abstraction
It doesn't makemuch sense in pulling this further. The generic genid generation seems to
be enough for eny file type.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:41:29 +04:00
Pavel Emelyanov
acba1e9bae sock: Cleanup inet sockets collecing
There is no need in 6 receive callbacks -- we can find out family and protocol
(and thus -- type) out of the inet_diag_req_v2 passed through transparent arg
of nlk request engine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:32:38 +04:00
Pavel Emelyanov
64149b40f2 code: A little but more checkpatch fixes over code
There are more in test/ (and checkpatch.pl crashes in the middle =),
but seem to be all.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:19:34 +04:00
Pavel Emelyanov
d10ee39f28 code: Fix checkpatch.pl warnings since v0.1
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:03:11 +04:00