netlink: Lower netlink error report log level

This most likely meand, that the respective -diag module is missing.
In that case the caller would check it and _might_ not fail the dump
at once. Thus treat it as error.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: don't destruct an external mount-namespace (v2)

If a parent mount point is shared with exteranl mntns, a child will be
umounted from the external mntns too.

For example:
$ mount -t tmpfs xxx /root/tmp/
$ mount --make-shared tmp
$ mkdir tmp/xxx
$ mount -t tmpfs xxx /root/tmp/xxx
$ touch tmp/xxx/a

$ unshare -m umount tmp/xxx
$ ls -l tmp/xxx/a
ls: cannot access tmp/xxx/a: No such file or directory

This patch changes a parent mnt to private for umounting childrens.

v2: exit if a mount point can not be marked ad private

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: don't destruct an external mount-namespace

Before doing something with mounts they should be marked as private,
otherwise our actions can affects someone else.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: don't compare unsigned value against 0

CID 1042292 (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. "len < 0UL"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
proc: fix memory leak

timer is not freed in case of eof.

CID 1042301 (#1 of 1): Resource leak (RESOURCE_LEAK)
15. leaked_storage: Variable timer going out of scope leaks the storage it points to.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
util: print error message if a script is failed
debuginfo
test: check, that parasite can rollback itself (v2)

This test uses systemtap to replace random parasite command on
invalide command. The parasite code received this command and should
rollback itself. CRIU didn't recived ack, should understand that
something wrong and exits. The systemtap inverts exit code of criu.

"zdtm.sh -d" is used for executing tests and testing that the state of
processes don't corrupted.

v2: randomize a command, which will be replaced
check: check PTRACE_{GET,SET}SIGMASK
dump: move code for dumping threads in a separate function

The next patch will add another version of this function,
which will use PTRACE_SETSIGMASK.
ptrace: try to get signal blocking mask via ptrace (v2)

Two new commands SETSIGMASK and GETSIGMASK were added to ptrace.

It allows to execute only one parasite command for dumping threads,
so unrecoverable window become smaller and performance is improved.

v2: splite the patch in two parts
parasite: move code about creating control sockets in a separate func

It will be used in a few places
parasite: move code about parasite initialization in a separate function

The current scheme is used two commands to daemonize parasite.
The first command blocks signals, then a sigframe generated and the
second command daemonizes parasite. If CRIU crashes between this
commands, signals will not be unlocked.

PTRACE_GETSIGMASK allows to do the same with one command and a window,
when a process state can't be restored, is smaller.
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 to corrupt a
process state should be so small as possible.
parasite: use only one command for executing parasite in a daemon mode

If a kernel supports PTRACE_SETSIGMASK, criu don't need to execute
PARASITE_CMD_INIT and PARASITE_CMD_DAEMONIZE, because the frist command
is used only for blocking signals. If criu crashes between these
commands, a process state will be corrupted, because all signals remain
blocked.
parasite: restore registers after each parasite command

Currenly we can restore blocking signals with help ptrace,
so if registers are restored after command, a process state
will not be corrupted if criu crashes.
posix-times: don't fail if /proc/PID/times is absent

/proc/PID/times was added in 3.10, but FC19 relesead with 3.9.

Usually we support only last version of kernel in the project git, so
we can commit it as an additional patch for the fedora package.

Cc: Adrian Reber <adrian@lisas.de>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
zdtm: wait a test process instead of output file

A test should be completed if a test process exited.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
zdtm.sh: check number of mounts in mountinfo
zdtm: expand the mountpoints test

* check shared and slave mounts
* check bind-mounts