]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid write barrier in startpanic_m
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 18 Dec 2018 20:04:53 +0000 (20:04 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 19 Dec 2018 00:13:22 +0000 (00:13 +0000)
commit9ed9df6ca27850704133de1ceb94407c635beb82
tree73cad1a12511e6327963e0a69f1bbb952909f270
parente3b4b7baad555f74b6fbc0ddc00d46ed0ac03a0a
runtime: avoid write barrier in startpanic_m

startpanic_m could be called correctly in a context where there's a
valid G, a valid M, but no P, for example in a signal handler which
panics. Currently, startpanic_m has write barriers enabled because
write barriers are permitted if a G's M is dying. However, all the
current write barrier implementations assume the current G has a P.

Therefore, in this change we disable write barriers in startpanic_m,
remove the only pointer write which clears g.writebuf, and fix up gwrite
to ignore the writebuf if the current G's M is dying, rather than
relying on it being nil in the dying case.

Fixes #26575.

Change-Id: I9b29e6b9edf00d8e99ffc71770c287142ebae086
Reviewed-on: https://go-review.googlesource.com/c/154837
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/panic.go
src/runtime/print.go