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

664 Commits

Author SHA1 Message Date
Andrey Vagin
a00b90c041 parasite: correct error code
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 16:02:47 +04:00
Andrey Vagin
e6a52bdad1 parasite: remove unused commands
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 16:02:38 +04:00
Cyrill Gorcunov
162bcdeacf Merge branch 'pre'
* pre:
  zdtm: Tests for xids and caps

Conflicts:
	test/zdtm.sh

The sockets00 test was added earlier.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:04:57 +04:00
Pavel Emelyanov
d40e50d7c9 zdtm: Tests for xids and caps
Rather simple and straightforward and atomic tests should be.
The only problem is that after changing any from the subj the
subsequent opens for .out/.pid files fail so test actually
forks in the beginning. That said -- we need some API in the
lib/ for such forkers.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:03:29 +04:00
Pavel Emelyanov
beb158a66e cr: Task creds support
Dumping is simple. All but secbits can be read from proc, secbits
are got from parasite.

Restoring is a bit tricky -- when you change anything on kernel
cred's struct it performs sophisticated checks and can change
some more stuff than requested, so the creds restoration procedure
is carefully commented step-by-step.

Another thing to mention is that creds are restored after everything
else, i.e. right before performing final threads sync and sigreturns.
This is done to avoid potential problems with insufficient caps for
restoring other stuff (e.g. CAP_DAC_OVERRIDE or zero euid is most
likely required for opening any image file and the notorious control
/proc/sys/kernel/ns_last_pid, which in turn is performed till the
very last moment).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:00:50 +04:00
Pavel Emelyanov
d846d108f6 syscalls: Prepare syscalls and bits for (mostly) setting creds
These are setXXXid, capset and various bits for prctl and caps machinery.
The thing is that the caps API is not yet fully in glibc so we have to
declare some bits even for core code, not just for restorer/parasite.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:00:33 +04:00
Pavel Emelyanov
f382d2a376 proc_parse: Routine for reading creds from /proc/pid/status
All the IDs and caps are in there. Just read them for future use.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:00:18 +04:00
Pavel Emelyanov
47c161f2dc parasite: Dump misc command
Add command and basis for dumping minor bits for task
from parasite code. It's supposed to retrieve minor bits
form tasks which cannot be read from /proc.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 12:59:54 +04:00
Cyrill Gorcunov
25aa9e062c zdtm: Add utsname.c source code
I occasionally droppped this file but it's
a part of commit

dcd64e9d10

So add it back.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 12:52:44 +04:00
Andrey Vagin
00a337473e zdtm: cleanout netlink00
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2012-01-30 09:37:13 +03:00
Cyrill Gorcunov
3a1de34132 zdtm: Disable strict aliasing optimization
Just disable it for a while, otherwise we get
in test/zdtm/live/streaming/netlink00.c

cc1: warnings being treated as errors
netlink00.c: In function ‘form_request_del’:
netlink00.c:311: error: dereferencing pointer ‘rtap’ does break strict-aliasing rules
netlink00.c:312: error: dereferencing pointer ‘rtap’ does break strict-aliasing rules
netlink00.c:310: note: initialized from here
netlink00.c: In function ‘form_request_add’:
netlink00.c:271: error: dereferencing pointer ‘rtap’ does break strict-aliasing rules
netlink00.c:272: error: dereferencing pointer ‘rtap’ does break strict-aliasing rules
netlink00.c:270: note: initialized from here

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 10:36:36 +04:00
Cyrill Gorcunov
65ac9ccb04 Drop kernel patching from README
It's outdated anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-29 16:26:36 +04:00
Cyrill Gorcunov
980529f44f docs: Update options
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-29 00:40:26 +04:00
Cyrill Gorcunov
17a4a6cd09 docs: Initial commit
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-29 00:09:32 +04:00
Pavel Emelyanov
4804db00aa restore: Switch code to new R/W API
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-28 23:55:50 +04:00
Cyrill Gorcunov
74ad4fb16b tools: commit-bot to emal criu mailing list
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 23:25:29 +04:00
Cyrill Gorcunov
875cbfe705 zdtm: Add sockets00 test
This covers UNIX stream sockets including
in-flight connections.

No dgram sockets yet implemented.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
29bda9aae5 sockets: Restore in-flight unix stream sockets
It's done in two steps

 - On checkpoint we find which icons are present
   over all sockets and setup peer number to
   appropriate listening socket

 - On restore we collect listening sockets and once
   we find in-flight connection we search for appropriate
   listening socket name and use it to call connect() then

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
54d7a58801 make: Add 'help' target
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
f974de9c49 sockets: Add SK_HASH_LINK helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
641844c349 sockets: Allow to dump unix sockets with inflight connections
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
b21c2c8c1d sockets: Print icons numbers in debug printing
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
b0e4a2edcd sockets: Add nr_icons member to track number of icons instead of zero ended array
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
ff83500f5c sockets: sockest: Show collected socket once they get hashed
Otherwise debug printing has no inode number in report.
Not really it's that important but very convenient
if you need detailed output.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 23:21:06 +04:00
Cyrill Gorcunov
9b2e191392 sockets: Nitpick on error printing in open_inet_sk
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 20:19:01 +04:00
Stanislav Kinsbursky
6e0353badc restore: missed carriage return added
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 20:18:26 +04:00
Cyrill Gorcunov
a5228b3bb4 Merge branch 'zdtm' of https://github.com/avagin/crtools
* 'zdtm' of https://github.com/avagin/crtools:
  zdtm: remove warnings
  zdtm: move tast_daemon after preparation actions
  zdtm: fix warnings in mmx00.c
  zdtm: say no to EINTR
  zdtm: fix warning in Makefile
  zdtm: fix warning in transition/ptrace.c
  zdtm: initilize a variable in cmdlinenv00.c
2012-01-27 16:40:50 +04:00
Andrey Vagin
255cd497bd util: print warning if a image file is absent
It may be legal. E.g. for zombie

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 15:10:38 +04:00
Andrey Vagin
61f50a9cf9 zdtm: remove warnings 2012-01-27 13:10:12 +04:00
Andrey Vagin
003b6e906b zdtm: move tast_daemon after preparation actions 2012-01-27 13:08:19 +04:00
Andrey Vagin
8818ee72e6 zdtm: fix warnings in mmx00.c
mmx00.c:22:34: warning: array subscript is above array bounds
[-Warray-bounds]
mmx00.c:22:34: warning: array subscript is above array bounds
[-Warray-bounds]

PSUBW handles 64 bits.
2012-01-27 12:56:22 +04:00
Cyrill Gorcunov
d4cfba8947 restore: Bring original SIGCHLD handler back once task is restored
Otherwise if restored task exit we get error message in form

 | Error (cr-restore.c:1302): 7244 exited, status=0

while restored task simply finished working.

Pointed-out-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 12:39:42 +04:00
Andrey Vagin
af7a89778c zdtm: say no to EINTR
Everyone have known that EINTR is returned due to cpt/rst.
But it's error, we forgot to set SA_RESTART;).
2012-01-27 12:32:02 +04:00
Andrey Vagin
6a7124895a zdtm: fix warning in Makefile
Makefile💯 warning: overriding commands for target cmdlinenv00.pid'
Makefile:91: warning: ignoring old commands for target cmdlinenv00.pid'
2012-01-27 11:30:31 +04:00
Andrey Vagin
fc2de17444 zdtm: fix warning in transition/ptrace.c 2012-01-27 11:24:05 +04:00
Andrey Vagin
88bd35a47a zdtm: initilize a variable in cmdlinenv00.c 2012-01-27 11:16:09 +04:00
Cyrill Gorcunov
9d913b6551 sockets: Fix freeing dgram sockets data
Otherwise use-after-free error happens.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-27 02:33:32 +04:00
Cyrill Gorcunov
c2353b30a2 make: Add *.i target
Convenient for debug purpose.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-27 02:32:30 +04:00
Pavel Emelyanov
16c58dbd11 magic: Fix PIPEFS_MAGIC constant
This one is actually an internal kernel magic number for pipefs filesystem
and shouldn't be changed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-26 20:42:45 +04:00
Pavel Emelyanov
60dee71484 magic: Change magic numbers
Existing ones are boring. Let's switch them into geographical coordinates
of various Russian towns in NNNNEEEE form.

4 digits for a coordinate give us up to 2km of inaccuracy, which is more
than enough to find a town. We cannot use longitude further than 99.99,
i.e. we won't cover the Far East region, but that's OK -- there's more than
enough good candidates even in the European part of the country only.

Feel free to extend.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 19:49:27 +04:00
Andrey Vagin
c05517b131 zdtm: fix test "fork"
* handle EINTR
* add more details in an error message

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 19:47:58 +04:00
Pavel Emelyanov
dcd64e9d10 zdtm: Test for UTS namespace
Plus a small infrastructure change to fork a test task
in a desired namespace.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 19:04:09 +04:00
Pavel Emelyanov
98f4c2e4de ns: Support UTS namespace
Only two fields are modifiable -- hostname and domainname. So
read them on dump and write on restore.

File format is simple --

u32 magic
u32 length of nodename
u8[] nodename string
u32 length of domainname
u8[] domainname string

For OpenVZ we can write the release at the end, but this is later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 16:54:22 +04:00
Pavel Emelyanov
3391416a1b crtools: Namespaces support skeleton
New option -n to dump/restore namespaces.

Fork the namespaces dumping task and write a helper for switching a namespace.

Prepare the restorer code for restoring namespaces before root task.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 16:54:22 +04:00
Pavel Emelyanov
b5e5aac9e9 restore: Switch task fork-ing into clone-ing
In order to restore task in namespaces we'll have to clone() them,
not fork. Thus switch the restorer into using clone.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 16:54:22 +04:00
Pavel Emelyanov
2e48f0528b crtools: Move options deeper into the code
I will need them in the place where we restore the root task.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 16:54:22 +04:00
Pavel Emelyanov
8e90a9e6d8 crtools: Tossing CR_FD_ bits around
Split the CR_FD_ bits into per-task and global ones and replace
of CR_FD_DESC_NOPSTREE with CR_FD_DESC_TASK, which is explicit
set of per-task bits.

The CR_FD_DESC_NS will appear soon.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 16:54:22 +04:00
Stanislav Kinsbursky
993f07ba71 zdtm: print full dump or restore path on error
Usefull for debugging.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
2012-01-26 14:55:27 +04:00
Stanislav Kinsbursky
01d13d9643 zdtm: patch for socket_listen test
Cleanup and simplifyng (as requested).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
2012-01-26 14:55:27 +04:00
Cyrill Gorcunov
d2f664b877 make: Eliminate deps build on no-deps targets in zdtm
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-25 19:14:39 +04:00