2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

2322 Commits

Author SHA1 Message Date
Cyrill Gorcunov
9f90f2e5c6 zdtm: Add maps02 test-case
To test new bits we fetch from VmFlags smaps interface.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:16:07 +04:00
Cyrill Gorcunov
183eaab899 restore: Do madvise() on VMAs where provided
If we're provided with madivce() bits -- do
restore hits on VMA areas.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:16:06 +04:00
Cyrill Gorcunov
cc6af3898e memory: Add pasing of VmFlags
The kernel now supports providing VMA flags via smaps
interface so add pasting of them.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:16:05 +04:00
Cyrill Gorcunov
a343afad34 syscalls: Add sys_madvise
Will need it for VMA restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:16:04 +04:00
Cyrill Gorcunov
fc6e73964a types: Add a few MADV_ definition
On my testing machine these defs are not present
so define them where needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:16:02 +04:00
Huang Qiang
6d97c09772 ipc_ns: close file immediately when we don't need it
According to Andrew's advice, change the close file logic a bit, to
make the code seems more readable.

Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-26 00:08:47 +04:00
Pavel Emelyanov
7d8ad0bc47 unix: Lost master socket opts restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 22:12:57 +04:00
Pavel Emelyanov
080282df7c unix: Simplify unix post-open callback
The fd we want to work on is the 2nd argument, no need
in calculating it out of file_desc.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 22:08:46 +04:00
Andrey Vagin
2f5d7098b8 zdtm: don't worry if a storage device ID is changed on NFS
Kinsbursky Stas added a comment - 24/Oct/12 4:24 PM
st_dev won't be the same. It's generated on each NFS superblock creation.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 19:12:44 +04:00
Pavel Emelyanov
93d41b1a83 inet: Disable dumping of shutdown sockets
This requires more work than for unix sockets. For now
report that we cannot do it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 18:39:54 +04:00
Pavel Emelyanov
48042e65da zdtm: Test for shutdown unix sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 18:39:54 +04:00
Pavel Emelyanov
8471081244 unix: Add support for shutdown sockets
Get the info from kernel diag message (it should always be there)
and restore the shutdown at the very end.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 18:39:54 +04:00
Huang Qiang
223dce83c2 fix many unclosed file opened by open_image_ro
Many image files opened by open_image_ro weren't closed before return, fix
them all in this patch.

Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 16:51:50 +04:00
Andrew Vagin
cf698a9a48 zdtm: split sched_prio00 on two parts
sched_prio00 tests only priorities and sched_policy00
tests scheduling policy.

scheduling policy can not be changed in OpenVZ containers.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 15:52:53 +04:00
Andrew Vagin
da8799199e zdtm: workaround compiling errors on ubuntu 10.4
getsid is required _XOPEN_SOURCE_EXTENDED,
it's enabled if __GNU_SOURCE is defined.

session00.c:92: error: implicit declaration of function 'getsid'

Signed-off-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 15:52:30 +04:00
Cyrill Gorcunov
cdecc9d012 zdtm: Drop memory barrier from file_fown
It's a rudiment which not parsed well by all
gcc versions.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 15:52:02 +04:00
Cyrill Gorcunov
1945a83b0c tty: More detailed printing on unpaired slaves
In case of errors it provides us more information about what is going on.

For example, in my test case I now can see where the error came from

 | (00.027248) tty: Unpaired slave 0
 | (00.027261) tty: Unpaired slave 2
 | (00.027273) Error (tty.c:174): tty: Only one slave external peer is allowed (index 2)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-22 15:48:42 +04:00
Pavel Emelyanov
22a1377868 zdtm: Test that sockets bound to device work
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-19 17:37:48 +04:00
Pavel Emelyanov
b42f8fa1ac sk: Support SO_BINDTODEVICE option
The kernel SO_BINDTODEVICE option is not symmetrical --
set required device name, but get reports index. Thus
need the index to name resolver.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-19 17:36:44 +04:00
Pavel Emelyanov
ef3771d566 net: Introduce netdev index to name resolver
It will be required to support socket bound to devices.

When restoring w/o net namespaces -- collect existing devices.
When restoring with them -- collect what is received from image.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-19 17:35:46 +04:00
Pavel Emelyanov
f1fb3c740e net: Split dump_links into part
We'll need to dump links for another purpose, so prepare the
generic rtnl talker for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-19 17:34:47 +04:00
Cyrill Gorcunov
2f3e52d83f docs: Update documentation
- Drop -c option from "dump" context,
   it is no longer valid

 - Add --link-remap, --shell-job options

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 19:47:17 +04:00
Cyrill Gorcunov
8f81f589ae tty, restore: Migrate tty slave peer connection if --shell-job passed
In case if we've dumped a slave peer only (say a user dumped `top'
application) we should migrate it on current active terminal, which
barely an own standart stream prepared for us by the file engine.

Note only one external slave peer is allowed simply because
otherwise we can't distinguish which indices should be used
for each of them.

The patch basically does the following things

 - Check if the SID present on peer exist in current
   process tree, we need to be sure that we can restore
   peer parameters and controlling terminal if present

 - Rename pty_open_fake_ptmx to pty_open_unpaired_slave
   because we might be inheriting SELF_STDIN_OFF instead
   of opening fake master peer

 - Do inherit SELF_STDIN_OFF and restore tty group if
   we are restoring external tty

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:52:01 +04:00
Cyrill Gorcunov
bee5ddfb7a tty: Update tty verification procedure
We need to make sure that the only one external tty
is present, since otherwise we have no idea on which
pts index to connect them on restore.

This patch extends tty_verify_active_pairs procedure to
count how many external tty is present in the dump image.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:52:00 +04:00
Cyrill Gorcunov
c2f44646b6 tty: Mark collected tty in @tty_active_pairs bitmap
Upon reception of tty we need to mark it in @tty_active_pairs
bitmam thus we will be able to verify if

 - all active ttys obtained are paired
 - if not paired then only one external tty is allowed

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:51:59 +04:00
Cyrill Gorcunov
3d84d00fa8 pstree: Allow to dump and restore session non-leaders if --shell-job passed
If --shell-job passed we allow to dump and restpre session non-leaders.

Note that in sake of tty restore (which will be addressed in
further patches) we do inherit process group for root task.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:51:58 +04:00
Cyrill Gorcunov
9ba5c935f1 options: Add "--shell-job" option
This option will tells the tool to procceed dumping
even if a root task is not a session leader.

This implies that this option will allow to "migrate"
one external tty connection. Say a person may dump
"top" application in one bash shell and restore it
in another shell session.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:51:57 +04:00
Cyrill Gorcunov
9c579cfd02 sfd_type: Add SELF_STDIN_OFF service fd and call helpers where needed
We will need it for slave ttys migration. They serve for one purpose --
to clone self stdio descriptor and use it with tty layer, which will
be addressed in further patches.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:51:56 +04:00
Cyrill Gorcunov
b0b7ed1181 restorer: Add sys/resource.h header
Otherwise PRIO_PROCESS may be not found.

Reported-by: Andrew Grigorev <andrew@ei-grad.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:02:47 +04:00
Andrew Grigorev
51e9cd32b2 types: use siginfo_t from signal.h for rt_signalfn_t declaration
It should fit the sa_sigaction declaration, otherwise compiler
complains about uncasted assignments.

 | restorer.c: In function тАШ__export_restore_taskтАЩ:
 | restorer.c:318:20: error: assignment from incompatible pointer type [-Werror]

So just use siginfo_t here from the system signal.h header.

Signed-off-by: Andrew Grigorev <andrew@ei-grad.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-18 15:02:37 +04:00
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