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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- @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>
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>
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>
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>
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>
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>
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>
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>
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>
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>