2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

5675 Commits

Author SHA1 Message Date
Tycho Andersen
97cb181cbc irmap: don't leak irmap objects in --irmap-scan-path
v2: use struct irmap directly in irmap_path_opt

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:02:51 +03:00
Andrey Vagin
6c62aa8a35 page-server: wait when a socket will be closed only if it isn't external
External socket can be used for other purpose.

Reported-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:02:18 +03:00
Andrew Vagin
baed9dd946 zdtm: check restoring of sockets in the TCP_CLOSE state
(00.004456) Error (sk-inet.c:188): Name resolved on unconnected socket
(00.004466) Error (cr-dump.c:1255): Dump files (pid: 7944) failed with -1
(00.004680) Error (cr-dump.c:1617): Dumping FAILED.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:01:36 +03:00
Pavel Emelyanov
ee6fbf7c2f inet: Check for supported protocol earlier
If we try to dump inet socket with unsupported proto we may fail
with strange error from get_unconn_sk(), since the socket will
not be found in hashes.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Reported-by: Julian Andres Klode <jak@jak-linux.org>
2015-09-28 22:01:13 +03:00
Pavel Emelyanov
efa7dcf7c2 ghost: Remove ghost files if restore fails
Issue #18. When restore fails ghost files remain there. And
to remove them we have to know their list, paths to original
files (to construct the ghost name) and the namespace ghost
lives in.

For the latter we keep the restore task namespace at hands
till the final stage and setns into it to kill ghosts.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:00:37 +03:00
Pavel Emelyanov
a7c9f3011d mnt: Read mount images early
Mappings from mount id to namespace will be required to
remove ghosts on restore failure.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:00:36 +03:00
Pavel Emelyanov
b0e23c3d4f files: Collect ghosts and regilfes early
Info about ghosts presence and paths will be needed to
remove the ghosts itself and thus are needed in criu.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:00:35 +03:00
Pavel Emelyanov
4f7c8af0cb remaps: Move code into helper and rename global list
This list is used to roll-back the link remap files on dump. I
plan to re-use it to roll-back ghost files on restore, so clean
the code a little bit towards this change.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 22:00:14 +03:00
Pavel Emelyanov
152222a6b7 remap: Sanitize ghost file path printing
First -- avoid two memory copies by printing ns root directly, and
second -- remove extra argument from create_ghost, the mnt_id value
we need there can be found on the ghost_file object.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:59:45 +03:00
Pavel Emelyanov
6cf77f6726 remap: Rename fields for easier grep
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:58:28 +03:00
Pavel Emelyanov
7ca6cc1eb2 mnt: Clean roots yard from criu process
So here it is. If root task dies on restore the roots yard
dir remains unrmdired :( Since we already know its name, we
can remove one from criu. By the time we get to this place
the sub mount namespace(s) are already dead and yard dir
is empty. But umounting should be done by tasks after
successfull restore, so keep depopulation there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:35 +03:00
Pavel Emelyanov
3e7c92ed02 mnt: Renames around roots yard
Same thing as in previous patch -- we have too many generic
clean_ and fini_ prefixes over the code. And we need more (see
next patch), so let's specify what exactly we clean or fini.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:21 +03:00
Pavel Emelyanov
a180a75c7a mnt: Uninline clean_mnt_ns
Just to get rid of clean_something name. We have too
many cleaners out there already :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:57:06 +03:00
Pavel Emelyanov
c5c65fe17a mnt: Create roots in criu context
In case root task restore failure we'll have to remove the
roots yard dir from criu, so we have to create one by
criu to at least have the dit name.

It's OK to do it in criu, since the yards is created in
the opts.root which is the same for any mnt ns we deal
with on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:56:51 +03:00
Pavel Emelyanov
e3f5ba3c37 ns: Prepare namespaces before tasks
There's already two things we do in criu namespaces before
forking the init task (start unsd and keep netnsfd for back
reference). Next patches will introduce the 3rd action for
mount namespaces, so have a special pre-call for all this
stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 21:56:26 +03:00
Pavel Emelyanov
9b3189fed1 util: Add make_yard helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:18 +03:00
Pavel Emelyanov
c5054f959d mnt: Factor out external check in validate_mounts
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:10 +03:00
Pavel Emelyanov
4e0276340a mnt: Rename collect_shared and remove unused for_dump argument
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-28 11:32:02 +03:00
Pavel Emelyanov
3dc209e216 sk: Print socket protocol when searching
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-25 18:31:22 +03:00
Andrew Vagin
cbf2c22d37 zdtm: show errors from dump logs
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-25 18:17:31 +03:00
Andrew Vagin
1a9f0b852b net: handle old or new images where a number of sysctls is differ
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:14:32 +03:00
Cyrill Gorcunov
e8e675bdd6 seize: Add missing newline
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:11:18 +03:00
Pavel Emelyanov
addd7f686a cgroup: Print cgroup values being restored
We have many complains about errors restoring cgroup props, so
print the exact values we restore _before_ doing this, not only
after successful restore :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-24 13:11:11 +03:00
Andrew Vagin
bb45f832bf A superblock can be remounted only from the root userns.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 18:02:33 +03:00
Andrew Vagin
7ae72c651f lib: don't use uninitialized value "m"
*** CID 150397:  Memory - illegal accesses  (UNINIT)
/lib/criu.c: 696 in criu_local_add_irmap_path()
690
691             return 0;
692
693     err:
694             if (my_path)
695                     free(my_path);
>>> >>>     CID 150397:  Memory - illegal accesses  (UNINIT)
>>> >>>     Using uninitialized value "m".
696             if (m)
697                     free(m);
698
699             return -ENOMEM;
700     }
701

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:40:22 +03:00
Andrew Vagin
aab2d1e8fa zdtm: check read-only tempfs mount
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:34:39 +03:00
Andrew Vagin
84cc1e12ac mount: don't merge mnt and sb flags if only one contains MS_RDONLY
Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-23 15:34:38 +03:00
Pavel Emelyanov
9353051ba7 ns: Check ns type with type field
Actually make use of the ns->type field and remove all getpid()'s
and other strange/inconsistent checks.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:15:28 +03:00
Pavel Emelyanov
22b7256612 ns: Introduce ns type
We (may) have 3 types of namespace objects in criu -- criu's one,
root task's one and others. All of them sometimes make sense and
we differentiate them in a weird way -- by checking the ns->pid
field against getpid() or by comparing with root_item's.

The proposal is to mark ns_id objects explicitly with type field.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:14:07 +03:00
Pavel Emelyanov
1c34b284f3 mnt: Move read_mntns_img into populate routine
We don't need the read tree earlier.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:48 +03:00
Pavel Emelyanov
2847089378 mnt: Reshuffle MntEntries reading code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:25 +03:00
Pavel Emelyanov
c1a25fc1bd mnt: Add mi->root resolving helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:21 +03:00
Pavel Emelyanov
259374f6b1 mnt: Add mi->mountpoint resolving helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:13:09 +03:00
Pavel Emelyanov
d7696a42b3 files: Enlighten the rollback link-remap routine
When we don't do unlink no need to lookup for ns root-fd

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:12:41 +03:00
Tycho Andersen
85ebf0a83b usernsd: also pass pid of process that made the req
We'll use this in the next patch to correctly write sysctls.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 12:01:01 +03:00
Tycho Andersen
72ff44d0dc usernsd: move MAX_MSG_SIZE to namespaces.h
We'll use this size in the next patch to avoid having to do some dynamic
allocation.

v2: call it MAX_UNSFD_MSG_SIZE instead
v3: fix all uses of MAX_MSG_SIZE :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:57:40 +03:00
Andrew Vagin
459fb8b7da zdtm: don't run file_locks* tests simultaneously
/proc/locks can contains the same locks twice, if someone
releases a lock when we are reading this file.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:56:38 +03:00
Andrey Vagin
0ee52669ac zdtm: check read-only bind mounts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:40 +03:00
Andrey Vagin
5cff834ae7 mount: handle old images where sb and mnt options were not separated (v3)
Currently we have only one common flag. It is MS_READONLY and it's
interpreted as a super block flag to not change old behaviour.

v2: add a comment
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:36 +03:00
Andrey Vagin
1174a2ad0f mount: handle mnt_flags and sb_flags separatly (v4)
They both can container the MS_READONLY flag. And in one case it will be
read-only bind-mount and in another case it will be read-only
super-block.

v2: set mnt and sb for one call of mount() when it's posiable
v3: return a comment which was deleted by mistake
v4: Fix the sentense about restoring mnt flags
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:55:17 +03:00
Andrey Vagin
b7d393ff63 proc_parse: search the uid/gid options only for sb opts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:53:24 +03:00
Pavel Emelyanov
e9bb16265b img: Add text for known flags
Currently there are open flags on reg-files and vma
flags and prot.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:52:14 +03:00
Pavel Emelyanov
32d61ed6d4 crit: Add ability to en-/de-code flags as text
Some flags have known text description, e.g. flags on a file
or flags on vma. Add ability to show these flags in decoded
form (and encode them back into binary).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:52:04 +03:00
Pavel Emelyanov
d2b914dc11 core: Mark clear_tid_address as (criu).hex
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:51:46 +03:00
Pavel Emelyanov
d2f8f481c7 crit: Introduce 'info' action
This should print some information about image file itself, e.g.
statistical information. Right now print magic and the number of
object written in the file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:51:39 +03:00
Marcos Lilljedahl
e3f900f954 Remove multiple command validation as cpuinfo requires it
"criu cpuinfo [dump | check]" can't be used through the command line as this validation kicks in.
Other commands will fail due to required arguments so I believe it's not necessary anymore.

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:50:05 +03:00
Tycho Andersen
4f2e4ab3be irmap: add --irmap-scan-path option
This option allows users to specify their own irmap paths to scan in the event
that they don't have a path in one of the hard coded hints.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-21 11:46:12 +03:00
Andrey Vagin
d3be641acd cgroups: get controllers from /proc/self/cgroups (v2)
Some controllers can be disabled in kernel options. In this case they
are shown in /proc/cgroups, but they could not be mounted.

All enabled controllers can be collected from /proc/self/cgroup.

https://github.com/xemul/criu/issues/28

v2: ',' is used to separate controllers

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Reported-by: Ross Boucher <boucher@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:46:10 +03:00
Cyrill Gorcunov
5db3f4c337 mount: Add LOG_PREFIX
It's very convenient to grep the log for mount related operations only.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:41:20 +03:00
Cyrill Gorcunov
6632b2a4fc criu: Require @fd argument for "swrk" mode
Otherwise we hit nil dereference.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-16 15:40:31 +03:00