crtools: change the minimal address for the restorer blob

It should be bigger than CONFIG_LSM_MMAP_MIN_ADDR.

v2: set a correct value

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
restore: fill up thread_args a bit earlier

It's preparation for the next patch.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
restore: unify handling of thread args of leaders and other threads

Currently we have an array for thread_args, but leader's thread_args
is a part of task_args.
Here is two problems. The array has a space for leader's thread args,
but it is unused. Code which fills thread args is duplicated two
times. This patch fixed both problem. It replaces thread_args on a
pointer from task_args and deletes code, which fills leaders
thread_args.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
restore: remove an unused field from task_restore_core_args

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
hdrs: Fixup reinclusion preprocessor constants

Make them look like __CR_<smth>_H__ with

sed -e '1,2s/#\(ifndef\|define\) _\?_\?\(CR_\)\?/#\1 __CR_/' -e '1,2s/_H_\?_\?.*$/_H__/'

on every header file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
parasite-syscall: Drop redundant \Space in parasite_ctl structure

No func changes

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
headers: Unify include guards (in comments) and a few fixes

 - fix names in comments
 - add empty lines where needed
 - fix rbtree.h
 - fix syscall-types.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pie: Don't forget to include sub-text sections into the blob

I've just got an interesting built problem which I never saw
before (and which I can't reporoduce at moment):

 | `.text.unlikely' referenced in section `.text' of parasite.o: defined in discarded section `.text.unlikely' of parasite.o

Including sub-text sections is a good thing anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
x86/syscalls-x86-64.sh: fix bashisms

syscalls-x86-64.sh: 3: syscalls-x86-64.sh: Syntax error: "(" unexpected

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: add ability to collect code coverage (v2)

gcc is executed with the option --coverage.
lcov creates HTML pages containing the source code annotated with
coverage information.

make GCOV=1
make test
make gcov
Look at gcov/html/index.html

v2: declare the weak __gcov_flush

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: s/tproxyd/crtools

tproxyd is another project.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Remove xid_fail

It was required as a temp stub for MySQL restore. Now it
just spoils the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: mountpoints -- Explicitly remove old /dev/null

We should explicitly unlink old /dev/null instance, otherwise
if such device already exist we might hit a problem as

 | (00.002984) 7412 fdinfo 0: pos: 0x               0 flags:           100002/0
 | (00.003015) Dumping path for 0 fd via self 42 [/dev/null]
 | (00.003025) Error (files-reg.c:422): Unaccessible path opened 2049:109720, need 5:10
 | (00.003033) Error (cr-dump.c:1565): Dump files (pid: 7412) failed with -1

Reported-by: Alexander Kartashov <alekskartashov@parallels.com>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: check only existent capabilities

Kernel started with 3.8-rc1 are not report non-existent caps in
/proc/pid/status, so crtools doesn't dump/restore such caps.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
x86: moved x86-specific files into the directory arch/x86.

* The following files goes into the directory arch/x86/include/asm unmodified:
  - include/atomic.h,
  - include/linkage.h,
  - include/memcpy_64.h,
  - include/types.h,
  - include/bitops.h,
  - pie/parasite-head-x86-64.S,
  - include/processor-flags.h,
  - include/syscall-x86-64.def.

* Changed include directives in the source files that include the headers
  listed above.

* Modified build scripts to reflect the source moves.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
multiarch: introduced the multiarch support into the build system.

* The linker script pie/pie.lds.S is generated from the template
  pie/pie.lds.S.in by prepending the output architecture specification.
  The output architecture is defined by the variable LDARCH.

* Blobs are generated by objcopy instead of ld because the ARM linker
  fails to produce a binary when supplied a script.
  (See http://lists.gnu.org/archive/html/bug-binutils/2008-10/msg00091.html).

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sys_getpgid: fixed the syscall prototype since it actually has one argument.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr: don't touch VM above TASK_SIZE.

VM above TASK_SIZE is read-only but some areas are mapped on ARM
into the process address space.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
parasite-syscall.c: moved the syscall instructions into the file arch/x86/crtools.c.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
parasite-syscall.c: moved the routine parasite_setup_regs() to the file arch/x86/crtools.c.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>