* 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>
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>
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>
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>
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>
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>
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>
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>
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>
"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>
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>
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.
Currently CRIU can not restore this test case correctly.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The system call open can add O_LARGEFILE.
A point is reopend for unsharing a file descriptor. So here are two
types of points. One is returned by pipe() and all other ones are
got via opening /proc/PID/fd.
Currently I know only one difference between these types, it's
O_LARGEFILE.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Use decode_pointer() to convert a virtual address into a native pointer.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise we will get nil dereference in shared_fdt_prepare
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Here is updated one.
0001-ids-Make-sure-kIDs-is-present-in-image.patch
>From dee67b483f0ed1a6f81ebe95ae9bdf74d3ab2ad7 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@openvz.org>
Date: Fri, 15 Mar 2013 00:43:30 +0400
Subject: [PATCH 1/2] ids: Make sure kIDs is present in image
Otherwise yield error instead of nil dereference
if we meet a broken image.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This mode was introduced less than year ago:
commit 9883035ae7edef3ec62ad215611cb8e17d6a1a5d
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Apr 29 13:12:42 2012 -0700
pipes: add a "packetized pipe" mode for writing
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mnt_entry::fstype is a part of image ABI, thus we need
to provide some "common" encoding outside tools would
know about this field encoding.
Thus we instorduce fstype enum in .proto file and use it
in source code as well.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This patch generalizes format strings in the file page-xfer.c
to prevent format string warnings on ARM.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Actually rt_sigset_t and k_rtsigset_t are the same
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise ppage_bitmap and page_bitmap will be updated for wrong VMA
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>