From 5dcedd65504cc9cadc9a5ea8bc3af51a26eec704 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 26 Aug 2025 13:26:57 -0700 Subject: runtime: lock mheap_.speciallock when allocating synctest specials Avoid racing use of mheap_.specialBubbleAlloc. Fixes #75134 Change-Id: I0c9140c18d2bca1e1c3387cd81230f0e8c9ac23e Reviewed-on: https://go-review.googlesource.com/c/go/+/699255 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- src/runtime/synctest.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/synctest.go b/src/runtime/synctest.go index 16af1209b4..529f69fd93 100644 --- a/src/runtime/synctest.go +++ b/src/runtime/synctest.go @@ -410,7 +410,9 @@ func getOrSetBubbleSpecial(p unsafe.Pointer, bubbleid uint64, add bool) (assoc i } else if add { // p is not associated with a bubble, // and we've been asked to add an association. + lock(&mheap_.speciallock) s := (*specialBubble)(mheap_.specialBubbleAlloc.alloc()) + unlock(&mheap_.speciallock) s.bubbleid = bubbleid s.special.kind = _KindSpecialBubble s.special.offset = offset -- cgit v1.3-5-g9baa