mem: Remove zero page from the end of mem image files

This was required when pages were stored in elf files for
exec. Now we can stop reading it on eof.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
lock: Restore ability to abort on futex waiting

In commit 71cc2733a79efba65d3466f784b19d17805cf50d
I occasionally dropped the ability to abort on waiting
(because we used signed -1 value to inform waiters that
something is wrong and waiting should be aborted, but
the type was changed to unsigned one and as result
this condition never triggers).

So to resolve it futex_abort_and_wake() is added and
should be used explicitly where appropriate instead
if signess hack.

Reported-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Use collected target vmas list in restorer_get_vma_hint

It uses the vma image right now, but the image is already sucked in.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Remove unused pstree_pid

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Read pstree image once

Collect pstree_item-s on restore in big list. This lets
us not lseek this file on restore and simplifies the code
a little.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add kcmp test

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Open thread core images without -nocheck

These are image files that weren't yet opened, thus should be
opened with proper checks.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
img: Remove unused open_image_ro_nocheck

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Don't seek core file for magic

This is done by open_image_ro in the restorer bootstrap preparation code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
parasite: Don't lseek on image files

All these files are now properly prepared by the parasite
invocation code by using open_image calls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: prctl -- Add PR_SET_MM_AUXV test

Add basic test for prctl PR_SET_MM opcodes support.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: prctl -- Add PR_SET_MM_AUXV test

The ability to set PR_SET_MM_AUXV is implemented
in kernel as a separate PR_SET_MM extension, so
we need to test if the kernel patch is applied
on a running system.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add fcntl stub

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
proc: Add missing includes into proc_parse.h

Since proc_parse.h declares functions which have
list_head as arguments, it should include list.h
and basic types.

Otherwise if included into the files without list support
the compilation might fail as
 |
 | In file included from cr-check.c:5:
 | ./include/proc_parse.h:83: error: expected declaration specifiers or ‘...’ before ‘bool’

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Add test for /proc/pid/stat extension

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Ease the fd collecting

No need in separate per-type fn for doing this. We can just
find the respective fd list and do sorting in the generic code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Add unix connected streams test

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sockets: Drop socket name for any bound-to-unlinked case

This maybe not 100% correct in the generic case, but the way unix sockets are
used lets us do this trick.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sockets: Check for unix being properly interconnected on dump

Add two checks -- that peer exists and it we will be able to
connect to him somehow on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Remove unused fn

It was used in old code, now it can be dropped

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