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

6028 Commits

Author SHA1 Message Date
Andrew Vagin
4986d1b51e zdtm.py: compare a set of mounts before and after c/r
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:13:03 +03:00
Andrew Vagin
36216c3c1b zdtm.sh: fix a value of ZDTM_THREAD_BOMB
The thread_bomb test was rewrited and
ZDTM_THREAD_BOMB should be equal 5 now.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:12:32 +03:00
Andrew Vagin
276eb6e823 zdtm.py: don't mix tab and spaces
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:12:07 +03:00
Andrew Vagin
3eac44ae85 zdtm.py: collect fds and maps for all test processes
It works for tests which are executed in a separate pidns

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:11:44 +03:00
Andrew Vagin
41a0035dd4 mount: don't take into acount the root master_id
It's an external one and it's already created and we don't have proper
shared mount.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:11:06 +03:00
Andrew Vagin
db91c9a934 mount: don't remount a slave mount as private when it isn't required
We don't need to remount a mount as private, when a source mount and
a new mount has the same master_id and shared_id

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:11:01 +03:00
Dmitry Safonov
4f68446ddf zdtm: add loginuid restore test
Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:09:03 +03:00
Dmitry Safonov
f4216c5305 zdtm: add test for oom_score_adj restore
Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:09:01 +03:00
Dmitry Safonov
aa9f1df045 criu: unset loginuid value before creating userns
The value of loginuid cannot be changed inside container, with the
exception if it was not set yet. This value is inherited on fork() from
parent.

So, to restore original loginuid values for all tasks:
  - unset the container parent loginuid
  - all children will have this value unsetted
  - on child restore set value from dump

See http://lxr.free-electrons.com/source/kernel/audit.c#L635
https://jira.sw.ru/browse/PSBM-41993

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:09:00 +03:00
Dmitry Safonov
594b4e3a00 criu: restore loginuid & oom_score_adj values
https://jira.sw.ru/browse/PSBM-41993

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:08:59 +03:00
Dmitry Safonov
e5c99983a4 criu: dump loginuid & oom_score_adj values
https://jira.sw.ru/browse/PSBM-41993

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:08:58 +03:00
Cyrill Gorcunov
628179cbbf make: Fix @install-criu target
Standalone criu target should not be used here
because it doesn't carry all prerequisites needed.
Instead simply use @all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 15:03:07 +03:00
Tycho Andersen
182ed5e811 test: report actual errno on seccomp prctl failure
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 15:02:40 +03:00
Pavel Emelyanov
4427a71560 zdtm.py: Add action for cleaning nsroot
When running test in ns/uns flavor zdtm.py builds a temp root in test/ directory.
The new action allows to remove all this stuff automatically.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 15:01:16 +03:00
Rodrigo Bruno
f993926f5b Rename cr_opts.ps_port into port
Signed-off-by: Rodrigo Bruno <rbruno at gsd.inesc-id.pt>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 14:00:09 +03:00
Rodrigo Bruno
91b689a3a4 Introduce the read_into_buffer helper
This will be required for page-cache and page-proxy set.

Signed-off-by: Rodrigo Bruno <rbruno at gsd.inesc-id.pt>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 13:58:03 +03:00
Andrew Vagin
391efc9d7e seize: don't wory if a cgroup contains some extra tasks (v3)
A freezer cgroup can contain tasks which will be not dumped,
criu unfreezes the group, so we need to freeze all extra
task with ptrace like we do for target tasks.

Currently we attache and send an interrupt signals to these tasks,
but we don't call waitpid() for them, so then waitpid(-1, ...)
returns these tasks where we don't expect to see them.

v2: execute freezer_detach() only if opts.freeze_cgroup is set
    calculate extra tasks in a freezer cgroup correctly
v3: s/frozen_processes/processes_to_wait/

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-14 15:55:30 +03:00
Stanislav Kinsburskiy
8e863a94c7 fstype: "mount" callback introduced
It will be used to mount AutoFS, because context creation is required in
addition to actual mount operation.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-14 14:04:32 +03:00
Stanislav Kinsburskiy
1617579a27 pstree: more pstree-related helpers
This patch introduces three helpers:
1) pstree_item_by_real() - search for pstree item by real pid.
2) pstree_item_by_virt() - search for pstree item by virtual pid.
3) pid_to_virt() - return virtual pis by real one.

Note: pstree_item_by_virt() and pid_to_virt() will be used to migrate AutoFS.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-14 14:04:21 +03:00
Pavel Emelyanov
bde6d0dbf9 jenkins: No parallelizm for group test
The head test is zdtm/lib/group, so it is impossible to run several
instances of it in parallel

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 17:49:55 +03:00
Pavel Emelyanov
bfcea5623d zdtm.py: Add write perms for all bins in test
This is to make groups test start in uns flavors

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 17:39:05 +03:00
Pavel Emelyanov
ecd789bffa zdtm: Fix compilation after previous commit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:54:35 +03:00
Pavel Emelyanov
e71d50894d jenkins: Add groups
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:51:18 +03:00
Pavel Emelyanov
fcf2276bf5 freebind: Use different ports
When run in groups ip-freebind and ip-freebind-false fail
to start simultaneously.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:51:08 +03:00
Pavel Emelyanov
9ed3f6f2c7 zdtm.py: Fix deps for group start
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:51:01 +03:00
Dmitry Safonov
3a244a0d1f criu: tty: pick only master as a control terminal
tty_find_restoring_task will prepare control terminal (by tcsetpgrp)
only if tty is master.
By a chance it's possible to pick slave terminal as a control, which
will refrain restoring control terminal.

https://jira.sw.ru/browse/PSBM-42093

Signed-off-by: Dmitry Safonov <dsafonov@odin.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:50:12 +03:00
Cyrill Gorcunov
46b664e11b test: Add inotify02 into the Makefile
Reported-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:49:38 +03:00
Pavel Emelyanov
3825c3e5d4 crit: Speed up jenkins test ~60 times
Running crit tool 4 times per test (decode, encode, decode --pretty
and encode back again) is way too slow. The majority of time, as
it turned out, goes on python load and arguments parsing. The en-
and de-coding works pretty fast.

So doing re-code logic in one python script for ALL images is way
way faster -- ~1 hour vs ~1 minute on my box.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:36:05 +03:00
Pavel Emelyanov
1b87ae8ff5 crit: Fix ipc load/dump for io.BytesIO input/output
There are loads and dumps method in pycriu.images that work with
strings, instead of open()-ed files. For simplicity strings are
turned into streams with io.BytesIO and the files are then pushed
into regular load/dump methods.

The problem is that array.array object doesn't work with io object
in .fromfile/.tofile methods, so we have to read/write the data
from them explicitly and use .fromstring/.tostring for arrays.

With this the crit test finally passes :D

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2015-12-11 16:35:30 +03:00
Cyrill Gorcunov
8841edf770 crit: Add dump for semaphores
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:34:59 +03:00
Cyrill Gorcunov
21cce134ea crit: Add handling of msgqueue
Typical output

 | {
 |     "magic": "IPCNS_MSG",
 |     "entries": [
 |         {
 |             "desc": {
 |                 "key": 2181112128,
 |                 "uid": 18943,
 |                 "gid": 58467,
 |                 "cuid": 18943,
 |                 "cgid": 58467,
 |                 "mode": 438,
 |                 "id": 0
 |             },
 |             "qbytes": 16384,
 |             "qnum": 2,
 |             "extra": [
 |                 {
 |                     "mtype": 1,
 |                     "msize": 15
 |                 },
 |                 "VGVzdCBzeXN2NSBtc2cA\n",
 |                 {
 |                     "mtype": 26538,
 |                     "msize": 27
 |                 },
 |                 "WWV0IGFub3RoZXIgdGVzdCBzeXN2NSBtc2cA\n"
 |             ]
 |         }
 |     ]
 | }

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:34:47 +03:00
Cyrill Gorcunov
aa91dbfc09 crit: Add dump method for shmem pages
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:34:38 +03:00
Cyrill Gorcunov
57fbb4e5d3 crit: Add payload handler for shmem pages
- need encoder

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:34:24 +03:00
Cyrill Gorcunov
c5e7f435e6 crit: Add payload handler for semaphore images
- need to add encoding method
 - also need to do the same for ipc queues and shmem

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:34:18 +03:00
Pavel Emelyanov
2d1083303d zdtm.py: Add step-by-step execution
When debugging it's useful to stop zdtm.py at certain points and
check what's going on out there. For this the --sbs (step-by-step)
option is introduced. It will make zdtm.py stop and wait for user
keypress before dump, before restore and after restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:31 +03:00
Pavel Emelyanov
bfb98244fe zdtm.py: Print out and strace file names
Generated files are often analyzed after test, so it's handy to have
their full names on the screen at once.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:30 +03:00
Pavel Emelyanov
dc3b525cd7 zdtm.py: Print test output on screen when possible
Right now zdtm spawns test into a pseudo-container and redirects its
output in a temp file. This is done not to mix outputs of tests, running
in parallel, with each other.

But if we run tests one by one or there's only one test in the list
we can safely print the output right on the screen.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:29 +03:00
Andrey Vagin
b94119b023 zdtm.py: catch KeyError instead of ValueError for sets
In [3]: a
Out[3]: {1, 2, 3}

In [4]: a.remove(5)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-af76ca25878a> in <module>()
----> 1 a.remove(5)

KeyError: 5

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 15:00:45 +03:00
Andrew Vagin
af55c059fb mount: fix a race between restoring namespaces and file mappings (v2)
Currently we wait when a namespace will be restored to get its root.
We need to open a namespace root to open a file to restore a memory mapping.

A process restores mappings and only then forks children. So we can have
a situation, when we need to open a file from a namespace, which will be
"restored" by one of our children.

The root task restores all mount namespaces and opens a file descriptor
for each of them. In this patch we open root for each mntns in the root
task.

If we neeed to get root of a namespace which isn't populated, we can get
it from the root task. After the CR_STATE_FORKING stage, the root task
closes all namespace descriptors ane we know that all namespaces are
populated at this moment.

v2: don't close root_fd for root ns, because it was not opened
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 14:58:59 +03:00
Andrew Vagin
a9be7621b7 mount: pick out a function to set ROOT_FD_OFF
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 14:58:18 +03:00
Pavel Emelyanov
decf4f525a crit: Fix casts for fixed and sfixed types
The native pb engine doesn't accept types other than int or long:

...
  File "/root/src/criu/pycriu/images/pb2dict.py", line 264, in dict2pb
    pb_val.append(_dict2pb_cast(field, v))
  File "/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.py", line 111, in append
    self._type_checker.CheckValue(value)
  File "/usr/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 104, in CheckValue
    raise TypeError(message)
TypeError: 1.1258999068426252e+16 has type <type 'float'>, but expected one of: (<type 'int'>, <type 'long'>)

In particular, this is seen when encoding back so_filter field from
inetsk image.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
2015-12-10 14:57:27 +03:00
Cyrill Gorcunov
d1e9b11d02 seize: get_freezer_state -- Relax stack
For historical reason we allocate the complete PATH_MAX
here just to fetch a word of freezer state. Lets relax
the stack pressue and rename @path to @state. Same time
make states @frozen, @freezing, @thawed being static,
we don't export them.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 14:56:51 +03:00
Andrey Vagin
b6d9bcd10d zdtm.sh: set a type argument for mknod
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 14:55:51 +03:00
Andrey Vagin
94d91458c9 zdtm.py: don't worry if uns isn't in run_flavs
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-09 17:03:07 +03:00
Andrew Vagin
7094e110a3 mount: stop doing anything if populate_mnt_ns() failed
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-09 14:28:46 +03:00
Andrew Vagin
96a12d4755 mount: don't worry if a binfmt_misc image is empty
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-09 14:27:58 +03:00
Pavel Emelyanov
16dccd5ca2 jenkins: Fix CRIT test to skip non-criu images and provide cumulative output
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 18:21:47 +03:00
Andrew Vagin
2c747325f4 mount: don't add dot to a path
It isn't required and it doesn't work in a case when
we want to bind-mount a file.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 17:19:51 +03:00
Adrian Reber
ff3fb16f14 crit: Pretty print vma flags and status
To better understand the content of mm-<ID>.img and pagemap-<ID>.img
additional constant names have been added to better resolve the hex
value to symbolical names.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 16:34:48 +03:00
Andrew Vagin
93e996d8ed mount: umount a temporary mount with MTN_DETACH
If a temporary mount is a shared one, a new mount can be
propagated into it.

Fixes: 0e9736ab68e0 ("mount: fix restoring a bind-mount when its root is overmounted)")

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 16:33:58 +03:00