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>
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This one keeps registers and sigmask for running thread. Will
be used for simpler parasite management.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
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>
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>
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>
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>
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>
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>