Skip to content

Commit cc0d479

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 720e885 commit cc0d479

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
@@ -2223,6 +2223,8 @@ static ExeInfo read_exe_info(const string& exe_file) {
22232223
ElfFileReader reader(fd);
22242224
ret.arch = reader.arch();
22252225

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

22402243
auto syms = reader.read_symbols(".dynsym", ".dynstr");
22412244
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
@@ -2461,6 +2461,10 @@ int __lsan_is_turned_off(void)
24612461
{
24622462
return rr_lsan_is_turned_off;
24632463
}
2464+
#include <sanitizer/asan_interface.h>
2465+
const char *__asan_default_options() {
2466+
return "verify_asan_link_order=0";
2467+
}
24642468
#endif
24652469

24662470
bool coredumping_signal_takes_down_entire_vm() {

0 commit comments

Comments
 (0)