support asan in 3.1_opensource_release

This commit is contained in:
xy0
2022-04-08 14:00:52 +08:00
committed by LINxiansheng
parent 021cb19e6c
commit e43242fe44
4 changed files with 70 additions and 60 deletions

View File

@ -174,7 +174,9 @@ void __attribute__((constructor(MALLOC_INIT_PRIORITY))) init_global_memory_pool(
return OB_SUCCESS; return OB_SUCCESS;
}; };
global_default_allocator = ObMallocAllocator::get_instance(); global_default_allocator = ObMallocAllocator::get_instance();
#ifndef OB_USE_ASAN
abort_unless(OB_SUCCESS == install_ob_signal_handler()); abort_unless(OB_SUCCESS == install_ob_signal_handler());
#endif
} }
void __attribute__((destructor(MALLOC_INIT_PRIORITY))) deinit_global_memory_pool() void __attribute__((destructor(MALLOC_INIT_PRIORITY))) deinit_global_memory_pool()

View File

@ -234,8 +234,10 @@ int ObServer::init(const ObServerOptions& opts, const ObPLogWriterCfg& log_cfg)
LOG_ERROR("should never reach here!", K(ret)); LOG_ERROR("should never reach here!", K(ret));
} else if (OB_FAIL(init_restore_ctx())) { } else if (OB_FAIL(init_restore_ctx())) {
LOG_ERROR("init restore context fail", K(ret)); LOG_ERROR("init restore context fail", K(ret));
#ifndef OB_USE_ASAN
} else if (OB_FAIL(ObMemoryDump::get_instance().init())) { } else if (OB_FAIL(ObMemoryDump::get_instance().init())) {
LOG_ERROR("init memory dumper fail", K(ret)); LOG_ERROR("init memory dumper fail", K(ret));
#endif
} else if (OB_FAIL(ObDagScheduler::get_instance().init(OBSERVER.get_self()))) { } else if (OB_FAIL(ObDagScheduler::get_instance().init(OBSERVER.get_self()))) {
LOG_ERROR("init scheduler fail, ", K(ret)); LOG_ERROR("init scheduler fail, ", K(ret));
} else if (OB_FAIL(init_global_kvcache())) { } else if (OB_FAIL(init_global_kvcache())) {

View File

@ -221,8 +221,10 @@ int ObSignalHandle::deal_signals(int signum)
break; break;
} }
case 60: { case 60: {
#ifndef OB_USE_ASAN
send_request_and_wait(VERB_LEVEL_1, syscall(SYS_gettid) /*exclude_id*/); send_request_and_wait(VERB_LEVEL_1, syscall(SYS_gettid) /*exclude_id*/);
break; break;
#endif
} }
case 62: { case 62: {
// RESP_DUMP_TRACE_TO_FILE(); // RESP_DUMP_TRACE_TO_FILE();

View File

@ -97,17 +97,21 @@ int ObSelfBufferWriter::ensure_space(int64_t size)
void ObSelfBufferWriter::free() void ObSelfBufferWriter::free()
{ {
if (NULL != data_) { if (NULL != data_) {
#ifndef OB_USE_ASAN
if (macro_block_mem_ctx_.get_allocator().contains(data_)) { if (macro_block_mem_ctx_.get_allocator().contains(data_)) {
macro_block_mem_ctx_.free(data_); macro_block_mem_ctx_.free(data_);
} else { data_ = NULL;
}
#endif
if (NULL != data_) {
if (is_aligned_) { if (is_aligned_) {
ob_free_align(data_); ob_free_align(data_);
} else { } else {
ob_free(data_); ob_free(data_);
} }
}
}
data_ = NULL; data_ = NULL;
} }
}
}
} // namespace blocksstable } // namespace blocksstable
} // namespace oceanbase } // namespace oceanbase