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

1528 Commits

Author SHA1 Message Date
Pavel Emelyanov
50ff1438b0 anon: Factor out checking for anon inode link types
Funny, but kernel reports some of them with []-s and some (well,
ok, inotofy only) without...

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:22:18 +04:00
Cyrill Gorcunov
6cebc48420 zdtm: Add inotify00 test case
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:01:05 +04:00
Cyrill Gorcunov
bff52ba952 inotify: Add checkpoint/restore v2
v2:
 - open_mount is cleaned up
 - byte-stream hex conversion remains untouched since
   strtol is flipping numbers to LE manner

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:45 +04:00
Cyrill Gorcunov
ed59bf001b Add mount.c file for mount helpers functions
At moment only open_mnt_root is there, which is
needed for inotify restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:36 +04:00
Cyrill Gorcunov
9ea069d2c9 proc: Add parse_mountinfo helper
To restore inotify we need to know the
mount point device numbers, so this helper
parses /proc/pid/mountinfo file for that.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:28 +04:00
Cyrill Gorcunov
3399650a9c syscall: Add sys_open_by_handle_at
Need it for inotify restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:20 +04:00
Cyrill Gorcunov
5028f71c66 zdtm: Extend eventfs test for epolls
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:13 +04:00
Cyrill Gorcunov
b38777dff4 eventpoll: Add checkpoint/restore v2
v2:
 - Move everything into eventpoll.[ch]
 - Use rst_file_params

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:05 +04:00
Cyrill Gorcunov
580d3b0261 zdtm: Add eventfs00 test-case
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 13:59:58 +04:00
Cyrill Gorcunov
889795da5d eventfd: Add checkpoint/restore support v2
v2:
 - Pass initial counter value to eventfd call
   (can't pass flags here since they are obtained
    with fcntl and must be restored same way or
    restore will fail)
 - Use rst_file_params for flags and owner restore
 - Use eventfd.[ch] instead of eventfs.[ch]
 - Move show funcs to eventfd.c

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 13:59:51 +04:00
Cyrill Gorcunov
49166b206b util: Add is_anon_inode helper
Will need it for eventpoll/eventfd/inotify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 13:59:43 +04:00
Pavel Emelyanov
26a53837f9 shmem: Move shmem dumping code to shmem.c
This is also a code move plus two changes:

* shmems renamed to dump_shmems
* shmem area size is shared with restorer (it's one page for both for now)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 18:07:01 +04:00
Pavel Emelyanov
bc75b0f253 shmem: Move shmem restoring code to shmem.c
No changes, just code move (and rename of shmems variable).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 18:01:05 +04:00
Pavel Emelyanov
fa8a928e9f pipes: Move dumping code to pipes.c
Just a codemove, no real changed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 17:36:00 +04:00
Cyrill Gorcunov
3dc0088be3 sockets: Print ino's with %x format in collect_unix_sockets
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 16:25:46 +04:00
Cyrill Gorcunov
635a1247fc sockets: Print peer number in show_one_unix, show_one_unix_img
Also convert all ino into %x format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 16:24:34 +04:00
Cyrill Gorcunov
05421b2c5a docs: Add -s option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 16:21:15 +04:00
Pavel Emelyanov
52242be32c dump: Stop using mincore and switch to /proc/pid/pagemap
We use mincore to check which pages we should take with us into
the image. The anonymour present or swapped should go, file present
but not cow-ed should not.

The mincore syscall wasn't very helpful with this -- it didn't detect
swap, but did detect some non present pages (pagecache). Plus it
didn't know anything about cow-ing filemaps.

Andrey Morton suggested to use the pagemap file in proc, but it lacked
the importaint stuff -- the cow filemap bit. Now it's there and we
can switch to using it.

The mincore usage for shared memory is still there, as for _that_ case
it's correct.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 16:10:04 +04:00
Pavel Emelyanov
cee5e8179a dump: Collect more stats about pages being dumped
Dumped pages are those taken to the image
Skipped pages are those, sitting in RAM, but left there (file shared pages)
Total is the total amount of pages that fit into vmarea

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 15:37:58 +04:00
Pavel Emelyanov
4ec76b285f tcp: Add code for "check"-ing TCP repair support
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 15:21:37 +04:00
Pavel Emelyanov
1dc8527dea help: Reformat the help text
* Split dump/restore options from show ones
* Structure the former list
* Add the --tcp-established one

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-29 09:23:12 +04:00
Pavel Emelyanov
6b2a0205c7 tcp: Fix queue contents restore
The wrong descriptor was passed to the read_img_buf.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-29 09:08:11 +04:00
Pavel Emelyanov
08788c835d tcp: Show queue contents when -c is given
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-29 09:06:03 +04:00
Pavel Emelyanov
ef2bd77ebd show: Beautify output of the -c data dump
Calculate the best width for address and print them all with it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-29 09:05:21 +04:00
Andrey Vagin
f3e8977c73 proc: add a static buffer to prevent segv (v3)
A few of our functions use buffer and string functions.
All these functions require that a string contains '\0' at the end.
Before this patch we didn't guarantee that.

I've seen segmentation fault in parse_pid_stat_small.

v2: simplify code
v3: remove assignment, because it's redundant and a size of object file
become bigger.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 13:09:20 +04:00
Cyrill Gorcunov
4f31e13c92 test, app-emu: Add HelloWorld java test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 13:06:56 +04:00
Pavel Emelyanov
4debf589f6 tcp: Automate TCP stream c/r
This test is very basic :( Need more work on it.
One note about --close arg to crtools -- bash leaves all
fds open when laucnhing progams, and for restore this is
critical, as one of them can be busy. Iterating over all
the possibel fds and closing them is "do not want" thing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 20:37:54 +04:00
Pavel Emelyanov
b2fced0601 tcp: Basic test of tcp conn
Only manual mode at the moment. Need to automate it later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
f9a8673d52 tcp: Dump and restore support
What it does is uses the tcp repair engine from the kernel.

On dump the connection is locked with netfilter, socket is put
in the repair state and then its internals are dumped.

On restore we create a socket, put it into repair, dress it up
and then unlock all the connections at the very end.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
675b4698ce tcp: Put connection locking management over the code
When dump finished with error we should unlock all locked
previously connections.

When restoring we should collect connctions and unlock them
all at the end.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
a53aa45be0 tcp: Initial image description
Introduce the image file for tcp info, its entry and the show method.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
64c64e4f2c net: Add code for locking a tcp connection with netfilter
Between dump and restore of a tcp conn we have to keep the connection
blocked, since the socket doesn't exists in the kernel at this time
and any packet from peer will result in RST. Thus, add the -j DROP rule
for every connection we're about to repair.

Later, when we support containers, this will be extended to stop the
whole networking in a CT instead of cherry-peeking connections.

It does system("iptables ...") for this, but I'd prefer using the
libnetfilter-devel sometime in the future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
051b0a1f02 tcp: Prepare sk-inet for dumping and restoring tcp connections
First of all -- to make crtools dump/restore established tcp sockets
you have to specify the --tcp-established options. By doing so you
inform crtools that

a) you know, that after dump there will be a netfilter rules blocking
   the dumped connections

b) you guarantee, that before restore this netfilter block is still
   there

What else this patch does is simple -- collects establised sockets and
calls the dump/restore tcp function (now empty) where appropriate.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:21 +04:00
Pavel Emelyanov
a915a4622d inet: Move inet sk cpt and rst structs to header
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:20 +04:00
Pavel Emelyanov
65e48c41b1 inet: Introduce helpers for binding and connecting inet socket on restore
Just a codemove.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:20 +04:00
Pavel Emelyanov
92a088a04c files: Restore fdflags on proper fd
After reopen_fd_as the original fd is closed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 17:59:20 +04:00
Pavel Emelyanov
2d636abe9a gitignore: Add syscall generated files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-28 16:35:40 +04:00
Pavel Emelyanov
52cb8d43b9 sk: Move unix socket code to separate file
Funny, but after this git thinks, that I've renamed the sockets.c
file into sk-unix.c one and fixed it a little bit %)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:39 +04:00
Pavel Emelyanov
709bbc7f41 sk: Opencode sk_hash_lookup fns
For simpler unix socket code move.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:36 +04:00
Pavel Emelyanov
be6630bf27 sk: Opencode sk_hash_link
For simpler unix socket code move.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:35 +04:00
Pavel Emelyanov
518361dcaa sk: Move inet socket code to separate file
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:31 +04:00
Pavel Emelyanov
8cd64c5ae7 unix: Cleanup ext socket check
Rename the fn and fix indentation.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:30 +04:00
Pavel Emelyanov
fbcb43bd4b unix: Fix external socket dumping
Collect all unix sockets in a list while dumping to check
whether we've missed something early (at the restore time
it can be already late for roll-back).

Plus, fix the checks for external stream sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:28 +04:00
Pavel Emelyanov
3b0a8e7c81 file: Factor out fowners and flags restore
This is common, that opened fd fix its fowner and flags. Make
a cuntion for this. Those that obtain fd with open() don't need
to restore flags though.

A thought -- do we need yet another abstraction between fdinfo and
type-d files?

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:26 +04:00
Pavel Emelyanov
1f94837afb sk: Sanitize socket's fowner and flags restore
The conn job misses fowner restoratio. Other places are ok, but toss
the code for easier next patching.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:25 +04:00
Cyrill Gorcunov
bd6e8df419 restorer: Drop setup_mm_special
The kernel patch titled

	c/r: prctl: Simplify PR_SET_MM on mm::code/data assignment

(which now in linux-next) allows us to setup code/data addresses
without requirement of underlied VMA. So revert commit
090513d5fd95c4a4169be36847a45a1476106849 and make code
more simplier

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 00:56:00 +04:00
Cyrill Gorcunov
06986dfe50 proc: Fix parsing of stack string
Kernel 3.4-rc4 has two formats for stack
"[stack]" and "[stack:%d]" (for threads)
so adopt our parsing routine for both.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 00:55:20 +04:00
Cyrill Gorcunov
6670d294fb prctl: Update PR_GET_TID_ADDR definition
To reflect the change in kernel v3.4-rc4
update PR_GET_TID_ADDR and rename it to
PR_GET_TID_ADDRESS as it named in kernel.

[xemul: this fixes futex test broken with 3.4 rebase]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 00:54:48 +04:00
Pavel Emelyanov
9a2d2a6990 fown: Fix compilation for older distros
Some of them (FC12 I debug on) doesn't have fown_ex stuff in their
libc. Add the missing declarations.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-25 21:36:43 +04:00
Pavel Emelyanov
59a2f13e7e Helper for si_code event extraction.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-25 21:35:40 +04:00