restore: clear breakpoints only for alive tasks

We don't set breakpoints for zombies.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: make check_ptrace_peeksiginfo and check_sigqueuinfo as static

They are not used outside.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
syscall: add memfd_create() (v2)

v2: Follow the kerndat style that "features" are described
just by global boolean variables.
shmem: rework getting file descriptors for shared memory regions (v2)

/proc/PID/map_files are protected by the global CAP_SYS_ADMIN, so we
need to avoid using them to support user namespaces.

We are going to use memfd_create() to get the first file descriptor and
then all others processes will able to open it via /proc/PID/fd/X.

This patch reworks slave processes to not use map_files.

v2: add more comments
shmem: use memfd_create() to restore shared memory reqions (v2)

/proc/PID/map_files are protected by the global CAP_SYS_ADMIN, so we
need to avoid using them to support user namespaces.

We are going to use memfd_create() to get the first file descriptor and
then all others processes will able to open it via /proc/PID/fd/X.

In this patch memfd_create() is used to get a file descriptor, which is
associated with a shared memory region.

If memfd_create() isn't supported, the old scheme will be used.

v2: don't set a name for memfd. It isn't required.
zdtm/maps01: extend maps01

It's bad idea to have only one target object.
In addition I add a shared region to the second process,
which is not mapped in the first.
travis: add compilation of tests
mount: rework perparation for pivot_root (v2)

We can't bind-mount the required root into itself instead of
resolving a parent mount.

This patch is required to support userns, because if we want to make
pivot_root, the parent mount can't be locked. When we create userns
and mntns, all inherited mounts are marked as locked.

v2: don't change properties of the given root

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
perf: add ability to trace system calls with perf

perf doesn't affect performance so significant as strace and
it allows to trace parasite code.

All processes are executed in a new perf_evets cgroup and
"perf record" collects events only for processes from this group.

perf is executed when all processes are frozen.

Example of output:
    18.651 ( 0.001 ms): criu/9243 close(fd: 44                                                          ) = 0
    18.655 ( 0.001 ms): criu/9243 gettimeofday(tv: 0x7fff32fdd7f0                                       ) = 0
    18.670 ( 0.013 ms): criu/9243 write(fd: 1023, buf: 0x6b6a00, count: 53                              ) = 53
    18.710 ( 1.078 ms): env00/9226 recvfrom(fd: 3, ubuf: 0x7f963bb95998, size: 12, flags: WAITALL        ) = 12
    18.726 ( 0.014 ms): env00/9226 write(fd: 4, buf: 0x7f963bb95878, count: 26                           ) = 26
    18.761 ( 0.034 ms): env00/9226 mprotect(start: 0x7f963b771000, len: 2093056, prot: READ              ) = 0
zdtm: always show errors
zdtm/Makefile: show output for each test

In this case we have another chance to not skip errors.