parasite: Switch parasite to daemon mode

Parasite daemon mode it quite tricky. One may consider
it as consisting of two parts

 - daemon mode for thread leader
 - daemon mode for regular threads

Thread leader daemon
--------------------

Once thread leader parasite code switched initialized,
it starts spinning on socket listening for commands
to handle.

If the command destination is the thread leader itself it
handles it and replies back the ack to the caller (iow
the main crtools code).

If the recepient is not thread leader but one of threads,
then thread leader wakes up the thread by futex and makes
it to handle the command waiting on futex for result. Once
result obtained, the ack is being sending back to caller.

Thread daemon
-------------

On initialization thread daemon starts waiting a command on futex.
The futex is triggered by thread leader daemon when command received.
Once command is received and handled, the result is reported back to
the thread leader daemon, which in turn send ack message.

Both thread-leader and regular threads require own stack to operate
on since they all are present in memory simultaneously. Thus we use
call_daemon_thread() helper which takes care of providing stack
to the callee.

TODO:

 - ARM requires own wrappers on damonize/trap low-level code,
   at moment x86-64 is only covered

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
parasite: use a propper command for getting ack
parasite: restore thread registers

crtools dump should not be destructive.

We suppose that item->threads[0] is a thread leader.
dump: block signals with help of ptrace

Currently crtools blocks signals from a parasite code, but for executing
the parasite code a process has to handle all pending non-blockedsignals.

It is not a problem until crtools decide to support stopped tasks.

Registers were saved before blocking signals, so a task can enter in a
signal hangler and block a part of signals, than it will be restored out
of signal handler with blocked signals.
parasite: remove extra synchronisation
restore: use a concrete object for constructing sigframe

struct thread_restore_args contains many pointers on different objects.
restore: add a function for constructing sigframe
restore: split restore_gpregs on two parts

The first one fills sigframe and the second one restores another
registers.
restore: construct sigframe in crtools

Before this patch sigframes were constructed in restorer.
dump: fill sigblock mask immediately after getting it
dump: reseve space and construc sigframes for parasites
parasite: transfer a pointer on sigframe to parasite
parasite: restore parasite state via rt_sigreturn
parasite: remain all signals blocked in a direct way

munmap will be executed by parasite, so all signals should be blocked.