Skip to content

Commit

Permalink
ASan: Run with verify_asan_link_order=0
Browse files Browse the repository at this point in the history
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_stop
  nested_detach_wait
  • Loading branch information
bernhardu committed Sep 10, 2023
1 parent 495b1b2 commit 35e0f55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/RecordSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,8 @@ static ExeInfo read_exe_info(const string& exe_file) {
ElfFileReader reader(fd);
ret.arch = reader.arch();

// Don't try to modifiy LD_PRELOAD when rr itself is built with ASan
#ifndef __SANITIZE_ADDRESS__
DynamicSection dynamic = reader.read_dynamic();
for (auto& entry : dynamic.entries) {
if (entry.tag == DT_NEEDED && entry.val < dynamic.strtab.size()) {
Expand All @@ -2236,6 +2238,7 @@ static ExeInfo read_exe_info(const string& exe_file) {
}
}
}
#endif

auto syms = reader.read_symbols(".dynsym", ".dynstr");
for (size_t i = 0; i < syms.size(); ++i) {
Expand Down
4 changes: 4 additions & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,10 @@ int __lsan_is_turned_off(void)
{
return rr_lsan_is_turned_off;
}
#include <sanitizer/asan_interface.h>
const char *__asan_default_options() {
return "verify_asan_link_order=0";
}
#endif

bool coredumping_signal_takes_down_entire_vm() {
Expand Down

0 comments on commit 35e0f55

Please sign in to comment.