2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00
Commit Graph

2853 Commits

Author SHA1 Message Date
Kir Kolyshkin
97802b0d55 Makefile.inc: restore
This reverts part of commit a519e0c which broke the man page build:

	[kir@kirpad Documentation]$ make
	"  GEN     " crtools.1
	/bin/sh:   GEN     : command not found
	make: *** [crtools.1] Error 127

So let's reintroduce Q and E in a separate Makefile.inc as it was
before.

Cc: Stanislav Kinsbursky <skinsbursky@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:06:37 +04:00
Libo Chen
6cc5de60ed session03: change CLONE_STACK_SIZE from PAGE_SIZE to 4096
Update to patch "check: Introduce --ms option" (commit: 379abca968)

I find this error in my box:
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -iquote ../../lib/arch/x86/include -I../../lib   session03.c ../../lib/libzdtmtst.a   -o session03
session03.c:112:7: error: variably modified ‘stack’ at file scope

The reason is :
"#define CLONE_STACK_SIZE PAGE_SIZE" is conflict with  "#define PAGE_SIZE  (sysconf(_SC_PAGESIZE))" defined in <sys/user.h>.

I think CLONE_STACK_SIZE should be seted  4096 as session02.c.

If this patch is appropriate, please let me know.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:04:07 +04:00
Pavel Emelyanov
379abca968 check: Introduce --ms option
This option skips checking for features, that are known to
be absent in mainstream kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:38:47 +04:00
Pavel Emelyanov
8201e08081 check: Warn *diag absense always
To know what exactly is missing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:25:13 +04:00
Pavel Emelyanov
a3872dbead mem: Treat /proc/pid/pagemap2 file as optional
It will appear not earlier than in 3.10.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:22:25 +04:00
Andrey Vagin
d4e1df3a03 ptrace: don't call PTRACE_INTERRUPT many times
According to the commit message in the kernel git, a new trap flag
JOBCTL_TRAP_INTERRUPT is added, which is set on PTRACE_INTERRUPT and
cleared when any trap happens.

Currently we have a race window beetwen PTRACE_CONT and
PTRACE_INTERRUPT. If a process stops before PTRACE_INTERRUPT,
the flag JOBCTL_TRAP_INTERRUPT will be set once again.

https://bugzilla.openvz.org/show_bug.cgi?id=2569

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 20:55:20 +04:00
Andrew Vagin
66c21e22cc zdtm: add a new test case, which generate a random process tree
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-19 16:01:58 +04:00
Cyrill Gorcunov
6bdc149642 Revert "make: Don't generate tags/cscope for tools/ and test/"
This reverts commit 396a08eb95.

As Andrew requested he needs the symbols to be generated for
all possible sources in the crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-19 16:01:16 +04:00
Andrey Vagin
a34057c192 restore: add a synchronisation point after restoring credentials
For security reason processes can be resumed only when all
credentials are restored. Otherwise someone can attach to a
process, which are not restored credentials yet and execute
some code.

https://bugzilla.openvz.org/show_bug.cgi?id=2561

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-19 15:58:50 +04:00
Pavel Emelyanov
1abb8782a8 page-server: Implement holes writing into pagemap
Just add new protocol command and call local_xfer->write_hole on
server side. Also tune the mem-snap test to test memory xfer via
page server.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-18 17:34:47 +04:00
Pavel Emelyanov
c2c8d81d48 cr: Remove --snapshot from help text
It's not complete and is about to change significantly. Better not
show it oficially.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-18 16:30:41 +04:00
Pavel Emelyanov
e48347e095 show: Show nr_pages in pagemap in decimal
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-18 16:29:56 +04:00
Andrey Vagin
ae99f53928 page-xfer: close sockets on errror paths
CID 996195 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable ask going out of scope leaks the handle.

CID 996196 (#3 of 3): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable sk going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 21:58:29 +04:00
Cyrill Gorcunov
5a61a50939 shmem: Add missing \Newline into pr_info
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 21:52:15 +04:00
Libo Chen
9f9ed0c69e kerndat:fix compile err
Update to commit 78b8abe9a5
I find a compile err:

kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 21:51:27 +04:00
Pavel Emelyanov
f34d63bfb1 fd: Comment file_desc_ops
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 14:47:10 +04:00
Pavel Emelyanov
8f5b093c5b mem-snap: Add comment about mem_snap_ctx object
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 14:42:01 +04:00
Pavel Emelyanov
febdd8a2bf page-read: Factor out PagemapEntry to iovec conversion
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 14:36:05 +04:00
Pavel Emelyanov
68bfaeb852 test: Rise verbosity of mem-snap test's dump
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:17:15 +04:00
Pavel Emelyanov
7f146f1337 poage-xfer: Cleanup xfer logging
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:16:56 +04:00
Pavel Emelyanov
485cbda195 page-xfer: Sanitize opening page xfer
Make it be explicitly splitted into 2 sub-paths.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:10:39 +04:00
Pavel Emelyanov
8f9dd8f76c page-server: Make open_page_server_xfer static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:09:16 +04:00
Pavel Emelyanov
37c37416ac page-server: Use new page-xfer API to write pages locally
Page server cannot provide one big pipe with pages. Thus,
before this patch, it wrote pages into image in small pieces.
Now the page-xfer API accepts pagemaps and pages separately,
so we can just use thie API.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:02:39 +04:00
Pavel Emelyanov
1e78c91d20 page-xfer: Fix page writing API
Split it into two parts -- writing pagemap and writing
pages. This is required for page-server part, sinc it
cannot provide one big pipe with all the pages at once.
Thus it needs to feed pages in portions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 11:59:19 +04:00
Pavel Emelyanov
dcba149125 crtools: Put short options near long options
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 11:43:55 +04:00
Pavel Emelyanov
571967ca02 crtools: Tune --help test
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 11:40:56 +04:00
Pavel Emelyanov
dbbb9ec38f mem: Comment page-read, page-xfer and page-pipe
These three are quite complex things, so write general comments about
what they are doing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 11:34:53 +04:00
Pavel Emelyanov
78b8abe9a5 test: Add test for memory snapshots
Two args (optional) -- number of snaps (3 defail) and pause
between them (4 defail).

Uses memory toucher from zdtm/.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 14:50:09 +04:00
Pavel Emelyanov
199dba2361 soft-dirty: Check that kernel reports soft-dirty bits
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 13:24:32 +04:00
Pavel Emelyanov
5b343b40eb kerndat: Introduce the storage of kernel run-time info
One of such things we use right now is the device for anon shmem
mappings backing. In the furure this can be extended to check for
various kernel features.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 13:02:09 +04:00
Kir Kolyshkin
41c7ca8218 Fix typos in comments
This is less useful than fixing typos in output messages, but anyway.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:46 +04:00
Kir Kolyshkin
d90d4b1b88 Fix typos in log messages
Someone has to do it, right?..

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:25 +04:00
Kir Kolyshkin
4eb723db98 Fix typos in messages from test suite
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:01 +04:00
Cyrill Gorcunov
ea438d3f86 proc-parse: Rework error paths
On error paths we don't explicitly close procfile.

CID 996191 (#5 of 6): Resource leak (RESOURCE_LEAK)
22. leaked_storage: Variable "f" going out of scope leaks the storage it points to.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 20:50:44 +04:00
Cyrill Gorcunov
67e91d65a1 shmem: restore_shmem_content -- Use close_safe
Don't call close() with degative fd. For consistency
simply use close_safe here. All fds touched are initialized
either to valid fd or to value < 0 which pretty good handled
by close_safe helper.

CID 996212 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
10. negative_returns: "fd" is passed to a parameter that cannot be negative.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 20:50:35 +04:00
Cyrill Gorcunov
ab0eb45d8a log: log_init -- Check for dup return code
Don't pass negative descriptor to install_service_fd

CID 996213 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
7. negative_returns: "new_logfd" is passed to a parameter that cannot be negative.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 20:50:27 +04:00
Pavel Emelyanov
ea5b03cefa zdtm: Test for manual (for now) testing
This guy touches a random page once per second and backs-up
what was touched. At the end it checks whether everything is
OK. It can be used to test how snapshots work -- take several
snapshots with several seconds pauses in betweem and restore
form the last.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:28 +04:00
Pavel Emelyanov
af03e7d564 page-pipe: Print full layout of page-pipe in log (in debug loglevel)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:26 +04:00
Pavel Emelyanov
3307bfd8f1 restore: Restore memory from stack of snapshots
This one is a little bit more tricky that dump. On restore we
should open the chain of pagemap-s (by "parent" links). Then for
every pagemap with in_parent set we should go to parent and ask
for the page. Parent, in turn, should properly determine where
the respective page is in his pagemap and position the page.img's
position respectively.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:22 +04:00
Pavel Emelyanov
433c46625e dump: Snapshot memory
It's quite simple -- get parent's pagemap before dumping memory,
then collect _full_ pagemap of task putting holes into page-pipe
when the page is (soft-dirty-clear && in-parent-map). At the end
reset task's soft-dirty bits.

This requires kernel support from
http://comments.gmane.org/gmane.linux.kernel.mm/98283

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:18 +04:00
Pavel Emelyanov
60fc6abfd7 cr: Preparations for snapshot
1. Directory with images may have a "parent" symlink pointing to the
   place where the previous snapshot is
2. Each pagemap will have "in_parent" bit, which means, that the
   pages for this pagemap entry are not in the respective page.img
   but in parent
3. New --leave-running option to use with --snapshot not to kill
   tasks after snapshot

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:15 +04:00
Pavel Emelyanov
757f9c570f page-read: New abstraction for restoring pages
Now we have 2 forms of storing pages -- legacy pages.img and
new pagemap + pages image. We'll have one more (ovz) and the
pagemap + pages will be stacked (snapshot restore). Thus it's
handy to have this as an page-reader object.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:12 +04:00
Pavel Emelyanov
eb5a378855 page-xfer: Write holes and non-holes in sorted way
The pagemap.img contains sorted iovs. Need to keep this array also
sorted even if holes are in there for simpler read on restore.

Separate ->write_hole callback since dump of hole and non-hole
will differ significantly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:10 +04:00
Pavel Emelyanov
e5e537954c page-pipe: Support holes in page-pipe iov map
Holes are regions, that don't have pages in them (i.e. -- no
pages in pipes). These holes are in separate iovs array since
we should have straight arrays of iovs for non-holes, which is
in turd required to push it into vmsplice in _one_ chunk.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:07 +04:00
Pavel Emelyanov
6ff0edadcd img: Open images "at" functionality
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:03 +04:00
Andrey Vagin
82ac1ae325 zdtm: add fanotify00 in the default list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 22:06:55 +04:00
Andrey Vagin
13a8e60bca cr-dump: collect mount points in the target namespace
Information about mount points is used for dumping fanotify.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 22:06:48 +04:00
Pavel Emelyanov
18dee445f5 tcp: Restore creds after turning off tcp repair mode
The tcp repair manipulations require CAP_SYS_NET_ADMIN on
a calling task. Thus, if the task to restore is run from
non-root user, the tcp socket repair off will fail, but
restoration wouldn't abort.

Fix this by moving creds restore after tcp restore finish.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 21:39:50 +04:00
Pavel Emelyanov
2ab06c9c5a tcp: Schedule tcp socket for repair-off with proper fd
The fd in -> open callback is temporary (the files restoring
engine will re-open one under some other fd). But since we
add this fd to future repair off, this off will fail working
on wrong fd.

Move scheduling for repair-off into port-open where the corrent
fd is known.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 21:10:37 +04:00
Alexander Kartashov
4498dffce3 zdtm.sh: fixed shared libraries retrieval
The pipe retrieving shared libraries the test depends on

ldd $test_path $ps_path | awk '/^\s/{ print $1 }'

doesn't actually produce any output so all NS tests fail
bacause the system linker fails to locate shared libraries
the test program depends on. This patch fixes the pipe
to retrieve the list of libraries properly.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 19:59:49 +04:00