From 4f90a93614de4f619cf1c765f018ab2295e3b9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Sun, 2 Apr 2023 19:44:19 +0200 Subject: [PATCH] ASan: Run with verify_asan_link_order=0. Avoids error message: ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. Affected tests: nested_detach nested_detach_kill nested_detach_kill_stuck nested_detach_wait --- src/main.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cc b/src/main.cc index 973ed93d1ac..128fcbe37f4 100644 --- a/src/main.cc +++ b/src/main.cc @@ -234,6 +234,13 @@ size_t saved_argv0_space() { using namespace rr; int main(int argc, char* argv[]) { + +#ifdef __SANITIZE_ADDRESS__ + if (getenv("ASAN_OPTIONS") == NULL) { + setenv("ASAN_OPTIONS", "verify_asan_link_order=0", 1); + } +#endif + rr::saved_argv0_ = argv[0]; rr::saved_argv0_space_ = argv[argc - 1] + strlen(argv[argc - 1]) + 1 - rr::saved_argv0_;