Disable vfork under ASan.

With vfork child process shares address space with the parent. ASan
stack instrumentation of functions running after vfork but before
exec ends up poisoning the stack of the parent process.

With vfork, exec* is similar to longjmp - it stops the current thread
of execution and effectively transfers control to the caller of
vfork().

ASan's way of handling cases like this is __asan_handle_no_return() -
it can be inserted manually and is auto-inserted before any call to a
[[no_return]] function. Unfortunately, execve() is not [[no_return]].
Seems like an oversight, but it only matters in combination with
vfork().

There are two other ways to fix this problem, but they are, IMHO,
inferior to this patch.
1. Mark childProcess and all its transitive callees as
__attribute__((no_sanitize_address)) to disable stack poisoning.
This is error-prone and there are quite a few of those.
2. Add __asan_handle_no_return() before any call to exec*-type
function in childProcess and below.
This is, again, error-prone. It would also suppress detection of
stack-based issues in all function frames that are live in the
current thread.

Bug: 73957446
Bug: 74535073
Bug: 73060923
Bug: 74533962
Bug: 74534935
Test: 130-hprof with SANITIZE_HOST=address

(cherry picked from commit e537e1b776d555a50b16fe26f5c37c584d44133d)

Change-Id: I5aefaca8322dfa4449680602cc9f0f26c6b5ebc1
1 file changed