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

976 Commits

Author SHA1 Message Date
Pavel Emelyanov
471d3c429c restore: Cleanup mem variables usage
Just prepare the code for smoother further bootstrap areas allocation.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 21:31:35 +04:00
Pavel Emelyanov
fc225709b0 proc: Make parse_maps return the amount of them found
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 21:31:35 +04:00
Pavel Emelyanov
e94c85fe6e restorer: Fix bootstrap allocation
There are three bugs in this code.

1. self vmas list is released before get-hint is called
2. get-hint code wrongly detects the hole (just bugs, no details)
3. exec hint is mapped without MAP_FIXED, but should

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 21:31:35 +04:00
Pavel Emelyanov
b107d838cf zdtm: Remove socket_loop00 test
It's broken. Stas will fix it soon.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:43 +04:00
Pavel Emelyanov
1c12a31893 udp: Restore UDP sockets
Reuse the TCP socket restore, just add connect() and sanity checks
for protocol.

This is OK, since UDP connect doesn't go to network for connection
and (unlike unix sockets) doesn't require peer to be "online". It
just puts the peer's creds on socket and returns.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
bad126e7a5 sock: Add dst creds to socket structs
These are required for inet sockets, but were not added since listen
sockets do not have them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
ba562bc272 show: Fix inet sockets show "loglevel"
Showers should use pr_msg to avoid loglevel issues.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
b198d76e40 udp: Allow dumping udp sockets
Just a small fixlet in can_dump_inet_sk.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
625c45ea79 udp: Collect socket with diag
Partially reuse the existing TCP code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
1ff1a46a6e zdtm: Test for udp sockets
Create two of them, bind both and connect one end to the other.
Then check that send and sendto work and recv(from) receive proper
message from proper address.

Queues are expected to be dropped while test according to protocol
constraints, thus all sends happen after restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
1bf89633ff zdtm: Raize loglevel to maximum
Otherwise logs look poor on failures.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Pavel Emelyanov
ba64f87bfa log: Fix logfd screwup
Broken by 7aa8e4b6 -- log was not moved to higher fd values.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 15:54:42 +04:00
Cyrill Gorcunov
119cee0d16 docs: Add 'check' option description
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 14:23:45 +04:00
Kir Kolyshkin
f6cf7fd4af Makefile: rm RDEPS-BLOB var
It was never needed in the first place, and not used after commit e315bea3.

Reported-by: Stanislav Kinsburgsky <skinsbursky@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 14:16:12 +04:00
Pavel Emelyanov
e6c88abd62 check: Add some basic checks
* /proc/<pid>/map_files
* sock diag
* ns_last_pid sysctl
* SO_PEEK_OFF sockoptions

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 14:15:28 +04:00
Pavel Emelyanov
c39e759048 check: Initial skeleton
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 14:15:09 +04:00
Kir Kolyshkin
ce7780179b gen-offsets.sh: error out if something goes wrong
In addition, add target rm if script has failed.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:17 +04:00
Kir Kolyshkin
944ebac41d Makefile: *-BLOB-GEN: use target name
No need to hardcode it.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:17 +04:00
Kir Kolyshkin
f7fd268a33 gen-offsets.h: move arguments from Makefile to the script
Makes invocation way easier.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:17 +04:00
Kir Kolyshkin
4bb4bfdac1 Makefile: introduce, depend on and use GEN_OFFSETS
1. We need to regenerate *-blob.h files if generating script changes

2. Do not use hardcoded script name

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:16 +04:00
Kir Kolyshkin
e315bea38a Makefile: remove an unneeded dependency
There is no need to make .d files for restorer-blob.h

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:16 +04:00
Kir Kolyshkin
fd9102a9ae gen-offsets.h: refactor
These changes are mostly for better readability and style.
The only actual difference (in the output produced) is the last item.

(1) Use UPPERCASE variable names

(2) Simplify names (get rid of name_ prefix for everything)

(3) Rename variables:
- name_ifndef to INC_GUARD,
- name_prefix_offset to PREFIX,
- name_bin to BINARY.

(4) Replace sed with tr for simplicity

(5) Replace grep with awk condition

(6) Don't escape every $ and " inside AWK_CMD, just quote the full string

(7) Use cat and 'here document' instead of many echoes

(8) Simplify hexdump arguments, use single -e option

(9) Insert our name into 'Generated by' comment.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 12:12:16 +04:00
Cyrill Gorcunov
8a8ce9b342 show: Don't forget to open sockets queue descriptor before accessing it
Otherwise I'm getting errors like

CR_FD_SK_QUEUES
----------------
Error (./include/util.h:102): Can't read img file: Bad file descriptor
----------------

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:58:55 +04:00
Kinsbursky Stanislav
a26d524011 dump: rename st_buf to fd_stat
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:25:46 +04:00
Kinsbursky Stanislav
698fe036d0 dump: hide check for fifo
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:25:46 +04:00
Kinsbursky Stanislav
ba6ac0104e dump: remove else
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:25:46 +04:00
Kinsbursky Stanislav
81060211c5 dump: hide fd type into fd_params structure
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:25:46 +04:00
Kinsbursky Stanislav
42963b9450 dump: hide fd open in dump routine
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-02 11:25:46 +04:00
Cyrill Gorcunov
827cabb480 show: Use pr_msg for showing contents on console
Due to code sharing, especially in IPC area,
the unbinding is done via helper macros and
sysclt engine tuning (new CTL_SHOW action
added).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-02 11:12:59 +04:00
Cyrill Gorcunov
7aa8e4b6e2 log: log-engine slight redesign
The messages are filtered by their type

    LOG_MSG     - plain messages, they escape any (!) log level
                  filtration and go to stdout
    LOG_ERROR   - error messages
    LOG_WARN    - warning messages
    LOG_INFO    - informative messages
    LOG_DEBUG   - debug messages

By default the LOG_WARN log level is used, thus LOG_INFO
and LOG_DEBUG messages will not appear in output stream.

pr_panic helper was replaced with pr_err, pr_warning
shorthanded to pr_warn and old printk if rather pr_msg
now.

Because we share messages between "show" and "dump" actions,
before the "show" action proceed we need to tune up
log level and set it to LOG_INFO.

Also note that printing of VMA and siginfo now
became LOG_INFO messages, it was not that correct
to print them regardless the log level.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-02 01:05:43 +04:00
Cyrill Gorcunov
9aa2252ca0 log: Fix typo in in fini_log
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-02 01:05:43 +04:00
Cyrill Gorcunov
95f770b61c logfd: Distinguish functions which do setup logdf
We have a few helper functions which all do setup
logfd but in different program flow context. So
rename them for grepability.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-02 01:05:43 +04:00
Pavel Emelyanov
cb0eb0b31e dump: Let task handle signals on seize
When seizing a task and waiting for it to stop, we can receive an event
from kernel, that the task didn't stop, but caught a signal. Don't treat
this as an error, let the victim handle it and proceed.

The transition/fork test should work OK now.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 20:36:36 +04:00
Pavel Emelyanov
1e98f53cca dump: Stop scanning at once if list is empty
Empty list on scan error means, that the very top task ran away from
us. There's no point in trying to catch one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:21 +04:00
Pavel Emelyanov
ae9f1bfdc4 dump: Restart seize in case reparent occurred
This can happen while dumping a pid-namespace (we can't do it now), thus
put this check not to forget one in the future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:21 +04:00
Pavel Emelyanov
a1fe2c58a9 dump: Try to seize task tree several times on error
Tasks can fork or die while we try to seize them. It's much more simpler
and much more reliably to unseize what was seized and walk the tree again
in case of some tree check failed.

Yes, this makes it impossible to suspend a big tree which constantly forks :(
but I'd prefer fixing more urgent issues before.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:21 +04:00
Pavel Emelyanov
9e0b308af0 dump/restore: Rework final-state switch
Remove CR_TASK_XXX states, use the TASK_XXX ones (for image). This is
required to unseize tasks properly in the next patches.

Plus, make sure that pstree_list and the seized set coincide (i.e.
handle error in collect_task).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
0afad031d5 dump: Check for process/threads tree not to change after seizeing
When we've seized all the tasks and threads found in /proc check for
the /proc contents be the same. Do it one-by-one as we descend the tree.
This is OK, since tasks cannot create kids for anyone but themselves or
their parents (reparent will be handled later).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
30a2b6f314 dump: Don't pass pid to children parser routine
It's in item already.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
199e8d8248 dump: Check for pids reuse at suspend
While we try to seize task it can die and give its pid to
somebody else. This can break pstree consistency. Check for
parent being valid after task is seized.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
f8a18edd44 dump: Remove SHOULD_BE_DEAD task state
Move proc checks for Z-state into seize_task().

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
3f256945f2 dump: Sanitize threads dumping
Merge two calls into one helper. For future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Pavel Emelyanov
3ab9285f0f parasite: Check for unexpected signals delivery
Signals shouldn't come to parasite after we've blocked them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 19:31:20 +04:00
Kinsbursky Stanislav
64bf2b7d4b dump: fix check for service dentries
Without the patch all files starting with "." will be ommited.
Use of strcmp() - explicit check for "." and ".." looks clearer.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-03-01 13:01:08 +04:00
Cyrill Gorcunov
29a7a81d25 dump: Clenaup recently added file-ids code
- drop double file-ids.h inclusion
 - rename fd_id_entry to plain entry, it's
   used just in a couple of lines only, no
   need for complex name

Reported-by: Kir Kolyshkin <kir@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 19:22:35 +04:00
Kinsbursky Stanislav
a66eab4ecf parasite: make it 5 lines shorter
Small cleanup patch

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 17:43:20 +04:00
Kinsbursky Stanislav
dc243ccb4b zdtm: add streaming/socket_loop00 to tests list.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 17:42:31 +04:00
Kinsbursky Stanislav
66ec37bd2e zdtm: add static/socket_queues tests to zdtm list
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 17:42:31 +04:00
Kinsbursky Stanislav
46535130c6 restore: UNIX sockets queue support
Based on xemul@ patches.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 17:42:30 +04:00
Kinsbursky Stanislav
e518c44c7c show: UNIX sockets queue support
Based on xemul@ patches.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-29 17:42:30 +04:00