Fix assertion failure when using VG_(system) near program termination.
The problem is that the use of VG_(system) causes a SIGCHLD to be sent
to the process, which ends up being delivered to one of the proxy LWPs
(which is a small problem in itself, but nothing too bad).

The proxy tells the scheduler LWP about this, and the scheduler LWP sends
a sigACK reply.

Then, while the proxy LWP is in the SigACK state, and the SigACK reply
is still queued in the message pipe, the scheduler LWP starts shutting
Valgrind down, and sends a SIGVGKILL to all proxy LWPs.  This causes
the proxy to drop from sigACK state to WaitReq state, and it reads
further commands - one of which is the SigACK message - this causes the
assertion failure.

The fix is to simply make the proxy LWP exit immediately when it gets
a SIGVGKILL, and not process any more requests.

This change also fixes a bug in VG_(system), in which the child process
returns back into Valgrind rather than exiting when exec fails.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2284 a5019735-40e9-0310-863c-91ae7b9d1cf9
2 files changed