This commit adds a temporary stack to handle libfuzzer crashes in
Fuchsia.
Crashes in fuchsia are handled via exception channels: an exception
handler thread waits for an exception, and when one happens, it will try
to "resurrect" the crashed thread by writing the registers onto the
stack and changing the pc to a crash trampoline, which then calls
libfuzzer's static crash handler.
If the crashed thread has an invalid stack, writing the registers onto
the stack will fail. The end result is that the fuzzer would hang and
the error would be reported as a time out.
To solve it, we set up a temporary stack of a few pages so the crash
handler can run. This crash handler will end up the application, so we
are not expected to go back to normal.
Related to that change, now that we only have one crash stack, we can't
allow other threads to use the same crash stack, and we aren't supposed
to let multiple threads call the crash handler concurrently anyways, so
now we only let the first thread to crash to go through.
Finally, there's also a change in the asan code for fuchsia, to check
whether we are in the default stack or in a different one. Upon calls to
noreturn functions, asan unpoisons the thread stacks, so we check
whether the current stack is the default one, and if so, do everything
as normal. Otherwise, we unpoison the whole default stack, as well as
the current stack page (we don't know how big the current stack is).
local_var unused?
and better just use __builtin_frame_address()