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

64 Commits

Author SHA1 Message Date
Pavel Emelyanov
19a76494a9 kerndat: Collect all global variables on one struct
Not to spoil the global namespace and unify the kerndat
data names.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:14:53 +04:00
Andrey Vagin
5f13a31e9d check: return non-zero code if PR_SET_MM_MAP is unsupported
We do the same for other features.

Here is an exception in case of the --ms option.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-10 09:35:19 +04:00
Cyrill Gorcunov
c2cae35870 prctl: check -- Try new interface as well
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-27 21:25:36 +04:00
Andrey Vagin
8764e7450c check: make check_ptrace_peeksiginfo and check_sigqueuinfo as static
They are not used outside.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-14 10:50:54 +04:00
Pavel Emelyanov
3c7d01f6a7 net: Pre-create nl diag sk
The setns() syscall (called by switch_ns()) can be extremely
slow. If we call it two or more times from the same task the
kernel will synchonously go on a very slow routine called
synchronize_rcu() trying to put a reference on old namespaces.

To avoid doing this more than once I propose to create all
per-ns sockets in one place with one setns call. In this
patch there's on nl diag socket used to collect other sockets
is created this way.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-01 13:34:29 +04:00
Andrey Vagin
33c75d0df9 eventpoll: parse_fdinfo_pid_s() returns allocated object for eventpol tfd
We are going to collect all objects in a list and write them into
the eventpoll image. The eventpoll tfd image will be depricated.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-02 16:08:17 +04:00
Andrey Vagin
7079bb1086 fsnotify: parse_fdinfo_pid_s() returns allocated object for inotify wd (v2)
We are going to collect all objects in a list and write them into
the inotify image. The inotify wd image will be depricated.

v2: cb() must always free an entry
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-02 16:07:43 +04:00
Cyrill Gorcunov
7158448dd6 timerfd: Implement check routine
Reported-by: Jenkins
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-07 10:18:09 +04:00
Pavel Emelyanov
3659d60ab7 restore: Open /proc/sys/kernel/ns_last_pid via helpers
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-06-09 15:29:49 +04:00
Andrey Vagin
74c0e9e201 check: skip mnt_id support check for mainstream kernels (v2)
v2: s/tun/mnt_id
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-25 13:22:43 +04:00
Andrey Vagin
85569e8dd4 mount: prevent dumping nested mount namespace without mnt_id in fdinfo
When we don't know mnt_id, we don't know to which namespace a file
belongs.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:27 +04:00
Andrey Vagin
8620912d22 check: check the mnt_id field in fdinfo
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:26 +04:00
Andrey Vagin
2f4be997b6 mount: use per-namespace mntinfo_tree (v2)
This patch removes the global mntinfo_tree and collect_mount_info where
it was constructed. The mntinfo list is filled from dump_mnt_ns,
rst_collect_local_mntns, collect_mnt_namespaces and read_mnt_ns_img.

A mountinfo entry contains a reference on a proper ns_id entry, so
we cau use mnt_id to look up a proper mount namespace.

v2: remove trash after rebasing.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:19 +04:00
Andrey Vagin
b6d3314c54 check: collect mounts of the current mntns
They are used for collecting unix sockets

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:04 +04:00
Andrey Vagin
de4326a382 mount: return descriptor from mntns_collect_root
We are going to support nested mount namespaces, so files can be opened
from more than one namespace and a root must be collect for each file.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:39:32 +04:00
Pavel Emelyanov
f3222f746e check: Collect mount infos before checking
We might need to resolve socket paths, which
will require mount infos tree collected.

Reported-by: Neal Becker <ndbecker2@gmail.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-04 23:45:09 +04:00
Kir Kolyshkin
b11f24fd5d criu check: don't run as non-root
In case criu check is run as non-root, a lot of information is printed
to a user, with the only missing bit is it should run it as root.

Fix it.

I still don't like the fact that some other stuff is printed here,
like the timestamp and the __FILE__:__LINE__, but this should be
fixed separately.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-13 13:58:45 +04:00
Cyrill Gorcunov
ed20cef6a0 headers: Move prctl constants to prctl.h
Move prctl constants into own header. They are
arch independent.

The x86 specific ARCH_SET_GS should be fetched from <asm/prctl.h>
(instead of defining own ones).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:19:43 +04:00
Pavel Emelyanov
7097b5358a check: Soft-dirty support is upstream since v3.11
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-03 14:21:11 +04:00
Pavel Emelyanov
c2b7800740 check: Add tun support
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 19:18:47 +04:00
Pavel Emelyanov
72ec39f10c util: Rename pie's util-net.c into util.c
Will put more things there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-29 12:43:30 +04:00
Andrey Vagin
206187dbd4 check: check PTRACE_{GET,SET}SIGMASK
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 17:24:16 +04:00
Pavel Emelyanov
ca6c026a31 check: Netlink diag and peek-siginfo is in 3.10 already
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 18:24:24 +04:00
Pavel Emelyanov
1f5acc0242 check: Check that /proc/PID/timers file is here
It's required to get support for posix cpu timers and
it has appeared in v3.10

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 16:23:51 +04:00
Pavel Emelyanov
39ec482c15 cr: Fix permissions on several files
cr-check.c for some reason got x bit O_o

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-15 17:50:57 +04:00
Libo Chen
ab4338576c cr-check: potential fd leak in check_fdinfo_inotify
Without this patch, ifd will leak when inotify_add_watch fail.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:49:44 +04:00
Libo Chen
61d852e75c cr-check: potential fd leak in check_fdinfo_eventpoll
Without this patch, fd will leak when epoll_create fail!

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:49:43 +04:00
Libo Chen
69ca9aff1e cr-check: fix pipe fd leak
fix fdinfo leak.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:11:32 +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
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
Cyrill Gorcunov
7c02f65b98 check: Drop \n from pr_perror
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-10 00:55:24 +04:00
Andrey Vagin
5d244ca1bd cr-check: don't forget close a test socket
CID 996206 (#3 of 3): Resource leak (RESOURCE_LEAK)
8. 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-05 08:19:05 +04:00
Pavel Emelyanov
fd5bcbe733 check: More verbose messages when sock diag infratructure is missing.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:36:26 +04:00
Cyrill Gorcunov
e14d39abfa check: Return -1 on error
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:22:15 +04:00
Andrey Vagin
f5e8e1c7da check: check PTRACE_PEEKSIGINFO and sigqueueinfo with positive si_code (v2)
v2: fix indentations.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:39 +04:00
Cyrill Gorcunov
b8ebb4d260 check: Check for pipe return value in check_unaligned_vmsplice
| cr-check.c: In function ‘check_unaligned_vmsplice’:
| cr-check.c:372:2: error: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-22 15:56:50 +04:00
Andrey Vagin
ef4783a646 check: Check for ability to get tcp timestamp
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-14 20:27:55 +04:00
Pavel Emelyanov
fa35517082 check: Check for SO_BINDTODEVICE is get-able
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 16:35:58 +03:00
Stanislav Kinsbursky
03791bc2c3 ipc: add check for new IPC sysctls
This patch adds check for "/proc/sys/kernel/sem_next_id" to make sure, that
kernel supports restore of IPC objects.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-30 20:11:18 +04:00
Andrey Vagin
13a7498c2a crtools: add EOL to error messages
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-23 16:43:33 +04:00
Pavel Emelyanov
23bf4faa0d check: Set error log level before checking
Not to spoil screen with false warnings.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-12 17:04:24 +03:00
Pavel Emelyanov
64a4c40083 check: Check for ability to get socket filter
This is required to work with tcpdump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 16:07:56 +03:00
Cyrill Gorcunov
d5dfab7745 check: Add check_tty
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 20:00:56 +04:00
Cyrill Gorcunov
bf94ff3a26 check: Don't forget to init mountns
Otherwise fstatat fails as

> > $ ./crtools check
> > Error (sk-unix.c: 283): Can't stat socket 12547 (./var/run/sdp): Bad file descriptor

Reported-by: "Muralidhar, Rajeev D" <rajeev.d.muralidhar@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:04:14 +04:00
Andrey Vagin
796d4ceb95 socket: switch netns for collecting sockets
All sockets should be collected in a target net name-space when the -n net
is specified.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 13:12:43 +04:00
Pavel Emelyanov
da2d59a2e7 signalfd: Checking code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-02 12:27:45 +04:00
Pavel Emelyanov
9fc1d6bbeb fdinfo: Make fdinfo.type be an enum
This types specifies a strict set of what is hidden behind
the fd. Thus these numbers should be in the description of
the fdinfo message.

Plus protobuf makes shure nothing else will be there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 10:18:37 +04:00
Pavel Emelyanov
237ef3c809 pipe: Rework pipe data restore to use vmsplice
This serves two things -- kills annoying data offset management
which makes protobuf switch too ugly. And removes the need to
seek the pipe data image, which in turn is the prerequisity for
streaming migration.

Memory usage is still optimal, since we still use splice on dump
path and on restore stage we F_GIFT pipe buffers to the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 06:57:20 +04:00
Pavel Emelyanov
76638fd5c3 check: Add check for inotify is shown proerly in fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 10:26:46 +04:00