restorer: close log file before detaching from crtools
restorer: close log file before detaching from crtools

v2: it's toom risky to jump to address equal to line numbet (there could be
valid executable code). So now jump is done to 0 address and %sp encodes line
number (32 most significant bits) and error code (32 least significant bits).

There is a race between log close by process being restoring and opened file
desctriptors check in zdtm test suite - crtools can exit and compare file
descriptors before detached restored process will perform all the rest tasks
(including close of the log) and execute final system call:

 |--- dump/sleeping00/8578/dump.fd        2012-02-20 14:31:31.246096000 +0300
 |+++ dump/sleeping00/8578/restore.fd     2012-02-20 14:31:31.418095999 +0300
 |@@ -1,4 +1,5 @@
 |
 | 0 -> /dev/null
 | 1 -> /dev/null
 |+1023 -> /root/crtools/test/dump/sleeping00/8578/restore.log
 | 2 -> /dev/null

The solution is to close log in restorer before final command received. But
this leads to another problem: we have to inform somehow about possible errors
afterwards This is done by forced segmentation fault and looks like this
(dmesg):

pipe00[4678]: segfault at 0 ip 00007f4c8ab77d02 sp 000002ed00000001 error 4

Where %sp encodes line number (32 most significant bits) and error code (32
least significant bits).

Signed-off-by: Stanislav Kinsbursky <43b28e187c4fe6e53d7ab0bb71957481e322f182@openvz.org>
Acked-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>
Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@openvz.org>

gonkulator/criu,eabatalov/criu,rentzsch/criu,marcosnils/criu,svloyso/criu,tych0/criu,marcosnils/criu,eabatalov/criu,gonkulator/criu,gablg1/criu,efiop/criu,biddyweb/criu,AuthenticEshkinKot/criu,tych0/criu,rentzsch/criu,fbocharov/criu,KKoukiou/criu-remote,svloyso/criu,rentzsch/criu,AuthenticEshkinKot/criu,LK4D4/criu,sdgdsffdsfff/criu,wtf42/criu,biddyweb/criu,AuthenticEshkinKot/criu,wtf42/criu,efiop/criu,gonkulator/criu,fbocharov/criu,sdgdsffdsfff/criu,ldu4/criu,wtf42/criu,fbocharov/criu,gablg1/criu,marcosnils/criu,ldu4/criu,gonkulator/criu,rentzsch/criu,AuthenticEshkinKot/criu,marcosnils/criu,ldu4/criu,rentzsch/criu,gablg1/criu,KKoukiou/criu-remote,LK4D4/criu,marcosnils/criu,sdgdsffdsfff/criu,KKoukiou/criu-remote,gablg1/criu,biddyweb/criu,KKoukiou/criu-remote,svloyso/criu,efiop/criu,eabatalov/criu,LK4D4/criu,marcosnils/criu,sdgdsffdsfff/criu,svloyso/criu,efiop/criu,fbocharov/criu,gonkulator/criu,KKoukiou/criu-remote,ldu4/criu,sdgdsffdsfff/criu,efiop/criu,tych0/criu,eabatalov/criu,gablg1/criu,fbocharov/criu,eabatalov/criu,kawamuray/criu,tych0/criu,kawamuray/criu,kawamuray/criu,kawamuray/criu,AuthenticEshkinKot/criu,tych0/criu,rentzsch/criu,wtf42/criu,LK4D4/criu,gablg1/criu,gonkulator/criu,LK4D4/criu,ldu4/criu,fbocharov/criu,biddyweb/criu,kawamuray/criu,biddyweb/criu,eabatalov/criu,biddyweb/criu,svloyso/criu,AuthenticEshkinKot/criu,sdgdsffdsfff/criu,efiop/criu,KKoukiou/criu-remote,tych0/criu,wtf42/criu,kawamuray/criu,svloyso/criu,wtf42/criu,LK4D4/criu,ldu4/criu