Index: compiler-rt/lib/asan/asan_poisoning.cc =================================================================== --- compiler-rt/lib/asan/asan_poisoning.cc +++ compiler-rt/lib/asan/asan_poisoning.cc @@ -181,6 +181,8 @@ uptr __asan_region_is_poisoned(uptr beg, uptr size) { if (!size) return 0; + if (SANITIZER_RTEMS && !asan_inited) + return 0; uptr end = beg + size; if (SANITIZER_MYRIAD2) { // On Myriad, address not in DRAM range need to be treated as Index: compiler-rt/lib/asan/asan_rtl.cc =================================================================== --- compiler-rt/lib/asan/asan_rtl.cc +++ compiler-rt/lib/asan/asan_rtl.cc @@ -95,16 +95,22 @@ #define ASAN_REPORT_ERROR(type, is_write, size) \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_ ## type ## size(uptr addr) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true); \ } \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_exp_ ## type ## size(uptr addr, u32 exp) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true); \ } \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_ ## type ## size ## _noabort(uptr addr) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false); \ } \ @@ -123,16 +129,22 @@ #define ASAN_REPORT_ERROR_N(type, is_write) \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_ ## type ## _n(uptr addr, uptr size) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true); \ } \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_exp_ ## type ## _n(uptr addr, uptr size, u32 exp) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true); \ } \ extern "C" NOINLINE INTERFACE_ATTRIBUTE \ void __asan_report_ ## type ## _n_noabort(uptr addr, uptr size) { \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ GET_CALLER_PC_BP_SP; \ ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false); \ } \ @@ -141,6 +153,8 @@ ASAN_REPORT_ERROR_N(store, true) #define ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, exp_arg, fatal) \ + if (SANITIZER_RTEMS && !asan_inited) \ + return; \ if (SANITIZER_RTEMS && !AddrIsInMem(addr) && !AddrIsInShadow(addr)) \ return; \ uptr sp = MEM_TO_SHADOW(addr); \ @@ -524,6 +538,9 @@ using namespace __asan; // NOLINT void NOINLINE __asan_handle_no_return() { + if (SANITIZER_RTEMS && !asan_inited) + return; + if (asan_init_is_running) return;