mirror of
https://github.com/golang/go
synced 2024-11-19 03:04:42 -07:00
runtime: remove write barrier on G in sighandler
sighandler may run during a stop-the-world without a P, so it's not allowed to have write barriers. Fix the G write to disable the write barrier (this is safe because the G is reachable from allgs) and mark the function nowritebarrier. Change-Id: I907f05d3829e24eeb15fa4d020598af36710e87e Reviewed-on: https://go-review.googlesource.com/8020 Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
222f371118
commit
9b0ea6aa27
@ -6,6 +6,8 @@ package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(_ureg *ureg, note *byte, gp *g) int {
|
||||
_g_ := getg()
|
||||
var t sigTabT
|
||||
@ -79,7 +81,7 @@ func sighandler(_ureg *ureg, note *byte, gp *g) int {
|
||||
}
|
||||
Throw:
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
startpanic()
|
||||
print(notestr, "\n")
|
||||
print("PC=", hex(c.pc()), "\n")
|
||||
|
@ -24,6 +24,8 @@ func dumpregs(c *sigctxt) {
|
||||
print("gs ", hex(c.gs()), "\n")
|
||||
}
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
_g_ := getg()
|
||||
c := &sigctxt{info, ctxt}
|
||||
@ -98,7 +100,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
}
|
||||
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
startpanic()
|
||||
|
||||
if sig < uint32(len(sigtable)) {
|
||||
|
@ -37,6 +37,8 @@ func dumpregs(c *sigctxt) {
|
||||
|
||||
var crashing int32
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
_g_ := getg()
|
||||
c := &sigctxt{info, ctxt}
|
||||
@ -134,7 +136,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
}
|
||||
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
|
||||
if crashing == 0 {
|
||||
startpanic()
|
||||
|
@ -32,6 +32,8 @@ func dumpregs(c *sigctxt) {
|
||||
print("fault ", hex(c.fault()), "\n")
|
||||
}
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
_g_ := getg()
|
||||
c := &sigctxt{info, ctxt}
|
||||
@ -93,7 +95,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
}
|
||||
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
startpanic()
|
||||
|
||||
if sig < uint32(len(sigtable)) {
|
||||
|
@ -45,6 +45,8 @@ func dumpregs(c *sigctxt) {
|
||||
print("fault ", hex(c.fault()), "\n")
|
||||
}
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
_g_ := getg()
|
||||
c := &sigctxt{info, ctxt}
|
||||
@ -106,7 +108,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
}
|
||||
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
startpanic()
|
||||
|
||||
if sig < uint32(len(sigtable)) {
|
||||
|
@ -50,6 +50,8 @@ func dumpregs(c *sigctxt) {
|
||||
print("trap ", hex(c.trap()), "\n")
|
||||
}
|
||||
|
||||
// May run during STW, so write barriers are not allowed.
|
||||
//go:nowritebarrier
|
||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
_g_ := getg()
|
||||
c := &sigctxt{info, ctxt}
|
||||
@ -111,7 +113,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
}
|
||||
|
||||
_g_.m.throwing = 1
|
||||
_g_.m.caughtsig = gp
|
||||
setGNoWriteBarrier(&_g_.m.caughtsig, gp)
|
||||
startpanic()
|
||||
|
||||
if sig < uint32(len(sigtable)) {
|
||||
|
Loading…
Reference in New Issue
Block a user