2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00
Commit Graph

2853 Commits

Author SHA1 Message Date
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
Cyrill Gorcunov
f81d009af8 restore: Add debug info on premapped VMA address
| Map 0x0000000000400000-0x00000000004a5000 0x0000000000000000 vma
| 	premap 0x0000000000400000-0x00000000004a5000 -> 00007f26eb898000

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 14:48:31 +04:00
Cyrill Gorcunov
6140f67326 util: Use read_fd_link helper in is_anon_link_type
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:45:45 +04:00
Cyrill Gorcunov
03040be51e protobuf: Print the image filename on error
For example

 | Error (protobuf.c:574): Unexpected EOF on /home/crtools/tools/cpt2/test/out/utsns-1.img

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:45:44 +04:00
Cyrill Gorcunov
401b4b89f1 util: Add read_fd_link helper
To fetch name of file opened from procfs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:45:44 +04:00
Cyrill Gorcunov
b7960d7716 restore: Update error message in map_private_vma
"Can't fixup VMA's fd" is more understandable than plain
"Can't fixup fd".

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:44:33 +04:00
Cyrill Gorcunov
31122183d2 file: More detailed error on cwd restore
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:44:26 +04:00
Cyrill Gorcunov
5b8ee16c5f files: Fix id print format
Otherwise

| (00.013475)      1: Collect fdinfo pid=626 fd=4 id=0x           17008

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-21 00:43:45 +04:00
Andrey Vagin
3736fcf9f1 pipes: fix error handling
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-19 23:54:41 +04:00
Andrey Vagin
967ca651a8 tty: restore sid on master points only (v2)
If a master point has sid, it doesn't mean, that all slave points
will have sid. Look at tty03 for example:

  PID   SID TT       COMMAND
26748 26748 ?        tty03
26749 26749 pts/2     \_ tty03
26750 26750 ?             \_ tty03

The second process has not a file descriptor for the ctl tty,
but this tty is opened in tty03.

v2: If a slave point with sid has not a master point, the option
--shell-job must be set and sid isn't restored for such terminals.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-19 23:01:51 +04:00