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

2812 Commits

Author SHA1 Message Date
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
Pavel Emelyanov
0905bfa00f x86: Use pr_perror instead of plain perror
And add pid arg for more verbosity.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:44:34 +04:00
Pavel Emelyanov
b5dfd452cc dump: Be more specific about inability to dump 32bit tasks on x86
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:43:27 +04:00
Cyrill Gorcunov
f95d509d2e sk-unix: Don't zap error returned
If error happened during queue read don't zap it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 13:39:14 +04:00
Pavel Emelyanov
421d46f79e pages: Accept pages images from versions v0.4 and below
After reworkring the way pagemap is stored the backward compatibility
was not preserved for patches simplicity. Time to return it back.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 13:12:02 +04:00
Pavel Emelyanov
18242f8319 seize: Warn if crtools tried to seize self
That's not allowed by kernel, but having explicit message is nice.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 01:10:56 +04:00
Pavel Emelyanov
21cf5d2e4c help: Sanitize special resources options
* remove obsoleted --namespaces
* use macro for ext socket option name in help text

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 22:18:16 +04:00
Pavel Emelyanov
b6fa2b31a7 ptrace: Be more verbose on seize failure
The ptrace seize may fail for various reasons. E.g. -- no enough perms
to get the ptrace access to the tasks, or various selinux restrictions.

Print what exactly has happened when ptrace failed.

Reported-by: Kevin Wilson <wkevils@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 22:03:15 +04:00
Pavel Emelyanov
7571ff69e1 collect: Properly report tasks collecting error
When we've failed to seize tasks we should report this error to the caller.

Reported-by: Kevin Wilson <wkevils@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 22:02:37 +04:00
Pavel Emelyanov
118526cc0a dump: Missing \n in pr_err message.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:49:18 +04:00
Cyrill Gorcunov
ecbe4883dc netlink: Don't signify error code
The netlink layer reports negative error code so no need to
signify it.

[xemul: This is what we do for the rest of the nlk code.]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:40:44 +04:00
Pavel Emelyanov
6b8c824fcc unix: More verbose output on ext unix socket dumping.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:38:25 +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
Pavel Emelyanov
f52d53c585 unix: Make more descriptive error logging for ext socket restore failure
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:32:53 +04:00
Pavel Emelyanov
21c663dc01 dump: Use pr_err when reporting error about locks in use and no -l option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:27:43 +04:00
Cyrill Gorcunov
a73259522b mount: Add missing \n in cr_pivot_root message
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:23:17 +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
282aaf2cba zdtm: add a test case for netlink sockets
* create two bound socket (for unicase and broadcase messages),
  a connected socket, an unbound and unconnected socket.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:24:30 +04:00
Andrey Vagin
04f8a1a53e sockets: restore netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:24:00 +04:00
Andrey Vagin
b9e6a27c3d sockets: dump netlink sockets
All info about bound sockets are got via socket diag interface.
All connected sockets are automatically bound.
For other sockets only protocol must be dumped, which is got
with help getsockopt.

A netlink sockets with pending data are not supported yet and
probably will not be supported in a near future.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:59 +04:00
Andrey Vagin
b17c9f64c5 sockets: use socket diag for collecting netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:14 +04:00
Andrey Vagin
47b9c69f26 crtools: add netlink_diag.h
This header is taken from kernel sources.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:13 +04:00
Andrey Vagin
dda97cf711 crtools: add constants for a netlink image
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:11 +04:00
Andrey Vagin
1eb24a0ae2 crtools: add a function for showing netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:22:47 +04:00
Andrey Vagin
149a5a5e5a protobuf: add image for netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:22:46 +04:00
Alexander Kartashov
803cb95efc arm: added architecture-specific implementation of __cr_restore_rt
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:16 +04:00
Alexander Kartashov
f904bc116a arm: added the descriptions of the syscalls pread64, rt_sigqueueinfo, signalfd4, rt_tgsigqueueinfo
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:13 +04:00
Andrey Vagin
07a1a33fd6 zdtm.sh: add static/sigpending in the default set
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:12 +04:00
Andrey Vagin
bc3089983a restore: collect signals from zombies (v4)
Each zombie sends SIGCHLD to parent. crtools restores all pending
signals, so all other signals should be collected.

Here is a problems, that signals SIGCHLD can be merged, but crtools
should be sure, that all signals are collected.

For that a zombie locks a global zombie_lock, which is released by
parent.

This operation should be done between CR_STATE_RESTORE and
CR_STATE_RESTORE_SIGCHLD.

Here is one more CR_STATE_RESTORE_ZOMBIES, whic is used for waiting all
zombies.

v2: clean up
v3: rework synchronization
v4: rework without additional CR_STATE-s

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:10 +04:00
Andrey Vagin
c2b081102b restore: read core.img before forking to know a child state
It's necessary to get a number of zombies.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:41 +04:00
Andrey Vagin
9af6770279 restore: set up correct sa_restorer for SIGCHLD handler (v3)
Alexander, could you help me with ARM? I found in glibc sources, that
sa_restoer should look like this:

ports/sysdeps/unix/sysv/linux/arm/sigrestorer.S
....
ENTRY(__cr_restore_rt)
        CFI
        mov     r7, $SYS_ify(rt_sigreturn)
        swi     0x0
        .fnend
END(__cr_restore_rt)

v2: Move architecture-dependent code in the proper place
v3: Don't add a separate handler for collecting zombies

Cc: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:40 +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
Andrey Vagin
7a8729fff5 crtools: restore pending signals (v4)
Read siginfo-s from images and send them to itself by sigqueueinfo.

Thread signals cannot be restored in restore_thread_common, because
it blocks SIGCHLD, which used for error detecting.

v2: Don't remap task_args and thread_args
v3: fix error handling
v4: cosmetic clean up

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:38 +04:00
Andrey Vagin
ab65ba0afd crtools: dump pending signals (v4)
PTRACE_PEEKSIGINFO is used for received pending signals,
then all signal are sent back and saved in a image.

v2: rework according with the new kernel interface
v3: rework according with the newrest kernel interface
v4: fix error handling

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:37 +04:00
Andrey Vagin
84176c0805 crtools: add image contants for pending signals (v2)
v2: rename images

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:36 +04:00
Andrey Vagin
6e528bd1bc crtools: add a callback to show signal=*.img
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:34 +04:00
Andrey Vagin
187e1617a8 protobuf: add a new description for saving siginfo-s
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:33 +04:00
Andrey Vagin
13e9291b51 zdtm: add a test case for pending signals
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:30 +04:00
Cyrill Gorcunov
be2773660b restore: Validate page address in restore_priv_vma_content
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 17:43:07 +04:00
Cyrill Gorcunov
b6f7d4a605 files-reg: Print file name on error
In case if there some error happened better to
know which exactly file failed on open, for example

 | Error (files-reg.c:535): Can't open file /lib64/libgcc_s-4.4.7-20120601.so.1 on restore: No such file or directory

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 17:41:47 +04:00
Cyrill Gorcunov
2eeb36647e pstree: Add more debug output for prepare_pstree_kobj_ids
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 14:49:44 +04:00
Cyrill Gorcunov
41192bbb33 restore: Return error instead of BUG_ON on image corruption
In case if there image corruption and page entry addres
is invalid -- exit out gracefully instead of BUG_ON hammer.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 14:48:55 +04:00