[go] runtime: add race instrumentation for moduleToTypelinksLock

1 view
Skip to first unread message

Cherry Mui (Gerrit)

unread,
Feb 9, 2026, 12:32:19 PMFeb 9
to Chressie Himpel, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Ian Lance Taylor, golang-co...@googlegroups.com

Cherry Mui submitted the change

Change information

Commit message:
runtime: add race instrumentation for moduleToTypelinksLock

From Cherry Mui on the CL review:

The reason why we need race instrumentation is tricky. The runtime
package is not compiled with race instrumentation, therefore the race
detector doesn't know about synchronizations within the runtime, and
usually it doesn't care, as it also doesn't know about the concurrent
data accesses in the runtime.

However, in this case the concurrent access is in a map. Map accesses
are always instrumented
https://cs.opensource.google/go/go/+/master:src/internal/runtime/maps/runtime_fast64.go;l=25,
even if the map is defined in the runtime. So the race detector does see
the concurrent access. But it doesn't see the synchronization. So this
CL adds them.

Go maps are not common in the runtime. But I recall an issue like this
did occur. Maybe we could make the compiler/runtime not to instrument
map accesses for maps defined in the runtime (which would be a more
involved change).

---

The reproducer in src/runtime/testdata/testprog/typelinksrace.go was
provided by Cherry Mui.
Change-Id: I03b27c51b7278ee4b2939a1a0665169966999b33
Reviewed-by: Cherry Mui <cher...@google.com>
Files:
  • A src/runtime/testdata/testprog/typelinksrace.go
  • M src/runtime/type.go
  • A src/runtime/typelinksrace_test.go
Change size: M
Delta: 3 files changed, 63 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Cherry Mui
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I03b27c51b7278ee4b2939a1a0665169966999b33
Gerrit-Change-Number: 742740
Gerrit-PatchSet: 5
Gerrit-Owner: Chressie Himpel <chre...@google.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Chressie Himpel <chre...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages