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

218 Commits

Author SHA1 Message Date
Alexander Kartashov
01c7a87988 asm: convert the ARM implementation of bit operations to the reference
The implementation of bit operations for ARM isn't actually
architecture-specific so it would rather be shared with
the upcoming port for AArch64 that won't provide optimized
implementation of bit operations.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-12 00:18:03 +04:00
Alexander Kartashov
41bd5da8f8 arm: prepare syscall table generation scripts to be shared with AArch64
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:46:06 +04:00
Alexander Kartashov
16ebfa1656 arm: parasite: implement arch_get_tls() in C
This patch should simplify the routine interface change
in the following patch.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:39:22 +04:00
Cyrill Gorcunov
9b491e5c68 x86: restore -- Allow to restore fpu even if image is incomatible with cpu state
Sometime, especially when testing, we migrate checkpointed tasks between
nodes which have different CPU capabilities. In particular some CPUs have
xsave feature while others -- do not. So to be able to continue migration
procedure even in such conditions one should specify

	--cpu-cap ^fpu

on command line which would force criu to restore FPU state ignoring extended
status present in image file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:36:43 +04:00
Cyrill Gorcunov
ad0f698055 x86: Allow forward compatibility mode for FPU
At the moment we refuse to restore if CPU mismatch
at FPU related features. Strictly speaking this is
not required.

We can allow to restore on the node with xsave capability
even if the node was created on cpu which has fxsave
capability only.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:34:31 +04:00
Cyrill Gorcunov
e252e37201 asm-generic: Introduce page.h
At the moment we are using 4K pages all the time,
so instead of copying code over all archs we're
supporting -- add asm-generic/page.h header.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:29:40 +04:00
Pavel Emelyanov
6efe3f5d10 vdso: Get pagemap entries with pread call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by:Andrew Vagin <avagin@parallels.com>
2014-02-14 16:46:41 +04:00
Pavel Emelyanov
3a3f3c79e4 vdso: Don't search for VDSO page in file mappings
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-13 17:20:08 +04:00
Christopher Covington
f69fe9aa13 Remove ARM AT_VECTOR_SIZE from x86 header
Perhaps left over from when a single types.h was being used for
multiple architectures, remove the ARM definition of
AT_VECTOR_SIZE from the x86 types.h header. Also remove the
CONFIG_ARM definition since it unused.

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-10 14:35:32 +04:00
Christopher Covington
a37b95895a Complain about missing CONFIG_ARMV*
Without this a user may encounter the following error.

arch/arm/include/asm/atomic.h:38:2: error: implicit declaration of function ‘smp_mb’

With the #error pragma a user is a least pointed to the specific
section in the file that's causing the problem

arch/arm/include/asm/atomic.h:21:2: error: #error ARM architecture version (CONFIG_ARMV*) not set or unsupported.

Acked-by: Alexander Kartashov <alekskartashov@parallels.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-10 14:34:40 +04:00
Pavel Emelyanov
eb1ae0a025 vma: Turn embeded VmaEntry on vma_area into pointer
On restore we will read all VmaEntries in one big MmEntry object,
so to avoif copying them all into vma_areas, make them be pointable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-04 11:44:01 +04:00
Pavel Emelyanov
f9c8e3a2cd pagemap: Factor out pfn retrieving for vdso and zero page
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-30 23:34:53 +04:00
Cyrill Gorcunov
e9f9fdb9b3 headers: Drop uintX_t usage
We have a mess of uintX_t and uX usage. Drop off uintX_t ones.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-12 10:03:07 +04:00
Kir Kolyshkin
26fda7a319 space-before-tab whitespace cleanup
Remove space before tab characters.

Found by git grep ' 	' (Space, Ctrl-V, Tab in shell).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-12 10:00:53 +04:00
Cyrill Gorcunov
ada7322a9c headers: Drop _LINUX_CAPABILITY
Use one provided in linux/capability.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-15 16:59:40 +04:00
Cyrill Gorcunov
ce3b4aaafa headers: Move MADV definitions to own mman.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:48:30 +04:00
Cyrill Gorcunov
8c7a62c4e6 headers: Move ERESTART codes to errno.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:22:21 +04:00
Cyrill Gorcunov
f508c0f2dd headers: Drop never used CLONE_VFORK
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:22:00 +04:00
Cyrill Gorcunov
8cca9ca7df headers: Drop never used CLONE_CHILD_USEPID
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:21:53 +04:00
Cyrill Gorcunov
35ab2de917 x86: headers -- Drop unused FS/GS_TLS
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:21:36 +04:00
Cyrill Gorcunov
d9731a92b8 headers: Drop SECURE_NO_SETUID_FIXUP definition
Take it from linux/securebits.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:21:21 +04:00
Cyrill Gorcunov
ed20cef6a0 headers: Move prctl constants to prctl.h
Move prctl constants into own header. They are
arch independent.

The x86 specific ARCH_SET_GS should be fetched from <asm/prctl.h>
(instead of defining own ones).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:19:43 +04:00
Cyrill Gorcunov
f8ddc74283 headers: Move kcmp_type to kcmp.h
It's arch independent data.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:13:59 +04:00
Cyrill Gorcunov
3f3439cd42 headers: Move fh_t to fsnotify.c
We really don't need it spread over all headers. The file
handlers are used in fsnotify only, declare it there.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:13:43 +04:00
Cyrill Gorcunov
3c8a8326af headers: Drop SCM_MAX_FD internal variable
This limit is not exported by a kernel, so no need
to "explicitly" define it pretending that it's immutable.

Still I kept this name in comment just to give reader
a tip where CR_SCM_MAX_FD came from.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:13:32 +04:00
Cyrill Gorcunov
8f64a14a03 headers: Move fcntl related data to include/fcntl.h
fcntl data is arch independent, so move it out of include/asm/type.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:13:10 +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
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
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
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
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
Pavel Emelyanov
c8fe0e5ea7 parasite: Introduce thread_ctx structure
This one keeps registers and sigmask for running thread. Will
be used for simpler parasite management.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-30 16:49:22 +04:00
Alexander Kartashov
8f74187af1 arm: don't use the register R12 in the routine syscall_common()
The register R12 has a special meaning when syscalls are hooked
with ptrace() in ARM that results in a dumpee context corruption
on an injected blob unmap. Note that this patch doesn't solve
the problem entirely since the compiler may corrupt the register
before issuing a call to the routine sys_munmap(); however
we assume that a sufficiently decent compiler doesn't.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Tested-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-26 15:56:35 +04:00
Alexander Kolesen
14f98abf8d Make gen-syscalls.pl compatible with perl < 5.13.2
An error occurs when trying to build crtools on ARM systems
with perl versions earlier than 5.13.2 due to lack of /r modifier.

% make
...
  GEN      arch/arm/syscalls.S
Bareword found where operator expected at arch/arm/gen-syscalls.pl line 8, near "s/.*include\///gr"
Bareword found where operator expected at arch/arm/gen-syscalls.pl line 10, near "s/.*include\///gr"
Bareword found where operator expected at arch/arm/gen-syscalls.pl line 13, near "s/.*include\///gr"
Bareword found where operator expected at arch/arm/gen-syscalls.pl line 16, near "tr/.-/_/r"
Bareword found where operator expected at arch/arm/gen-syscalls.pl line 17, near "tr/.-/_/r"
syntax error at arch/arm/gen-syscalls.pl line 8, near "s/.*include\///gr"
syntax error at arch/arm/gen-syscalls.pl line 10, near "s/.*include\///gr"
syntax error at arch/arm/gen-syscalls.pl line 13, near "s/.*include\///gr"
syntax error at arch/arm/gen-syscalls.pl line 16, near "tr/.-/_/r"
syntax error at arch/arm/gen-syscalls.pl line 17, near "tr/.-/_/r"
BEGIN not safe after errors--compilation aborted at arch/arm/gen-syscalls.pl line 60.
make[1]: *** No rule to make target `arch/arm/syscalls.S', needed by `arch/arm/syscalls.o'.  Stop.

Signed-off-by: Alexander Kolesen <kolesen.a@gmail.com>
Acked-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-17 22:45:45 +04:00
Cyrill Gorcunov
71f7f7546c atomic: Use atomic_read instead of atomic_get
To switch to kernel's style.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:06 +04:00
Cyrill Gorcunov
56cb0f8baf arm: atomic -- Add atomic_read/atomic_set helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:05 +04:00
Cyrill Gorcunov
aea8a605f3 atomic -- Switch to linux kernel templates
Use same code as provided in kernel. In first place
we used own prototypes in case of simplicity (they
all were based on "lock xadd" instruction. There is
no more need for that and we can switch to well known
kernel's api.

Because kernel uses plain int type to carry atomic
counters I had to add explicit u32 type for futexes,
as well as a couple of fixes for new api usage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:03 +04:00
Cyrill Gorcunov
19391c85b3 arm: atomic -- Use signed types for atomic_add_return/atomic_sub_return
Just like kernel does.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:02 +04:00
Cyrill Gorcunov
862e0fb2d3 x86: asm -- Add cmpxchg helpers
Will need it for atomic data conversion.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:01 +04:00
Pavel Emelyanov
330c137c92 arm: Add atomic_add
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-13 20:05:43 +04:00
Pavel Emelyanov
ab95e97fd5 atomic: Add atomic_add for x86
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:23:52 +04:00
Andrey Vagin
f68f37a11f parasite: modify process memory only for executing syscalls
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 17:24:17 +04:00
Andrey Vagin
2db92dee22 parasite: block signals for each parasite command
Pending signals should be saved, so signals should be blocked.
Signals are blocked for EACH command, because a chance of destroying a
process state should be a small as possible.

At the end there will only two "trapped" commands -- to dump thread
and to start daemon in parasite, so this doesn't add significant
overheads.

If crtools is killed between two commands, a dumped process will run
continue.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-16 17:24:17 +04:00
Alexander Kartashov
b58a124829 arm: fixed the ARM version of the routine __cr_restore_rt
This patch fixes a stack corruption caused by the routine
since it pushes the registers R4, R5, R6, and R7
onto the stack that results in a restorer crash
while restoring a zombie (https://bugzilla.openvz.org/show_bug.cgi?id=2663)

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-12 18:18:40 +04:00
Alexander Kartashov
adac35445a arm: moved the mincore syscall description
The description of the syscall mincore breaks
the traditional ordering of syscall descriptions.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 15:57:32 +04:00
Alexander Kartashov
d305fb1306 arm: refactor the syscall glue to support ARMv6
This patch modifies the ARM syscall glue as follows:

* the macros syscallX that produce different code
  for syscalls with different number of arguments
  are replaced by the generic syscall thunk copied
  from libc;

* the syscall tables generation script is simplified
  since the syscall argument number analysis is redundant;

* the ARMv7 specific instruction MOVW is eliminated.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 15:57:26 +04:00
Alexander Kartashov
6ee9ad5bc4 arm: added the ARMv6 data barrier implementation
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 15:57:06 +04:00