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

2042 Commits

Author SHA1 Message Date
Pavel Emelyanov
aa731ee1d7 core: Support task scheduler policies and priorities
No magic here, just fetch info using getpriority and sched_getxxx calls.
Good news is that the mentioned syscalls take pid as argument and do work
with it, i.e. -- no need in parasite help here.

Restore is splitted into prep -- copy sched bits from image on restorer
args -- and the restore itself. It's done to avoid restoring tasks info
with IDLE priority ;) To make restorer not-fail sched bits are validated
for sanity on prep stage.

Minimal sanity test is also there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-17 00:23:25 +04:00
Pavel Emelyanov
33c0add242 tty: Sanitize tty parasite-side dumping
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:55:34 +04:00
Cyrill Gorcunov
9fb384f926 tty: Make tty_get_sid_pgrp() to use parasite code
We need to use namespace local sid/pgid parameters
assigned on tty link, thus use parasite helper.

Otherwise we might fail on restoring controlling
terminal inside namespace (though everything else
will work even without this patch).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:54 +04:00
Cyrill Gorcunov
9ee6f87711 parasite: Make parasite_args helper global
Will need it in tty layer.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:53 +04:00
Cyrill Gorcunov
848215b6f1 tty: Drop sid/pgid test from verify_info
Since we've started fetching sid/pgid from the
dumpee context we're allowed to obtain sid/pgid
on a slave peer. This is perfectly valid. So
drop this test.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:52 +04:00
Cyrill Gorcunov
2b816a593a dump: Make struct fd_parms to carry @parasite_ctl pointer
Some file-type specific parameters can be fetched with
parasite code only, so lets carry parasite control block
pointer in struct fd_parms.

This is a bit ugly but requires less code to touch and
enough for now. In long terms we need some more generalized
routine/hooks which would depends on file type.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:50 +04:00
Cyrill Gorcunov
a9241a23f7 parasite: Add parasite_dump_tty helper
Will need it to fetch tty link parameters. This is
because the kernel provides SID/PGID related to the
caller context, and if we're dumping the process inside
namespace -- we need local SID/PGIDs, not global ones.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:49 +04:00
Cyrill Gorcunov
f96f580569 syscalls: Add sys_ioctl
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 23:42:48 +04:00
Cyrill Gorcunov
1686669410 tty: Make tty_setup_slavery to return error
In case if here no task found which would restore
controlling terminal -- exit with error instead of
continue with just error message.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 20:02:29 +04:00
Pavel Emelyanov
293eca3127 sk: Support SO_NO_CHECK option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 15:45:57 +04:00
Pavel Emelyanov
9988c38daa protobuf: Fix show of nested messages in pretty format
Currently the pretty format leaks to the nested messages and
affects the way they are shown. Fix this by assuming the nested
messages to be non-pretty.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 20:48:32 +04:00
Pavel Emelyanov
ed745fa9cf sk: Support SO_DONTROUTE option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 20:32:06 +04:00
Pavel Emelyanov
5e1a9f840c sk: Support SO_PASSSEC and SO_PASSCRED options
There's some bug in show fn for options :( Will be fixed later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 14:01:18 +04:00
Pavel Emelyanov
b53d6d90b7 sk: Support SO_MARK socket option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 13:48:18 +04:00
Pavel Emelyanov
0a9ef15e64 sk: Remove dead code
After reworking sk showing on generic pb showers this one
is not required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 13:44:47 +04:00
Cyrill Gorcunov
aead1e26d6 parasite: Simplify parasite command copying
No need for memcpy here, it's plain integer value
which need to be filled.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 13:40:30 +04:00
Pavel Emelyanov
9929d2efdf sock: Handle rcvlowat and priority options
And write a test for them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 22:02:25 +04:00
Stanislav Kinsbursky
74ee5df924 zdtm: POSIX timers migration test
This test set up two posix timers with different clocks: REALTIME and
MONOTONIC.
Both send signals.
Signals are disabled before suspend. This makes overrun counters increasing.
After restore tests enables signals, and make sure, that:
1) signal handler for both timers was called with proper arguments
2) time displacement for both timers is not greater than specified (10% by
default).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Vladimir Davydov <VDavydov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:13:30 +04:00
Andrey Vagin
208292fd21 zdtm: add a smoke test for cow memory (v2)
A test allocates and filles one page, creates a new child, then
compares pfn-s for both processes.

v2: set a position on each iteration

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:12:17 +04:00
Pavel Emelyanov
23cd070339 zdtp: Test that supplementary groups are supported
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:07:05 +04:00
Pavel Emelyanov
f429de662e creds: Support supplementary groups
Dumping them is performed via parasite, since calling the getgroups
is the only way of getting the complete list. Currently the nr of
groups to dump is limited explicitly with the size of shared memory
between crtools and parasite. This is MUCH more that we have seen
on real apps so far.

Restoring is done early, before restorer blob not to carry the undefined
array of grpous in there. This is OK, since groups do not affect us at
that point and are not affected by subsequent creds restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:07:02 +04:00
Pavel Emelyanov
013d26bdd8 syscalls: Add getgroups syscall
Getting groups can be done vie proc, but there's only 32 on them,
while task may have up to 65k :( We will use parasite for that and
thus require this syscall definition.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:07:01 +04:00
Pavel Emelyanov
699a33e1b9 creds: Dump creds with the help of parasite
Currently move there the secbits dumping, which is not dumped
via misc-dumping command. This patch is required to support
per-task groups dumping (setgroups/getgroups) -- we'll have to
drain the groups from parasite.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:06:58 +04:00
Pavel Emelyanov
7db199c783 parasite: Remove double args copy
There's a shared memory between crtools and parasite. No need in copying
args back and forth, just get the args pointer in crtools and work on it.
Where not possible (misc, fds drain) do explicit memecpy (to be fixed).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 17:05:25 +04:00
Andrey Vagin
7c8496f5b0 pipe00: replace polling on waiting
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-10 17:31:19 +04:00
Cyrill Gorcunov
062f468817 pstree: Define symbolic name for init process
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-09 19:57:15 +04:00
Pavel Emelyanov
e2912397b5 log: Set log level in parasite
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-08 19:56:12 +04:00
Cyrill Gorcunov
3ef0d9735b dump: No need to init root_item->sibling
It's already done in alloc_pstree_item() by
recently merged commit.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-08 19:00:11 +04:00
Cyrill Gorcunov
e0be540401 pstree: Move struct pid to pstree.h
I believe this make sense to keep this structure
in pstree.h where pstree related data lives.

Also I've added some comments on struct pid members.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-08 18:59:36 +04:00
Cyrill Gorcunov
17a1548a5b pstree: Rename @list member to @sibling
To be close to the kernel naming.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-08 18:59:26 +04:00
Cyrill Gorcunov
9c60b1f4ad pstree: pstree_item members tuning up
- @list member closer to @children
 - add some comments on memebers
 - add space lines for members grouping

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-08 18:59:12 +04:00
Pavel Emelyanov
df83b2c2fb parasite: Use simple logging engine
Just as for restorer, but simper, as the parasite logging
is just sys_write_msg :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-07 21:12:40 +04:00
Pavel Emelyanov
ddf68b7940 restorer: Use the simple logging engine
Remove the restorer-log and link log-simple into restorer
blob. Now we can use the normal pr_foo API.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-07 21:11:49 +04:00
Pavel Emelyanov
b85bf75cf0 log: Introduce a simple printf-like logging engine
It's supposed to be used by parasite and restorer blob. It
has API equal to the core one -- with setfd, set_loglevel and
(the main thing) print_on_level fn. It currently supports only
strings, decimal and hex numbers (int and long).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-07 21:06:46 +04:00
Pavel Emelyanov
37a7b35e88 log: Move default loglevel macro to header
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-07 21:03:53 +04:00
Pavel Emelyanov
9a54d64539 log: Merge two loglevel checks
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 20:55:23 +04:00
Cyrill Gorcunov
2b56175e49 log: Don't print time-stamp on LOG_MSG
Otherwise "show" action become unreadable.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 19:22:23 +04:00
Cyrill Gorcunov
16ca152d23 pstree: Add few comments in prepare_pstree_ids
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 17:29:26 +04:00
Cyrill Gorcunov
f318f40415 pstree: Drop redundant nil test in prepare_pstree
This as well releases pb entry on error path, not
a big deal since we're exiting in case of error
but still.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 17:29:04 +04:00
Cyrill Gorcunov
d82b853dc8 pstree: Init pstree_item::list inside __alloc_pstree_item
This is a bit fishy that we do init @children list here
but not @list itself. Better be solid and init everything
in one place.

Also no need to poke @threads and @nr_threads, we're using
xzalloc here anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 17:25:09 +04:00
Cyrill Gorcunov
9c263a6c8c pstree: Simplify pstree_item_next
It's a deep first search used here so the code can be shrinked.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 17:23:41 +04:00
Cyrill Gorcunov
59e80d4f48 pstree: Fix typo in prepare_pstree_ids message
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 17:21:54 +04:00
Stanislav Kinsbursky
3583578d7c protobuf: fixed typo in pb_write_one
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 16:04:48 +04:00
Pavel Emelyanov
87cf4ad128 log: Add relative timestamp before each log line
I find this handy.

Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 02:18:01 +04:00
Andrey Vagin
30f0acb43e parasite: fix size of cmd
cmd is declarated in parasite-head-x86-64.S
__export_parasite_cmd:
        .long 0

Its size is 4 bytes, so it should be int instead of long.

This patch fixes a bug in parasite execute,
where a part of args are overwritten by cmd.

memcpy(ctl->addr_cmd, &cmd, sizeof(cmd));

Reported-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-03 00:44:35 +04:00
Cyrill Gorcunov
79d00c29c0 zdtm: Don't forget to create /dev/ptmx in new root
Otherwise pty tests might fault.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 23:08:02 +04:00
Pavel Emelyanov
c6e0a402bc dump: Fix up error path of pages dump
Call the fini stage even if the dump failed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-29 08:28:53 +04:00
Pavel Emelyanov
fab5f12fcc dump: Open pagemap only once
When dumping pages we use 3 commands for parasite -- prep,
dump (per-vma) and fini. Open the pagemap file in prep,
insteam of in each per-vma dump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-29 08:23:55 +04:00
Cyrill Gorcunov
6a5ac97186 tty: Fix copying of termios character map
The system termios structure and our PB
equivalent defined quite different, while
first defined as plain array we use dynamically
allocated memory. Thus the use of min() macro
is incorrect here and always produce the size of
pointer.

Fix it using the size of array from the system
provided structure. The BUILD_BUG_ON will prevent
from accidental changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 20:26:11 +04:00
Cyrill Gorcunov
8a4ec72b2f zdtm: Move pty tests back to ns compatible list
Test pty03 is not yet ready for ns, will be addressed later.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 19:22:03 +04:00