]> Cypherpunks repositories - gostls13.git/commit
runtime: resolve checkdead panic by refining `startm` lock handling in caller context
authorLucien Coffe <lucien.coffe@botify.com>
Fri, 21 Apr 2023 11:44:35 +0000 (13:44 +0200)
committerMichael Pratt <mpratt@google.com>
Fri, 28 Apr 2023 15:57:36 +0000 (15:57 +0000)
commitff059add10d71fe13239cf893c0cca113de1fc21
treee24684d74fd488d96d6ef5b7c34414004e7c2eaf
parent752ef81056691603c8b305a5f894215d3eb64b14
runtime: resolve checkdead panic by refining `startm` lock handling in caller context

This change addresses a `checkdead` panic caused by a race condition between
`sysmon->startm` and `checkdead` callers, due to prematurely releasing the
scheduler lock. The solution involves allowing a `startm` caller to acquire the
scheduler lock and call `startm` in this context. A new `lockheld` bool
argument is added to `startm`, which manages all lock and unlock calls within
the function. The`startIdle` function variable in `injectglist` is updated to
call `startm` with the lock held, ensuring proper lock handling in this
specific case. This refined lock handling resolves the observed race condition
issue.

Fixes #59600

Change-Id: I11663a15536c10c773fc2fde291d959099aa71be
Reviewed-on: https://go-review.googlesource.com/c/go/+/487316
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
src/runtime/proc.go