In case we want to build binary with TSan for aarch64
CPU under qemu-user on x86_64 CPU, we should make sure
that we don't make any architecture dependent checks at
the runtime.
To support this, new flag "run_under_qemu" was added and
now available under TSAN_OPTIONS.
Change-Id: Ifad929d284d30b720afd60a60a88fa129f37d4a6
"Ignore reads and writes from all interceptors.")
TSAN_FLAG(bool, shared_ptr_interceptor, true,
"Track atomic reference counting in libc++ shared_ptr and weak_ptr.")
+TSAN_FLAG(bool, run_under_qemu, false, "Support to run under qemu.")
// Initialize the guard pointer used in {sig}{set,long}jump.
InitializeGuardPtr();
#endif
+ // If we call execve for "/proc/self/exe" under qemu-user,
+ // we will get an error, because kernel will try to ReExec
+ // qemu instead of TSaned binary.
+ if (UNLIKELY(flags()->run_under_qemu))
+ return;
+
if (reexec)
ReExec();
}