aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-08-26 13:26:57 -0700
committerMichael Knyszek <mknyszek@google.com>2025-09-09 14:46:30 -0700
commit5dcedd65504cc9cadc9a5ea8bc3af51a26eec704 (patch)
tree125db295480b4fa8173f307b2008739998b84259 /src/runtime
parentd3be949ada01d7827f8edc87665fef5268634cb3 (diff)
downloadgo-5dcedd65504cc9cadc9a5ea8bc3af51a26eec704.tar.xz
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 <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/synctest.go2
1 files changed, 2 insertions, 0 deletions
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