2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 21:07:43 +00:00

34 Commits

Author SHA1 Message Date
Andrey Vagin
834d996b91 crtools: add a separate type for atomic variables
It's a struct to prevent using usual arithmetic operations.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-11 17:55:15 +04:00
Cyrill Gorcunov
c9f7112595 types: Add ASSIGN_MEMBER helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-05 19:57:52 +04:00
Pavel Emelyanov
64149b40f2 code: A little but more checkpatch fixes over code
There are more in test/ (and checkpatch.pl crashes in the middle =),
but seem to be all.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:19:34 +04:00
Pavel Emelyanov
9efd12f2c7 code: Remove trailing whitespaces over .c and .h files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:34:35 +04:00
Cyrill Gorcunov
2738fae816 types: Add PAGE_MASK
Will need it for pipes data dumping.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:42 +04:00
Cyrill Gorcunov
bff52ba952 inotify: Add checkpoint/restore v2
v2:
 - open_mount is cleaned up
 - byte-stream hex conversion remains untouched since
   strtol is flipping numbers to LE manner

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 14:00:45 +04:00
Cyrill Gorcunov
6670d294fb prctl: Update PR_GET_TID_ADDR definition
To reflect the change in kernel v3.4-rc4
update PR_GET_TID_ADDR and rename it to
PR_GET_TID_ADDRESS as it named in kernel.

[xemul: this fixes futex test broken with 3.4 rebase]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 00:54:48 +04:00
Pavel Emelyanov
9a2d2a6990 fown: Fix compilation for older distros
Some of them (FC12 I debug on) doesn't have fown_ex stuff in their
libc. Add the missing declarations.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-25 21:36:43 +04:00
Cyrill Gorcunov
d29f3bc02f types: Add F_GETOWNER_UIDS opcode
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-12 12:27:54 +04:00
Cyrill Gorcunov
ee82f0cf0e types: Add SCM limits
We will need them in file descriptors transfer addressed in further patches.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-29 15:14:10 +04:00
Cyrill Gorcunov
cff00de82d syscalls: Introduce sys_kcmp syscall
Though we can use libc's syscall() wrapper
I would prefer to have own implementation
in case if we will need it in non-libc bindable
code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-28 19:13:46 +04:00
Andrey Vagin
62ba357e4d dump: use prctl to dump clear_tid_address
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-22 15:06:51 +04:00
Pavel Emelyanov
097bc0b967 dump: Collect mem+regs+sigmask atomically
The ptrace seize doesn't prevent signals from delivery. That said,
we should block the signals in the target task before dumping
anything which is signals-related, i.e. memory and registers.

But once we've blocked signals, we should dump registers before
unblocking them, since any postponed signal will screw things up.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-20 12:33:43 +04:00
Kir Kolyshkin
7c961a7b8f include/types.h cleanup: remove *_FILENO
These defines are already provided by unistd.h, and the only user
is log.c which already includes unistd.h.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-14 21:16:00 +04:00
Cyrill Gorcunov
76a249282e restore: Add checkpoint/restore for /proc/pid/exe symlink
This patch adds ability to checkpoint/restore
/proc/pid/exe symlink, so if a process we've just
checkpointed has been say /path/to/exe, then at restore
time we bring this path back.

There some restiction from kernel side: if
existing /proc/pid/exe already mapped more than
once, the kernel will refuse to change the symlink,
so we need to restore it lately when mmaps of crtools
itself already unmapped (ie via late call in
restorer.c).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-07 20:08:01 +04:00
Pavel Emelyanov
d846d108f6 syscalls: Prepare syscalls and bits for (mostly) setting creds
These are setXXXid, capset and various bits for prctl and caps machinery.
The thing is that the caps API is not yet fully in glibc so we have to
declare some bits even for core code, not just for restorer/parasite.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-30 13:00:33 +04:00
Cyrill Gorcunov
0008148686 restore: Restore cmdline arguments, envirion and auxv restore
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-24 18:01:08 +04:00
Andrey Vagin
1dd20b087a restore: detect that someone failed (v2)
Handle SIGCHLD and if someone failed, nr_in_progress is set to -1.
If crtools notices that nr_in_progress is negative, it kills all
tasks.

v2: * Use named constants for task_entries->start in restorer.c
    * Use SA_NOCLDWAIT when setting sigchild handler,
      this makes sigchild handler simpler.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Cyrill Gorcunov
ff954f655f dump: Drop unneeded #includes
This as well forces to move ptrace
definitions into ptrace.h, otherwise
freshly fetched kernel headers become
conflict with existing ptrace constants.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:18:17 +04:00
Cyrill Gorcunov
92efe1921a types: Drop user_regs_struct_t for x86-32
We don't support x86-32 yet so no need to
carry this declaration, it's only confusing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 22:20:42 +04:00
Andrey Vagin
e57a4c2945 Use stderr for debug messages (v2)
Many programs use stdout for transferring data.

v2: remove debug code

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-05 12:01:23 +04:00
Cyrill Gorcunov
53c611b630 dump,restore: Use rt_sigaction_t for sys_sigaction
Since we operate with syscalls directly we are
to convert signal's structures between image and
kernel formats, without intermediate glibc layer.

Note this involves chaging sa_entry::flags to u64
(since it's long int value in kernel).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-03 17:24:05 +04:00
Cyrill Gorcunov
2907bb2258 Move rt_sigset_t to include/types.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 23:03:03 +04:00
Andrey Vagin
04f36aed0a Set descriptors to restart a current syscall
If a task is sleep in syscall, it should be restared.
This logic is moved from kernel do_signal().

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 17:50:55 +04:00
Andrey Vagin
25434884e1 Dump and restore sigactions (v2)
A parasite code dumps all sigactions in sigact.pid.

v2: remove hard code for sizeof(sigset_t)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-11-30 22:04:09 +04:00
Cyrill Gorcunov
b38205f580 Update PR_ opcodes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 16:47:36 +04:00
Cyrill Gorcunov
b06349fc49 prctl: Rename PR_ entries
Tejun Heo proposed to use more general names
unrelated to checkpoint-restore procedure.

So be it (maybe someone else will need this
entries as well).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-21 12:54:14 +04:00
Cyrill Gorcunov
777dc994aa types: PTRACE_SEIZE and PTRACE_INTERRUPT already defined in ptrace.h
On linux-3.1.1 (fc16) these constants already defined in system
ptrace.h

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-20 10:31:16 +04:00
Cyrill Gorcunov
d9aa7f021c restore: Add mutexes via futex syscall and order threads creation
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-18 16:09:01 +04:00
Cyrill Gorcunov
566a900e4e restore: Use prctl for vDSO restoration
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 17:53:47 +04:00
Cyrill Gorcunov
da8f61c1c8 dump: Add GS-TLS handling
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 17:44:00 +04:00
Cyrill Gorcunov
8a8850d146 dump: Dump TLS via sys_arch_prctl
As such -- no need for kernel patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 16:29:36 +04:00
Cyrill Gorcunov
d6e7afe3d8 syscalls: Add sys_set/get_thread_area helpers
They are actually banned in kernel for now, but
we might end up needing them, so better to have
them in-place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 14:47:04 +04:00
Cyrill Gorcunov
523de23624 Initial commit
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-09-23 12:00:45 +04:00