2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Commit Graph

2853 Commits

Author SHA1 Message Date
Andrey Vagin
f238d56661 make: allow to change a compiler
clang-analyzer sets the environment variable CC
scan-build -plist-html --use-analyzer /usr/bin/clang make

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:19 +04:00
Pavel Emelyanov
75d8b81fd1 ipc: Check for IPC namespace to be dumped when such mapping is
If any task has a sysvipc mapping we should make sure, that the
ipc namespace is dumped as well. Otherwise after restore the task
will die.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 13:09:59 +04:00
Pavel Emelyanov
09ebdd4534 sockets: Make crtools check report error when DIAG is incomplete
Absense of packet and netlink diag is OK at dump -- we can be on
older kernel and will fail later if _really_ need these sockets.

During check stage all diag is expected to be in place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 13:08:28 +04:00
Pavel Emelyanov
7bdba0f745 unix: Add _all_ peers into must-dump list
When dumping a unix socket we must make sure, that all connections
are dumped or -x option is used. Currently only peers with non-matching
ids are added into check. Fix this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 23:27:45 +04:00
Cyrill Gorcunov
6a0f92577c headers: util.h -- Move memory helpers to xmalloc.h
To reuse them outside of crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 21:15:27 +04:00
Cyrill Gorcunov
6971b8effc headers: types.h -- Move uX types to int.h header
This allows to use it in external projects outside of
types.h header, moreover it's close to what kernel
does too.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:31:51 +04:00
Cyrill Gorcunov
7aae1934d3 headers: types.h -- Move BITS_PER_LONG to own header
This diet types.h and allows to include BITS_PER_LONG
only where really needed. It makes BITS_PER_LONG definition
close to one used in kernel.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:31:41 +04:00
Cyrill Gorcunov
0109ea2bdb headers: types.h -- Rename BITS_PER_ULONG to BITS_PER_LONG
Lets stick to names used in kernel.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:29:32 +04:00
Cyrill Gorcunov
3165fd7886 headers: list.h -- Add hlist helpers
hlist is suitable for hash operations so
extent list.h code. I need it for converter
and this allow me to reuse this header.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:29:25 +04:00
Cyrill Gorcunov
7db78063f8 headers: image.h -- Drop asm/types.h inclusion
This header consists of a number of constants
and a few macro helper. No need to make it
asm/types.h dependant. Instead only include
<stdbool.h> for bool definition as required
by forward fdinfo_per_id (I think this declaration
should live in somewhere else place, not sure
where yet, so I left it untouched).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:29:15 +04:00
Cyrill Gorcunov
1525447752 headers: Add err.h header
Instead of bloating util.h lets move ERR_
helpers to own err.h header. This allow
to reuse it where needed without util.h
inclusion.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:27:51 +04:00
Cyrill Gorcunov
fd3f33f5d2 headers: image.h -- Drop unused entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:27:24 +04:00
Pavel Emelyanov
a6b257f0c2 log-simple: Use buffering before output to log file
Multi-task/thread apps spoil log as simple logger does
char-by-char output.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 20:12:12 +04:00
Pavel Emelyanov
c5aa77f88b tcp: Use protobuf showing fn for tcp-stream images
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 14:18:11 +04:00
Pavel Emelyanov
63270e8d9f show: Show per-task fdinfo in -D/-p output
This info is not in per-ID file, not per-PID, so need special care.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 12:09:40 +04:00
Pavel Emelyanov
73d7e283a7 show: Filter -D output with --pid option
Show only image info relevant to given pid. Also reuse
the introduced --pid argument for exec action.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 11:58:15 +04:00
Pavel Emelyanov
6241a057b8 show: Beautify -D mode show
Print delimiters and image names for easier reading of the output.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 11:30:14 +04:00
Pavel Emelyanov
a0ce796734 show: Fix -D mode showing
Threads' IDs were not initialized on img load.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 11:21:47 +04:00
Andrey Vagin
58f0955d81 zdtm: each test file name should contain a test name
It's required for per-test cleaning.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:12:04 +04:00
Andrey Vagin
2020d3957e dump: prevent dumping if a session leader is outside of the current pidns
A parasite code returns zero sid for such cases.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:11:13 +04:00
Andrey Vagin
8eabba3d1c pstree: don't replace sid if the root task is a session leader
The root task must remain a session leader after c/r. The root task
can be executed in another pidns and the sid from another name space
will be invalid.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Reported-by: Pavel Emelyanov <xemul@parallels.com>
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-01 20:10:44 +04:00
Andrey Vagin
ddc6789dca test: don't skip errors if someone fails
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:10:05 +04:00
Andrey Vagin
1b234fd890 zdtm: show a process tree before and after c/r
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:31:14 +04:00
Andrew Vagin
cc97a2d012 zdtm: add one more test case to create a process tree (v2)
Actually this test case is a frame work for creating a process tree.
It creates a process tree according with a predefined sequence of
actions.

This test case create the following process tree:
  5     5  \_ session02               ( 0)
  6     6      \_ session02           ( 1)
  8     7      |   \_ session02       ( 3)
 15    12      |   \_ session02       (10)
 10    10      \_ session02           ( 5)
 11     7          \_ session02       ( 6)
 13    12          \_ session02       ( 8)

v2: improve log messages

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:31:12 +04:00
Cyrill Gorcunov
d7829276be pie: restorer -- Don't fail if no futex provided
The image data may have no futex provided but we have
no "optional" entry for that (because futex data is
a part of thread_core_entry message).

Still we know that futex length can't be zero thus
make it "optional" by a value -- if length is zero,
we consider it as a sign to skip.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:30:28 +04:00
James Bottomley
1b7cfe7ddd Add LGPL licence for library directory
We've received some requests to create a way to interface with crtools
that doesn't involve forking the utilities, so we're going to create a
linkable library for this.  In order to be fair, we plan to allow
proprietary code to link with this library and thus want to change the
licence of the CRIU code base to be LGPL *only* for this library
directory, preserving the rest of the code as GPL.  Because creating the
library may involve refactoring, I anticipate that some code that's
currently GPL will have to move into lib/ and become LGPL (and this may
occur in future as well), so I've amended the COPYING file to spell out
for contributors that code outside lib/ is GPL and inside lib/ is LGPL,
but that they give future permission to change the licence to GPL or
LGPL if code has to move into (or out of) lib/, based on acceptance of a
patch into the CRIU code base, so j random developer can't download the
code and make it all LGPL by applying a private patch to move everything
into lib/.

All the Parallels authors have agreed to this, but we have a couple of
non parallels ones on the cc to this email I'd like explicit acks from.

Cc: Qiang Huang <h.huangqiang@huawei.com>
Cc: Andrew Grigorev <andrew@ei-grad.ru>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Acked-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:29:06 +04:00
Andrey Vagin
5f080d64f9 sk-netlink: typo fix for unconnected netlink sockets
The netlink_diag doesn't provide any info about non-connected and
non-bound sockets.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-30 00:18:29 +04:00
Andrey Vagin
0b492b0b10 zdtm: protect random pages in maps04
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-30 00:17:36 +04:00
Andrey Vagin
6ed19e31a7 dump: unprotect vmas for dumping content
VMA-s may be protected against read, so rights for such VMA-s should be
changed for dumping and protected back after dumping.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-30 00:17:03 +04:00
Pavel Emelyanov
a6b13b386c rlim: The rlimit images should be per-pid
It's a stupid mistake which resulted in all tasks share
the rlimits on restore :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-29 19:40:23 +04:00
Andrey Vagin
aaad8054ee sk-inet: drop proto from struct inet_sk_desc
It isn't required anymore

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:20 +04:00
Andrey Vagin
d2b1d6f2aa socket: prevent dumping of sockets if they are not collected
The idea is simple. If the collection of given type of sockets failed,
crtools can't be sure, that it's able to dump such sockets correctly.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:18 +04:00
Andrey Vagin
d274025e42 util: encode and decode errno into pointer
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:17 +04:00
Andrey Vagin
6a038a1e49 sk-packet: print an error if lookup failed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:21:50 +04:00
Andrey Vagin
f9b3dd7ad5 sk-inet: fix error handling
Currently do_dump_one_inet_fd returns ret, but this variable is
overwritten a few times and it can be zero on error paths.

Use a separate variable for the function exit code. By default it is -1
and it is set to zero at the end. It's not changed anywere anywhere
except these two places.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:21:24 +04:00
Andrey Vagin
5b8f179f1b sockets: skip errors from collecting of netlink and packet sockets
The packet diag are not compiled in Fedora 19 kernel.
The netlink diag is going to be merged in 3.10.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:21:17 +04:00
Andrey Vagin
4a6ed33203 netlink: return errno from do_rtnl_req
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:21:11 +04:00
Cyrill Gorcunov
421ceffaa5 restorer: Print error code from sys_set_robust_list
Some syscalls return error code, so for easier debugging
instead of zapping it -- print it together with error
message.

And make error message more detailed as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 15:27:21 +04:00
Pavel Emelyanov
87d0d61e41 lock: Show long option in log message about using one
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 20:17:59 +04:00
Pavel Emelyanov
25ef419982 tty: More descriptive log message about --shell-job requirement
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 20:11:00 +04:00
Andrew Vagin
f16d7c64e5 mount: remove root with MS_PRIVATE before cleaning up mntns
Otherwise we will clean up the root mntns too.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 17:28:30 +04:00
Andrew Vagin
929a0f24fd mount: remove root with MS_PRIVATE before pivot_root
Otherwise if the root is mounted with MS_SHARED, pivot_root fails with EINVAL.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 17:28:27 +04:00
Pavel Emelyanov
000404adad rst: Properly check si_code of sigchild
The CLD_XXX macros are not bit fields.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 17:27:36 +04:00
Cyrill Gorcunov
78ced79e15 caps: Print error message on size mismatch
So when we fail print error thus a user would know
where exactly it failed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 16:32:46 +04:00
Pavel Emelyanov
cbf0ba9f48 inventory: Kill inventory.img file in case of failed dump
This will result in more sane error in case restore is launched
on such semi-complete images.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 16:16:25 +04:00
Pavel Emelyanov
c03a4c5801 msg: Make final dump/restore more descriptive
Currently dump silently terminates and restore emits some
meaning-less messages in either case. Make these important
messages more informative.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 16:06:26 +04:00
Andrey Vagin
c721df565a zdtm: execute sigpending and sk-netlink only on linux-cr
The functionality for dumping signals and netlink sockets are not merged
in the upstream kernel yet.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:52:43 +04:00
Andrey Vagin
27d0bbe549 sk-packet: fix error handling
lookup_socket() returns pointer or NULL.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:52:34 +04:00
Cyrill Gorcunov
e902861c08 restore: Unify exit() return code
Some exit()'s are called with exit(-1), some
are with exit(1). Use exit(1) everywhere for
consistency.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:52:20 +04:00
Cyrill Gorcunov
18db781a8e pie: Bump .got table into .crblob section
It's being noticed on arm platform the .got table
has been missed to include in .crblob section,
so fix it.

Reported-by: Chanho Park <chanho61.park@samsusng.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:52:09 +04:00