Skip to content

Commit b4f7b0c

Browse files
committed
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_stop nested_detach_wait
1 parent c9afd72 commit b4f7b0c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/RecordSession.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,6 +2221,8 @@ static ExeInfo read_exe_info(const string& exe_file) {
22212221
ElfFileReader reader(fd);
22222222
ret.arch = reader.arch();
22232223

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

22382241
auto syms = reader.read_symbols(".dynsym", ".dynstr");
22392242
for (size_t i = 0; i < syms.size(); ++i) {

src/util.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,6 +2453,10 @@ int __lsan_is_turned_off(void)
24532453
{
24542454
return rr_lsan_is_turned_off;
24552455
}
2456+
#include <sanitizer/asan_interface.h>
2457+
const char *__asan_default_options() {
2458+
return "verify_asan_link_order=0";
2459+
}
24562460
#endif
24572461

24582462
bool coredumping_signal_takes_down_entire_vm() {

0 commit comments

Comments
 (0)