Index: lib/asan/asan_interface_internal.h =================================================================== --- lib/asan/asan_interface_internal.h +++ lib/asan/asan_interface_internal.h @@ -79,6 +79,10 @@ SANITIZER_INTERFACE_ATTRIBUTE void __asan_after_dynamic_init(); + // Calls real memset with no mapping or checks. + SANITIZER_INTERFACE_ATTRIBUTE + void __asan_memset_real(uptr addr, u8 value, uptr size); + // These two functions are used by instrumented code in the // use-after-scope mode. They mark memory for local variables as // unaddressable when they leave scope and addressable before the Index: lib/asan/asan_poisoning.cc =================================================================== --- lib/asan/asan_poisoning.cc +++ lib/asan/asan_poisoning.cc @@ -314,6 +314,10 @@ } } +void __asan_memset_real(uptr addr, u8 c, uptr size) { + REAL(memset)((void *)addr, c, size); +} + void __asan_poison_stack_memory(uptr addr, uptr size) { if (!__asan_option_detect_stack_use_after_scope) return; VReport(1, "poisoning: %p %zx\n", (void *)addr, size); Index: lib/asan/asan_rtl.cc =================================================================== --- lib/asan/asan_rtl.cc +++ lib/asan/asan_rtl.cc @@ -265,44 +265,123 @@ // __asan_report_* functions are noreturn, so we need a switch to prevent // the compiler from removing any of them. switch (fake_condition) { - case 1: __asan_report_load1(0); break; - case 2: __asan_report_load2(0); break; - case 3: __asan_report_load4(0); break; - case 4: __asan_report_load8(0); break; - case 5: __asan_report_load16(0); break; - case 6: __asan_report_load_n(0, 0); break; - case 7: __asan_report_store1(0); break; - case 8: __asan_report_store2(0); break; - case 9: __asan_report_store4(0); break; - case 10: __asan_report_store8(0); break; - case 11: __asan_report_store16(0); break; - case 12: __asan_report_store_n(0, 0); break; - case 13: __asan_report_exp_load1(0, 0); break; - case 14: __asan_report_exp_load2(0, 0); break; - case 15: __asan_report_exp_load4(0, 0); break; - case 16: __asan_report_exp_load8(0, 0); break; - case 17: __asan_report_exp_load16(0, 0); break; - case 18: __asan_report_exp_load_n(0, 0, 0); break; - case 19: __asan_report_exp_store1(0, 0); break; - case 20: __asan_report_exp_store2(0, 0); break; - case 21: __asan_report_exp_store4(0, 0); break; - case 22: __asan_report_exp_store8(0, 0); break; - case 23: __asan_report_exp_store16(0, 0); break; - case 24: __asan_report_exp_store_n(0, 0, 0); break; - case 25: __asan_register_globals(nullptr, 0); break; - case 26: __asan_unregister_globals(nullptr, 0); break; - case 27: __asan_set_death_callback(nullptr); break; - case 28: __asan_set_error_report_callback(nullptr); break; - case 29: __asan_handle_no_return(); break; - case 30: __asan_address_is_poisoned(nullptr); break; - case 31: __asan_poison_memory_region(nullptr, 0); break; - case 32: __asan_unpoison_memory_region(nullptr, 0); break; - case 34: __asan_before_dynamic_init(nullptr); break; - case 35: __asan_after_dynamic_init(); break; - case 36: __asan_poison_stack_memory(0, 0); break; - case 37: __asan_unpoison_stack_memory(0, 0); break; - case 38: __asan_region_is_poisoned(0, 0); break; - case 39: __asan_describe_address(0); break; + case 1: + __asan_report_load1(0); + break; + case 2: + __asan_report_load2(0); + break; + case 3: + __asan_report_load4(0); + break; + case 4: + __asan_report_load8(0); + break; + case 5: + __asan_report_load16(0); + break; + case 6: + __asan_report_load_n(0, 0); + break; + case 7: + __asan_report_store1(0); + break; + case 8: + __asan_report_store2(0); + break; + case 9: + __asan_report_store4(0); + break; + case 10: + __asan_report_store8(0); + break; + case 11: + __asan_report_store16(0); + break; + case 12: + __asan_report_store_n(0, 0); + break; + case 13: + __asan_report_exp_load1(0, 0); + break; + case 14: + __asan_report_exp_load2(0, 0); + break; + case 15: + __asan_report_exp_load4(0, 0); + break; + case 16: + __asan_report_exp_load8(0, 0); + break; + case 17: + __asan_report_exp_load16(0, 0); + break; + case 18: + __asan_report_exp_load_n(0, 0, 0); + break; + case 19: + __asan_report_exp_store1(0, 0); + break; + case 20: + __asan_report_exp_store2(0, 0); + break; + case 21: + __asan_report_exp_store4(0, 0); + break; + case 22: + __asan_report_exp_store8(0, 0); + break; + case 23: + __asan_report_exp_store16(0, 0); + break; + case 24: + __asan_report_exp_store_n(0, 0, 0); + break; + case 25: + __asan_register_globals(nullptr, 0); + break; + case 26: + __asan_unregister_globals(nullptr, 0); + break; + case 27: + __asan_set_death_callback(nullptr); + break; + case 28: + __asan_set_error_report_callback(nullptr); + break; + case 29: + __asan_handle_no_return(); + break; + case 30: + __asan_address_is_poisoned(nullptr); + break; + case 31: + __asan_poison_memory_region(nullptr, 0); + break; + case 32: + __asan_unpoison_memory_region(nullptr, 0); + break; + case 34: + __asan_before_dynamic_init(nullptr); + break; + case 35: + __asan_after_dynamic_init(); + break; + case 36: + __asan_poison_stack_memory(0, 0); + break; + case 37: + __asan_unpoison_stack_memory(0, 0); + break; + case 38: + __asan_region_is_poisoned(0, 0); + break; + case 39: + __asan_describe_address(0); + break; + case 40: + __asan_memset_real(0, 0, 0); + break; } } Index: lib/asan/asan_win_dll_thunk.cc =================================================================== --- lib/asan/asan_win_dll_thunk.cc +++ lib/asan/asan_win_dll_thunk.cc @@ -261,6 +261,8 @@ INTERFACE_FUNCTION(__asan_memset); INTERFACE_FUNCTION(__asan_memmove); +INTERFACE_FUNCTION(__asan_memset_real); + INTERFACE_FUNCTION(__asan_alloca_poison); INTERFACE_FUNCTION(__asan_allocas_unpoison);