[compiler-rt] [msan] Dynamically grow kNumStackOriginDescrs (PR #92826)

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 15:57:26 PDT 2024


================
@@ -312,6 +332,7 @@ static inline void SetAllocaOrigin(void *a, uptr size, u32 *id_ptr, char *descr,
   u32 id = *id_ptr;
   if (id == 0 || id == first_timer) {
     u32 idx = atomic_fetch_add(&NumStackOriginDescrs, 1, memory_order_relaxed);
+    ResizeStackOriginMetadata(idx);
----------------
kstoimenov wrote:

I am not sure if this is thread safe. I would recommend allocating StackOriginDescr to 1024 * 1024 in __msan_init and call ResizeStackOriginMetadata only to double the size. It still won't be 100% thread safe, but we expect it to happen very few times.

https://github.com/llvm/llvm-project/pull/92826


More information about the llvm-commits mailing list