diff options
author | Abseil Team <absl-team@google.com> | 2023-02-10 06:31:03 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-10 06:31:53 -0800 |
commit | cde2f0eaaed3fb8581511cb5719d39172a5a2d81 (patch) | |
tree | 5e1bd18df537626cb1adf6f4a811c643c2ea342e /absl/container/internal/raw_hash_set.cc | |
parent | fa4855403cdfb91b9c16f792041258ed819594c1 (diff) | |
download | abseil-cde2f0eaaed3fb8581511cb5719d39172a5a2d81.tar.gz abseil-cde2f0eaaed3fb8581511cb5719d39172a5a2d81.tar.bz2 abseil-cde2f0eaaed3fb8581511cb5719d39172a5a2d81.zip |
Workaround MSan false positive.
On Linux Kernels >= 5.4 MSan reports a false positive when accessing thread local storage data from loaded libraries.
This was reported on Chromium (which on some build configurations uses absl as a dynamic library). More info here: crbug.com/1414573.
PiperOrigin-RevId: 508645053
Change-Id: I5d5a97e1ee7230cc23f3934a4ec5594b883918b4
Diffstat (limited to 'absl/container/internal/raw_hash_set.cc')
-rw-r--r-- | absl/container/internal/raw_hash_set.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/absl/container/internal/raw_hash_set.cc b/absl/container/internal/raw_hash_set.cc index 5dc8b2fa..a6d9b7c0 100644 --- a/absl/container/internal/raw_hash_set.cc +++ b/absl/container/internal/raw_hash_set.cc @@ -19,6 +19,7 @@ #include <cstring> #include "absl/base/config.h" +#include "absl/base/dynamic_annotations.h" #include "absl/hash/hash.h" namespace absl { @@ -44,6 +45,11 @@ constexpr size_t Group::kWidth; inline size_t RandomSeed() { #ifdef ABSL_HAVE_THREAD_LOCAL static thread_local size_t counter = 0; + // On Linux kernels >= 5.4 the MSAN runtime has a false-positive when + // accessing thread local storage data from loaded libraries + // (https://github.com/google/sanitizers/issues/1265), for this reason counter + // needs to be annotated as initialized. + ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&counter, sizeof(size_t)); size_t value = ++counter; #else // ABSL_HAVE_THREAD_LOCAL static std::atomic<size_t> counter(0); |