diff options
author | babenko <babenko@yandex-team.com> | 2024-04-20 09:51:24 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2024-04-20 10:00:55 +0300 |
commit | 7358d1854b8132957a8a61d3513faa73187dcd7d (patch) | |
tree | 96b23924dd1c51b5426cd7bf340878241a344d36 | |
parent | 14d2464f16f766dc0a838a5082b9801fa8339f1b (diff) | |
download | ydb-7358d1854b8132957a8a61d3513faa73187dcd7d.tar.gz |
Enable MarkAsIntentionallyLeaked API for --sanitize=leak builds
f660faa016f3549719f718b14125e02327fc02b2
-rw-r--r-- | util/system/compiler.h | 8 | ||||
-rw-r--r-- | util/system/sanitizers.h | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/util/system/compiler.h b/util/system/compiler.h index 259232b67a..2b4b05fc5f 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -297,6 +297,9 @@ _YandexAbort(); #if __has_feature(address_sanitizer) #define _asan_enabled_ #endif + #if __has_feature(leak_sanitizer) + #define _lsan_enabled_ + #endif #else @@ -309,10 +312,13 @@ _YandexAbort(); #if defined(address_sanitizer_enabled) || defined(__SANITIZE_ADDRESS__) #define _asan_enabled_ #endif + #if defined(leak_sanitizer_enabled) || defined(__SANITIZE_LEAK__) + #define _lsan_enabled_ + #endif #endif -#if defined(_asan_enabled_) || defined(_msan_enabled_) || defined(_tsan_enabled_) || defined(_ubsan_enabled_) +#if defined(_asan_enabled_) || defined(_msan_enabled_) || defined(_tsan_enabled_) || defined(_ubsan_enabled_) || defined(_lsan_enabled_) #define _san_enabled_ #endif diff --git a/util/system/sanitizers.h b/util/system/sanitizers.h index 516256ea1d..47d3e8627c 100644 --- a/util/system/sanitizers.h +++ b/util/system/sanitizers.h @@ -4,8 +4,11 @@ extern "C" { // sanitizers API -#if defined(_asan_enabled_) +#if defined(_asan_enabled_) || defined(_lsan_enabled_) void __lsan_ignore_object(const void* p); +#endif + +#if defined(_asan_enabled_) void __sanitizer_start_switch_fiber(void** fake_stack_save, const void* bottom, size_t size); void __sanitizer_finish_switch_fiber(void* fake_stack_save, const void** old_bottom, size_t* old_size); #endif @@ -152,7 +155,7 @@ namespace NSan { } inline static void MarkAsIntentionallyLeaked(const void* ptr) noexcept { -#if defined(_asan_enabled_) +#if defined(_asan_enabled_) || defined(_lsan_enabled_) __lsan_ignore_object(ptr); #else Y_UNUSED(ptr); |