i#777: Remove our signal stack before freeing it.
i#777: Remove our signal stack before freeing it.

Fixes issue 777.

It is possible for the app to receive a signal between freeing the
sigstack and exiting the thread.  Currently we set the sigaltstack back
to the app's sigaltstack if it had one, but if it doesn't have one, we
leave the sigaltstack pointing at freed memory.  With this change, we
always set the sigaltstack back to what it was before.  If there was no
sigaltstack, this will deliver the signal on whatever stack the thread
is currently on.  Typically, our signal handler will still be installed,
so we are likely to squash it if it is an alarm or assert if it is
something synchronous.

Review URL: https://codereview.appspot.com/6209079

git-svn-id: ed337ca7cdb08c0ba29d8fe58632bb7686892c2d@1371 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6

rnk/dynamorio,rnk/dynamorio,rnk/dynamorio,rnk/dynamorio,rnk/dynamorio