aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/container_memory.h
diff options
context:
space:
mode:
authorEvan Brown <ezb@google.com>2023-10-30 09:58:13 -0700
committerCopybara-Service <copybara-worker@google.com>2023-10-30 09:59:17 -0700
commitdc3ef2950e7ce08b53ead824cc81b3287e2b74ac (patch)
treef19cce04f786a98d91cbc43306c3ba9042c4c6f3 /absl/container/internal/container_memory.h
parente7d9317bf5d65d98d9fa4bbbc9750613fc4cdf8a (diff)
downloadabseil-dc3ef2950e7ce08b53ead824cc81b3287e2b74ac.tar.gz
abseil-dc3ef2950e7ce08b53ead824cc81b3287e2b74ac.tar.bz2
abseil-dc3ef2950e7ce08b53ead824cc81b3287e2b74ac.zip
Roll forward: Add sanitizer mode checks that element constructors/destructors don't make reentrant calls to raw_hash_set member functions.
PiperOrigin-RevId: 577877803 Change-Id: I254c589b00cadec6ff95dfd60a8a38ab303c1af5
Diffstat (limited to 'absl/container/internal/container_memory.h')
-rw-r--r--absl/container/internal/container_memory.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/container/internal/container_memory.h b/absl/container/internal/container_memory.h
index f59ca4ee..a735ca34 100644
--- a/absl/container/internal/container_memory.h
+++ b/absl/container/internal/container_memory.h
@@ -249,6 +249,14 @@ inline void SanitizerUnpoisonObject(const T* object) {
SanitizerUnpoisonMemoryRegion(object, sizeof(T));
}
+template <typename Container, typename Alloc, typename F>
+void RunWithReentrancyGuard(Container& c, Alloc& a, F f) {
+ SanitizerPoisonObject(&c);
+ if (!std::is_empty<Alloc>()) SanitizerUnpoisonObject(&a);
+ f();
+ SanitizerUnpoisonObject(&c);
+}
+
namespace memory_internal {
// If Pair is a standard-layout type, OffsetOf<Pair>::kFirst and