2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Commit Graph

1139 Commits

Author SHA1 Message Date
Andrey Vagin
bdb3932be5 pipe: all pipes are saved in one file (v2)
Information about pipe's file structs saved in one global file and
fdinfo_entry is saved for each descriptor

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 21:17:24 +04:00
Andrey Vagin
382ebc3063 pipe: remove old code for restoring pipes
[ xemul: I don't know how to make this with incremental changes either,
         and just go with it :( ]

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 21:17:11 +04:00
Andrey Vagin
a22ecfddf3 zdtm: add a new test case to check that all data can be restored
* create pipe
* write a maximum amount of data
* suspend/resume
* check that all data have been restored

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 20:53:27 +04:00
Andrey Vagin
2fef5cacb5 zdtm: write some data in pipe and read it after suspend/resume
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 20:53:12 +04:00
Pavel Emelyanov
6e562b0c9c files: Remove unused fn
It was used in old code, now it can be dropped

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 20:43:40 +04:00
Pavel Emelyanov
637a95f8d0 sockets: Check for unix being properly interconnected on dump
Add two checks -- that peer exists and it we will be able to
connect to him somehow on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 18:12:51 +04:00
Pavel Emelyanov
86489a545d sockets: Drop socket name for any bound-to-unlinked case
This maybe not 100% correct in the generic case, but the way unix sockets are
used lets us do this trick.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 17:39:33 +04:00
Pavel Emelyanov
8717463a15 zdtm: Add unix connected streams test
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 17:18:11 +04:00
Pavel Emelyanov
12316c4994 files: Ease the fd collecting
No need in separate per-type fn for doing this. We can just
find the respective fd list and do sorting in the generic code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:54:10 +04:00
Cyrill Gorcunov
9e3befe046 check: Add test for /proc/pid/stat extension
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:39:35 +04:00
Cyrill Gorcunov
aca2c976c0 proc: Add missing includes into proc_parse.h
Since proc_parse.h declares functions which have
list_head as arguments, it should include list.h
and basic types.

Otherwise if included into the files without list support
the compilation might fail as
 |
 | In file included from cr-check.c:5:
 | ./include/proc_parse.h:83: error: expected declaration specifiers or ‘...’ before ‘bool’

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:39:15 +04:00
Cyrill Gorcunov
88ca24bb38 check: Add fcntl stub
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:38:54 +04:00
Cyrill Gorcunov
92b26d8804 check: prctl -- Add PR_SET_MM_AUXV test
The ability to set PR_SET_MM_AUXV is implemented
in kernel as a separate PR_SET_MM extension, so
we need to test if the kernel patch is applied
on a running system.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:38:36 +04:00
Cyrill Gorcunov
b264c6e2ed check: prctl -- Add PR_SET_MM_AUXV test
Add basic test for prctl PR_SET_MM opcodes support.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 16:38:15 +04:00
Pavel Emelyanov
0612f49915 parasite: Don't lseek on image files
All these files are now properly prepared by the parasite
invocation code by using open_image calls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:46:05 +04:00
Pavel Emelyanov
4436f8afd8 rst: Don't seek core file for magic
This is done by open_image_ro in the restorer bootstrap preparation code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:44:44 +04:00
Pavel Emelyanov
056f41fb46 img: Remove unused open_image_ro_nocheck
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:43:50 +04:00
Pavel Emelyanov
c40e3201f2 rst: Open thread core images without -nocheck
These are image files that weren't yet opened, thus should be
opened with proper checks.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:42:48 +04:00
Cyrill Gorcunov
0cf8d1e158 check: Add kcmp test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:39:18 +04:00
Pavel Emelyanov
7570fbbf6a rst: Read pstree image once
Collect pstree_item-s on restore in big list. This lets
us not lseek this file on restore and simplifies the code
a little.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 15:34:31 +04:00
Pavel Emelyanov
a541fa8df3 rst: Remove unused pstree_pid
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 14:23:21 +04:00
Pavel Emelyanov
3b35d0531a rst: Use collected target vmas list in restorer_get_vma_hint
It uses the vma image right now, but the image is already sucked in.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 14:10:11 +04:00
Cyrill Gorcunov
d7961998bd lock: Restore ability to abort on futex waiting
In commit 71cc2733a7
I occasionally dropped the ability to abort on waiting
(because we used signed -1 value to inform waiters that
something is wrong and waiting should be aborted, but
the type was changed to unsigned one and as result
this condition never triggers).

So to resolve it futex_abort_and_wake() is added and
should be used explicitly where appropriate instead
if signess hack.

Reported-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 14:07:39 +04:00
Pavel Emelyanov
2a33c4d5dc mem: Remove zero page from the end of mem image files
This was required when pages were stored in elf files for
exec. Now we can stop reading it on eof.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 14:07:31 +04:00
Pavel Emelyanov
b4edfa7891 files: Dup local files on open, not receive
This will be needed for pipes, since we can't keep the pipe's
other end till that for dup.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 12:50:33 +04:00
Pavel Emelyanov
b9f13599a9 files: Simpler regfiles and sockets open
The list_head ptr passed into it can be converted into
the respective _info with container_of, rather than search.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 12:49:34 +04:00
Pavel Emelyanov
d1c9f0d71c files: Show collected regfiles fd tree
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 12:48:57 +04:00
Pavel Emelyanov
eee874e465 files: Rework the way fdinfos are collected
Now fdinfos are collected independently from reg files and
sockets. During tihs collect we effectively create the mirroring
list of both by checking which type-IDs are added first.

Fix this by removing the fdinfo_desc and attaching fds directly
to collected reg files and sockets. Pipes and unix sockets will
be reworked in the same manner soon.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-05 12:45:30 +04:00
Pavel Emelyanov
54c1979c84 unix: Collect unix sockets early on restore
Same as prev 2 patches now for the unix sockets. They are still in per-pid image files, but
this is going to change soon (I hope).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-03 00:58:41 +04:00
Pavel Emelyanov
94a11df0a1 inet: Collect inet sockets early on restore
Same as previous patch -- pull inet sockets in and store in the hash for the same reasons.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-03 00:54:52 +04:00
Pavel Emelyanov
84678526ac files: Read regfiles image in early on restore
Instread of re-reading this image again and again on every fd restore, pull the
reg-files.img in early and store the entries in a hash. This will simplify the
further fd restoring fixes and will allow for dump/restore via a stream (socket).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-03 00:50:50 +04:00
Cyrill Gorcunov
4131f47da7 make: Rebuild objects if headers are changed
At moment no-deps-targets is empty thus changes
in headers do not cause correspond source files
to be rebuilt. Fix it.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 23:01:20 +04:00
Cyrill Gorcunov
933606eec8 restorer: Cleanup - drop always_inline attribute from write_ helpers
This object file will be handled by ld script so .text
sections will be squashed into one common section.
Thus no need to force these functions being always-inlined.

It's a rudiment from time when we were not using ld at
all but #include source code file itself and now this
attribute might confuse code readers since it's
unclear _why_ it's needed at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:45:14 +04:00
Cyrill Gorcunov
e437e616af parasite, restorer: Cleanup ld scripts
There is no need for specific parasite or restorer
head sections, a general "head" one is enough.

Also .stack section is dropped since it's never used.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:43:22 +04:00
Cyrill Gorcunov
fca43c1abe sockets: Drop unused variables
Otherwise I get

 | sockets.c: In function ‘dump_socket’:
 | sockets.c:467: error: ‘st.st_ino’ may be used uninitialized in this function

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:42:01 +04:00
Cyrill Gorcunov
766bbf1631 sockets: Fix compilation on older kernel headers
Since kernel commit 9c501935a3 the sys/socket.h
should be included prior the linux/netlink.h.

Make it so.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:40:53 +04:00
Cyrill Gorcunov
c859dbcc29 parasite: Drop unused PARASITE_COMPLETE_ADDR helper
It has been used when debuggin without PTRACE_SEIZE,
not needed anymore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:40:08 +04:00
Cyrill Gorcunov
f964951a14 restorer: Fix bug in address computation of thread args area
It's wrong to treat restore_thread_exec_start as arguments
area (I managed to overlook this problem in commit
014841825a) it's rather
a function start address.

The thread arguments area allocated dynamically after the
restorer blob itself.

We didn't hit any problems earlier simply because there
were a few bytes owerwritten in function prologue.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:38:29 +04:00
Cyrill Gorcunov
e857977bb6 files: Add case::default in open_fd
Otherwise I'm getting error
 |
 | files.c: In function ‘prepare_fds’:
 | files.c:329:23: error: ‘tmp’ may be used uninitialized in this function [-Werror=uninitialized]
 | files.c:309:6: note: ‘tmp’ was declared here

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:36:38 +04:00
Cyrill Gorcunov
adc161a108 dump: Simplify cr_dump_tasks message printing
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 22:35:40 +04:00
Pavel Emelyanov
68a793a05c files: Users counter is not required on file desc
It's used only to check whether we should do file re-send and verify we've served
all the cliens. This can be replaced with proper list manipulations.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 21:58:34 +04:00
Pavel Emelyanov
89492de3ef files: Real pid on fdinfo_desc is unused
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-02 21:55:47 +04:00
Pavel Emelyanov
66771c8fbc sockets: Dump socket queus without parasite
Since now we have local copies of a remove FDs we can dump socket queus without entering
a parasite code. This makes the code MUCH simpler.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:44:15 +04:00
Pavel Emelyanov
3b0397dbae dump: Cleanup chrdevs dumping
We have two checks for fd being a chrdev:

One to skip stdio-s that are termilans and
The other one for any fd being a /dev/null or other special device.

Clean this a little bit.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:43:12 +04:00
Pavel Emelyanov
320f57b0e5 dump: Cleanup regfiles fd generation
Move the preID generation from dump_one_fdinfo to make it look cleaner.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:41:43 +04:00
Pavel Emelyanov
f4968e2d05 dump: Do not forget to close drained fds
A bugfix. Drained fds should be closed after we are done with them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:40:50 +04:00
Pavel Emelyanov
bac56b11c0 sockets: Remove statfs and 2nd stat from dump process
The statfs is not required, we now check for fd being a socket with S_IFSOCK.
The 2nd stat is just not needed, the caller provides stat info.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:40:10 +04:00
Pavel Emelyanov
250d0764d6 dump: Remove ID arg from dump_one_pipe
One can be read from fd_parms.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:38:59 +04:00
Pavel Emelyanov
64195c3458 dump: Move stat on fd_parms
This structure is actualy an fd parameter, so put it there. This will also
help with future patching.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:38:30 +04:00
Pavel Emelyanov
8ecb454bf7 dump: Rename try_dump_socket
Try meant that it might not be a socket, but with local fds we do know
it for sure.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 16:37:49 +04:00