mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: see whether gp==nil before checking preemption state
Recent we changed from using gFromTLS to using gFromSP, which apparently sometimes returns nil. This causes crashes when dereferenced. Fix that by not checking for preemption in the case that gFromSP returns nil. Fixes #44679. Change-Id: I0199ebe7cd113379c5fa35c27932d913df79092a Reviewed-on: https://go-review.googlesource.com/c/go/+/297390 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
46ffbec1d6
commit
98dd205fa4
1 changed files with 1 additions and 1 deletions
|
|
@ -1380,7 +1380,7 @@ func preemptM(mp *m) {
|
|||
|
||||
// Does it want a preemption and is it safe to preempt?
|
||||
gp := gFromSP(mp, c.sp())
|
||||
if wantAsyncPreempt(gp) {
|
||||
if gp != nil && wantAsyncPreempt(gp) {
|
||||
if ok, newpc := isAsyncSafePoint(gp, c.ip(), c.sp(), c.lr()); ok {
|
||||
// Inject call to asyncPreempt
|
||||
targetPC := funcPC(asyncPreempt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue