2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

4661 Commits

Author SHA1 Message Date
Andrey Vagin
896fae70d3 zdtm: rollback cwd only if a test case is executed in namespaces
$ bash test/zdtm.sh -i 0 '\(ns/static/env00\|static/pty03\|static/mountpoints\)'
...
==================================== ERROR ====================================
Test: zdtm/live/static/mountpoints, Namespace:
Output file: /root/git/1/criu/test/zdtm/live/static/mountpoints.out
------------------------------------------------------------------------------
00:53:03.267: 26935: FAIL: mountpoints.c:139: Can't umount all the filesystems (errno = 16 (Device or resource busy))
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

Fixes: 0198590c5a44 (zdtm: Factor out starting the test via Makefule)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-05 16:33:58 +04:00
Cyrill Gorcunov
5cb0c0d233 vdso: Defer handling untill all zones are restored
In worst case we might be tryin to proxify vdso zone
when vvar only is remmaped but vdso itself is not yet
(left and right zones shifting). Thus vdso_proxify
will complain that vdso is not yet mapped refusing
to restore.

Thus wait until everything is re-mapped then call
for proxification helper.

Reported: Mr. Jenkins
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 22:30:26 +04:00
Cyrill Gorcunov
18fe357563 vdso: Implement vDSO proxification of any vvar/vdso order
In latest linux-next the vdso zone is placed _after_ vvar
zone so eventually we need to handle any combination of
the following cases

 - no vvar zone
 - vvar before vdso
 - vvar after vdso

Here we address all them.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 15:35:03 +04:00
Cyrill Gorcunov
6446fd2c1d vdso: Move parking into a separate routine
Since we might have a several vDSO zones lets hide
handling in arch-specific routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 15:34:34 +04:00
Cyrill Gorcunov
6906e1a830 vdso: Drop unneeded @vdso_rt_vma_size variable
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 15:34:22 +04:00
Cyrill Gorcunov
b00bdb2dbc vdso: x86 -- Test VMAs order in vdso_proxify
Make sure we really can do inplace remap.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 15:34:01 +04:00
Cyrill Gorcunov
b8d0b9c773 vdso: x86 -- Make sure that vdso symtable is carrying bindled vmas
In linux kernel 3.17 most probably the vvar and vdso zones will
be in reverse order, ie vvar first and vdso later so do extended
test for these VMAs coming in one bundle.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 15:33:49 +04:00
Cyrill Gorcunov
e67ba97ebe cgroup: Use snprintf in move_in_cgroup
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 14:09:31 +04:00
Cyrill Gorcunov
6ea8fb78a3 cgroup: Use snprintf in collect_cgroups
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 14:09:30 +04:00
Cyrill Gorcunov
357aa793d2 cgroup: Simplify add_cgroup
- xfree works well with nil argument no need for additional tests.
 - no need for @ret variable, we either success returning 0 explicitly,
   either fail with explicit -1

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 14:09:25 +04:00
Cyrill Gorcunov
6c7ea7af9c cgroup: prepare_cgroup_dirs -- Add some more debug printouts
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 14:09:23 +04:00
Tycho Andersen
89d3840c9c build: install target depends on libcriu
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:59:00 +04:00
Tycho Andersen
acaca5f14a lib: return -ECONNREFUSED as documented
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:58:49 +04:00
Tycho Andersen
df6f80f48e .git: add cgroup01 to gitignore
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:58:41 +04:00
Tycho Andersen
14cad21eb5 lib: Generate pkgconfig file
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:57:18 +04:00
Tycho Andersen
0ef4f01066 lib: Initialize child messages correctly
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:10:35 +04:00
Salvatore Bonaccorso
f16a08e54b Small spelling fixes in criu.8 manpage
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:09:54 +04:00
Ruslan Kuprieiev
9f8a7ccaad restore: sigreturn_restore: free core _after_ using it
Currently we have this:
	.......
	/* No longer need it */
	core_entry__free_unpacked(core, NULL);

	ret = prepare_itimers(pid, core, task_args);
	if (ret < 0)
		goto err;
	.......

So we're using ptr right after free-ing it.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:09:02 +04:00
Andrey Vagin
787e8a1d88 test/mountpoints: clean up
All mounts is marked as private for one call, so we don't need the
variable private, which has been added in "(55fe0939088d) zdtm: don't
destruct an external mount-namespace"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:07:40 +04:00
Pavel Emelyanov
6ca5ac7541 cg: Merge two equal if-s into one
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:13:02 +04:00
Pavel Emelyanov
45d029f04e cg: Keep "/" in cgroup root paths
The ftw trims tail "/" from path argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:13:01 +04:00
Pavel Emelyanov
586eb55f35 cg: Trim proper prefix from ftw's path
After the commit that walks /proc/self/fd/N path instead of the temporary
one, the add_cgroup() started trimming first several bytes from the cgroup
path.

Test passed, since all cgroups were left as is after dump, so criu restore
didn't recreate them but got EEXIST on all mkdir-s.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:12:59 +04:00
Andrew Vagin
dda742ec57 cgroup: don't look up existing mount point
A mount point, which is mounted by someone else, may be umounted in
any moment.

For example the test system executes tests concurrently and sometimes
one test looks up a mount point, which has been mounted by another test.

==================================== ERROR ====================================
Test: zdtm/live/static/inotify00, Namespace: 1
Dump log   : /var/lib/jenkins/jobs/CRIU-dump/workspace/test/dump/inotify00/15535/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.021951) Error (cgroup.c:409): cg: failed walking /var/lib/jenkins/jobs/CRIU-dump/workspace/test/dump/signalfd00/15538/1/.criu.cgmounts.UGj28v/ for empty cgroups
(00.021967) Error (cr-dump.c:1601): Dump core (pid: 15535) failed with -1
(00.025509) Error (cr-dump.c:1914): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

In the previous patch I suggested to open a mount point, but it brought
other problems. We may open a directory where a cgroup mount has been
umounted and an owner will get EBUSY on attempt to remove this
directory.

Reported-by: Jenkins Criuovich
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-16 17:53:09 +04:00
Pavel Emelyanov
97f7d17905 cg: Don't walk cgroup tree when it's not required
We have two bugs actually.

First, the check for 'item == root_item' in dump_task_cgroup fires
twice: first when we rite inventory (item == NULL as argument and
root_item == NULL because we haven't yet collected tasks) and the
2nd time when we dump the root task itself.

The 2nd issue sits in dump_cgroups() -- if root_cgset == criu_cgset
we don't write cgroups information at all (checking that we don't
have them with list_is_singular() inside that if). That said, we
don't need to read the cgroups tree if we're not going to dump it.

This patch fixes both.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-16 17:31:56 +04:00
Pavel Emelyanov
9b6c41f2a0 cg: Remove unused cgroup_dir field
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:23 +04:00
Pavel Emelyanov
f5705fb416 cg: Minus one string copy in collect_cgroups
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:17 +04:00
Pavel Emelyanov
3467c3a5eb cg: Mark cgroup_contains as static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:08 +04:00
Cyrill Gorcunov
cd704e80ee cgroups: Make sure the cgroup formatted correctly
In case if something is broken in the kernel and
we get a format corrupted -- simply exit out with
error instead of strlen'ing nil string.

Also while at it -- add a comment about format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-15 17:04:11 +04:00
Tycho Andersen
0f178a1f99 cg: correctly detect co-mounted controller mount point
Before we would not detect the mount point for co-mounted controllers. Things
still worked because we'd just re-mount them ourselves and traverse our own
mount point, but this saves an extra mount().

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-14 15:14:37 +04:00
Cyrill Gorcunov
3a0ff651db protobuf: Cleanup typedefs a bit
No need to pollute typedef out of structure
statement since we don't use it in that form.
Simply typedef in place. And align members
while we're at it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-14 15:11:46 +04:00
Pavel Emelyanov
a06488ec10 show: Fix inet6 addresses showing
Was broken by d57be38c -- this one pretty show does return 1.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:18 +04:00
Pavel Emelyanov
9c88d34c20 show: Rename loop index 'counter' into 'i'
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:17 +04:00
Pavel Emelyanov
1ba5f60de4 show: Initialize field->count early
This just makes ctl->cur initialized all in one place,
but not scattered all over the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:16 +04:00
Pavel Emelyanov
1cd57697b3 show: Merge fsize and show-fn getting switches
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:15 +04:00
Christopher Covington
24a2cec44c ZDTM build fixes
Errors building natively for x86_64 on Ubuntu 12.04:

session02.c:142:13: error: ‘PR_SET_CHILD_SUBREAPER’ undeclared

session03.c:175:13: error: ‘PR_SET_CHILD_SUBREAPER’ undeclared

vdso01.c:300: undefined reference to `clock_gettime'

Error cross compiling for arm using Linaro 14.01 toolchain:

gcc: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
cc1: error: unrecognized command line option ‘-mfpu=neon’
cc1: error: unrecognized command line option ‘-marm’
criu-rtc.c:1:0: error: bad value (cortex-a15) for -mtune= switch
cc1: error: unrecognized command line option ‘-mfpu=neon’
cc1: error: unrecognized command line option ‘-marm’
criu-rtc.pb-c.c:1:0: error: bad value (cortex-a15) for -mtune= switch

Errors cross compiling for aarch64 using Linaro 14.01 toolchain:

maps007.c: In function ‘main’:
maps007.c:88:4: error: passing argument 1 of ‘atomic_read’ from incompatible pointer type [-Werror]
    if (futex_get(&shm->stop) && atomic_get(&shm->delta) == MAX_DELTA)
    ^
In file included from ../../lib/lock.h:10:0,
                 from maps007.c:13:
../../lib/arch/aarch64/include/asm/atomic.h:14:19: note: expected ‘const atomic_t *’ but argument is of type ‘struct f
utex_t *’
 static inline int atomic_read(const atomic_t *v)
                   ^

ptrace.c: In function ‘main’:
ptrace.c:97:15: error: ‘PTRACE_GETREGS’ undeclared (first use in this function)
    if (ptrace(PTRACE_GETREGS, stopped, NULL, regs)) {
               ^

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 20:39:52 +04:00
Tycho Andersen
241019b6aa cg: don't save cgroup directories twice
The path in cc->path here always has a "/" prefix since it comes from
/proc/$pid/cgroup. The additional / confuses the string slinging because ftw()
normalizes paths to have one "/" when we start traversing a subdirectory.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 20:37:24 +04:00
Pavel Emelyanov
ebfc37b0d9 show: Don't continue showing messages with the descriptor of nested one
When we dive into showing nested message, the call to it will
overwrite the ctl->Arg field with the descriptor of the nested
one. As a result, after the call returns we continue showing
old message with new descriptor.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-11 15:03:14 +04:00
Pavel Emelyanov
71add03823 show: Always print tabs before braces
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-11 15:02:51 +04:00
Pavel Emelyanov
d57be38ce9 show: Sanitze repeated fields showing routine
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 15:02:14 +04:00
Pavel Emelyanov
f572bc4eaf cg: Rename controllers field
We have to many controllers names in cgroup.c file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-11 15:00:51 +04:00
Pavel Emelyanov
ff90710c2e cg: Remove unused id field from controllers message
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-11 15:00:43 +04:00
Tycho Andersen
51876eea5d Attempt to restore cgroups
During the dump phase, /proc/cgroups is parsed to find co-mounted cgroups.
Then, for each task /proc/self/cgroup is parsed for the cgroups that it is a
member of, and that cgroup is traversed to find any child cgroups which may
also need restoring. Any cgroups not currently mounted will be temporarily
mounted and traversed. All of this information is persisted along with the
original cg_sets, which indicate which cgroups a task is a member of.

On restore, an initial phase creates all the cgroups which were saved. Tasks
are then restored into these cgroups via cg_sets as usual.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-10 17:00:28 +04:00
Cyrill Gorcunov
e1b56c8fac vdso: x86 -- Drop BUG_ON if no pfn found
If pfn = 0 it means we hit something very strange
condition but better to not yield BUG_ON here,
better exit with error for future investigation.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:19:37 +04:00
Andrey Vagin
828715f9f9 jenkins/btrfs: exclude inotify_irmap
Cyrill:  we exclude these tests because of braindamaged scheme
         btrfs uses for subvolume device numbering which we don't
	 yet support in inrmaps.

Test: zdtm/live/static/inotify_irmap, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/inotify_irmap, Namespace: 1
Dump log   : /mnt/btrfs/workspace/test/dump/inotify_irmap/16077/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.024342) Error (irmap.c:80): irmap: Can't stat /var/spool: No such file or directory
(00.024365) Error (irmap.c:80): irmap: Can't stat /lib/udev: No such file or directory
(00.024378) Error (irmap.c:80): irmap: Can't stat /no-such-path: No such file or directory
(00.024383) Error (fsnotify.c:184): fsnotify: Can't dump that handle
(00.024397) Error (cr-dump.c:1563): Dump files (pid: 16090) failed with -1
(00.024779) Error (cr-dump.c:1911): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:18:39 +04:00
Andrey Vagin
77391fa795 test/jenkins: add job to test pre-dump
Make pre-dump twice and then dump and restore.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:18:37 +04:00
Andrey Vagin
19df5ec472 tcp: don't forget to wake up the port->users futex
Reported-by: Robert Reinecke <reinecke@rbg.informatik.tu-darmstadt.de>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 17:43:54 +04:00
Pavel Emelyanov
3435ec9ee5 Add 50K'th line in the source code
As per current top commit (9c0c23c0) the amount of code in CRIU
_without_ the contents of the test/ directory is

$ git grep -l . | egrep -v ^test | xargs wc -l
...
49999

This is the only chance for such a great one-liner :)

The place in the code is not completely random -- it's one of the
few occurrences of two consecutive empty lines in a .c file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Tested-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
2014-07-08 17:38:52 +04:00
Pavel Emelyanov
9c0c23c067 files: Don't unlink ghost directory
It will be rmdir-ed a bit later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:55:52 +04:00
Pavel Emelyanov
49f27969f5 files: Don't fail on missing fs.img for zombies
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:52:29 +04:00
Pavel Emelyanov
e2ab347415 files: Initialize remap->is_dir for linked remap (to false)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:52:09 +04:00