diff options
| author | Michael Pratt <mpratt@google.com> | 2025-04-03 03:26:25 +0000 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2025-04-03 01:25:08 -0700 |
| commit | 0b31e6d4cc804ab76ae8ced151ee2f50657aec14 (patch) | |
| tree | 46b0581bb4422386090d702a79f33d83d7e2d28f /src/runtime/os3_solaris.go | |
| parent | 13b1261175efde5aac7c4c7f6f66ae3b2c609a2d (diff) | |
| download | go-0b31e6d4cc804ab76ae8ced151ee2f50657aec14.tar.xz | |
runtime: cleanup M vgetrandom state before dropping P
When an M is destroyed, we put its vgetrandom state back on the shared
list for another M to reuse. This list is simply a slice, so appending
to the slice may allocate. Currently this operation is performed in
mdestroy, after the P is released, meaning allocation is not allowed.
More the cleanup earlier in mdestroy when allocation is still OK.
Also add //go:nowritebarrierrec to mdestroy since it runs without a P,
which would have caught this bug.
Fixes #73141.
Change-Id: I6a6a636c3fbf5c6eec09d07a260e39dbb4d2db12
Reviewed-on: https://go-review.googlesource.com/c/go/+/662455
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/os3_solaris.go')
| -rw-r--r-- | src/runtime/os3_solaris.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index cf163a6bf4..ded821b2e6 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -234,8 +234,11 @@ func unminit() { getg().m.procid = 0 } -// Called from exitm, but not from drop, to undo the effect of thread-owned +// Called from mexit, but not from dropm, to undo the effect of thread-owned // resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +// +// This always runs without a P, so //go:nowritebarrierrec is required. +//go:nowritebarrierrec func mdestroy(mp *m) { } |
