Commit graph

3572 commits

Author SHA1 Message Date
Andrey Vagin
08abebd29c crtools: remove extra headers from headers
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:17:45 +04:00
Andrey Vagin
2082e8faf0 crtools: don't include crtools.h in other headers
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:17:38 +04:00
Andrey Vagin
a5cb58817d crtools: include sys/time.h in parasite.h
This patch fixes an error:
In file included from mem.c:10:0:
include/parasite.h:116:19: error: field ‘real’ has incomplete type
include/parasite.h:117:19: error: field ‘virt’ has incomplete type
include/parasite.h:118:19: error: field ‘prof’ has incomplete type

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 16:41:45 +04:00
Pavel Emelyanov
c6fab95e85 hdrs: Don't include protobuf headers into crtools.h
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:44:32 +04:00
Andrey Vagin
0ef2128309 crtools: don't include cr-show.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:14 +04:00
Andrey Vagin
1cb945cafe crtools: don't include util.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:12 +04:00
Andrey Vagin
f41255f00b crtools: don't include lock.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:10 +04:00
Andrey Vagin
07fc6cf394 crtools: don't include image.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:09 +04:00
Andrey Vagin
4cb211c094 don't include crtools.h in pstree.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:07 +04:00
Andrey Vagin
a6c422f6e3 crtools: include list.h in vma.h
This patch fixes compilation error on arm:
In file included from arch/arm/vdso-pie.c:4:0:
include/vma.h:5:19: error: field ‘h’ has incomplete type
include/vma.h:14:19: error: field ‘list’ has incomplete type

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:33:40 +04:00
Andrey Vagin
1300cf4915 crtools: move all stuff about fdset in a separate header
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:24:48 +04:00
Andrey Vagin
e85e5fdb86 crtools: don't include pstree.h in parasite-syscall.h
pstree and parasite are two different subsystems, so it "should" not
depend on each other.

parasite-syscall uses the pid struct, so this patch moves it in a
separate header.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:24:17 +04:00
Andrey Vagin
96cc00767b crtools: move CR_PARENT_LINK to image.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:44:19 +04:00
Andrey Vagin
0d1dfc2e08 crtools: move all stuff about vma together
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:43:49 +04:00
Andrey Vagin
824403a009 crtools: create new header for servicefd stuff (v2)
v2: generate patch relative to the official git.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:43:02 +04:00
Andrey Vagin
9826d2dd04 crtools: don't include pstree.h in namespaces.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:39:50 +04:00
Andrey Vagin
82cd9e2c66 parasite: don't include restorer.h in parasite-syscall.c
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:39:36 +04:00
Andrey Vagin
924acd8450 shmem: don't include restorer.h in shmem.c
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:38:43 +04:00
Andrey Vagin
a6edbcf669 crtools: don't include restorer.h in proc_parse.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:37:55 +04:00
Andrey Vagin
565eb01346 sigframe: don't include restorer.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:37:38 +04:00
Andrey Vagin
7c8e987e5d paraiste: don't include vdso.h in parasite-syscall.c
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:37:24 +04:00
Andrey Vagin
7dfea8a767 parasite: stack must be initialized by highest address
Stack grows down on x86 and ARM

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Alexander Kartashov <alekskartashov@parallels.com>:
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:33:47 +04:00
Pavel Emelyanov
ba0527d42b restore: Remove actually unused variable from sigreturn_restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-04 00:16:34 +04:00
Pavel Emelyanov
32b4a26c6b restore: Comment why we need copy data on task restore args
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-04 00:16:14 +04:00
Pavel Emelyanov
ebd76f4bec restore: Move sigpending out of sigreturn_restore
The sigreturn_restore is the place when we prepare the restorer
layout and jump to it. Reading and decoding images should be done
earlier. The new rst-malloc engine allows for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-04 00:15:39 +04:00
Pavel Emelyanov
91f797f66f restore: Move posix-timers out of sigreturn_restore
The sigreturn_restore is the place when we prepare the restorer
layout and jump to it. Reading and decoding images should be done
earlier. The new rst-malloc engine allows for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-04 00:15:15 +04:00
Pavel Emelyanov
ed88f2df66 restore: Move rlimits out of sigreturn_restore
The sigreturn_restore is the place when we prepare the restorer
layout and jump to it. Reading and decoding images should be done
earlier. The new rst-malloc engine allows for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-04 00:14:42 +04:00
Pavel Emelyanov
4f675313cc rst-malloc: Switch to private allocations once forked
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-03 17:40:15 +04:00
Pavel Emelyanov
ca0b51bc00 rst: Close logdir earlier
Just a code sanitation.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-03 17:37:10 +04:00
Pavel Emelyanov
3e235f715e restore: Get self maps after allocating necessary memory
We're filling some rst-mem data _after_ we get the self maps
list. This is a bug, since the restorer vma get forcedly mapped
into a place we get out of self-vmas-list.

Move the self-vmas-list getting after we allocate the memory
we need.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-03 17:23:31 +04:00
Ruslan Kuprieiev
95a961b739 log: don't kill task, if unable to write pidfile
write_pidfile() was taken out from cr-restore.c, where it was supposed to kill
child if unable to create pidfile. Now we're also using it at service/page-server where kill is redundant. So lets take out kill() from write_pidfile() back to cr-restore.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-03 12:51:13 +04:00
Pavel Emelyanov
45f39e0415 rst: Make shmem restore to use rst-malloc
This actually fixes a bug -- memory for shmem info was
not allocated dynamically, thus we were limited in the
amount of shmems to be restored.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-02 01:06:31 +04:00
Pavel Emelyanov
7ed35d8a87 rst: Switch private rst-mem allocator on generic rst-malloc
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-02 01:05:13 +04:00
Pavel Emelyanov
297360ef7d rst: Switch shmalloc allocator to use rst-malloc
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-02 01:04:07 +04:00
Pavel Emelyanov
c9aaf9f3c4 rst: Introduce an engine to allocate memory on restore
On restore we need differetn types of memory allocation.
Here's an engine that tries to generalize them all. The
main difference is in how the buffer with objects is being
grown up.

There are 3 types of memory allocations:

1. shared memory -- objects, that will be used by all criu
   children, but will not reach the restorer
2. shared remapable -- the same, but restorer would need
   access to them, i.e. -- buffer with objects will get
   remapped into restorer
3. private -- the same, but allocatedby each task for itself

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-02 01:01:48 +04:00
Igor Sukhih
647207714a util: Update kdev_to_odev to respect BITS_PER_LONG
Depending on BITS_PER_LONG userspace representation of dev_t
may vary, so we need to choose proper encoding.

Signed-off-by: Igor Sukhih <igor@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 17:40:54 +04:00
Ruslan Kuprieiev
59c43e481e v3 service: SIGCHLD handler
Hi!

Now we're ignoring SIGCHLD from forked children.
This patch provides SIGCHLD handler, that will wait for child and write some
information about it's exit status to logfile.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:32:03 +04:00
Cyrill Gorcunov
c60c91f3d7 docs: Add 'service' command description
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:29:12 +04:00
Alexander Kartashov
0720fe3de7 Documnetation: added the HOWTO on cross-compilation
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:40 +04:00
Alexander Kartashov
55dda405d4 arm: kill fpu_state_t
It has been a mistake to introduce this struct since the FPU state
is stored deep inside an ARM sigframe. A remnant of the struct
is left to make the code compatible with the universal declaration
of the routine sigreturn_prep_fpu_frame().

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:34 +04:00
Alexander Kartashov
a5752177f4 arm: initialize the ARM VFP header in the routine restore_fpu()
The ARM VFP header is a part of the VFP frame that makes
it unreasonable to have frame initialization split into
two routines. This patch moerges the ARM version of
the routine sigreturn_prep_fpu_frame() into restore_fpu()
and reduces the former into a stub.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:28 +04:00
Alexander Kartashov
5a63215bc8 arm: restore the VFP sigframe field fpscr properly
The routine restore_fpu() contains two bugs:

1) it reads more bytes from the array ThreadInfoArm::fpstate::vfp_regs
   than it actually containes;

2) the value of the field ThreadInfoArm::fpstate::fpscr is dropped
   on the floor.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:22 +04:00
Alexander Kartashov
e89af96d62 arm: fixed AArch64 syscall numbers
It turned out that AArch64 uses the UAPI syscall numbering scheme
that is incompatible with x86. Unfortunately this kills the idea
of the unified syscall table and syscall generator.

Note that the following syscalls:

* open,
* mkdir,
* rmdir,
* unlink,

are declared obsolete in the UAPI. Moreover the syscall arch_prctl
doesn't exist in the UAPI.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:16 +04:00
Alexander Kartashov
9af8d94901 cr: identify LDARCH and ARCH by default
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:27:07 +04:00
Alexander Kartashov
be2f08eda0 sigframe: introduced the macros to access the FPU state
An fpu_state_t instance shouldn't be stored in an ARM sigframe
that makes it necessary to generalize the way the FPU state is
accessed in the routine construct_sigframe()

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:26:58 +04:00
Alexander Kartashov
03a9c6b0b7 parasite-syscall: use the ptrace requests PTRACE_(GET|SET)REGSET to retrieve and set CPU registers
This patch introduces the routines ptrace_get_gpregs() and ptrace_set_gpregs()
that wrap the ptrace interface to get and set CPU registers respectively.
The motivation is to make the CRIU code be compatible with architectures that
don't support the PTRACE_GETREGS and PTRACE_SETREGS ptrace calls ---
the requests PTRACE_GETREGSET and PTRACE_SETREGSET are implemented instead.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:26:27 +04:00
Pavel Emelyanov
c2a366d44d ptrace: Introduce get/set regs helpers
Required for simpler next patching.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 14:23:32 +04:00
Cyrill Gorcunov
c1c9b8f6dc docs: Document -R|--leave-running option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 13:36:12 +04:00
Cyrill Gorcunov
fcfa58026c dump: Don't forget to cleanup link remap if needed
In case if checkpoint is failed or -R option passed
we need to remove link remap files created during
dump procedure.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 13:36:07 +04:00
Cyrill Gorcunov
7fe6220883 dump: Unlock network if -R option passed
It's been found that if -R (leave task running after checkpoint)
option passed we don't unlock network, nether we clean service
files (such as link remaps).

After a long discussion we choose the following path: if -R option
is passed, it means a user is quite confident in what he is doing
and consistency of the resources (file system) is achieved by
a user himself with help of post-dump script. Also a user knows
that the network will be unlocked and accept such case.

So here we check of -R being passed in command line and once
checkpoint complete we unlock the network.

Cleaning up of link remaps is addressed in another patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-01 13:35:48 +04:00