]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix saved PC/SP after safe-point function in syscall
authorAustin Clements <austin@google.com>
Mon, 13 Jul 2015 22:30:10 +0000 (18:30 -0400)
committerAustin Clements <austin@google.com>
Wed, 15 Jul 2015 21:09:16 +0000 (21:09 +0000)
Running a safe-point function on syscall entry uses systemstack() and
hence clobbers g.sched.pc and g.sched.sp. Fix this by re-saving them
after the systemstack, just like in the other uses of systemstack in
reentersyscall.

Change-Id: I47868a53eba24d81919fda56ef6bbcf72f1f922e
Reviewed-on: https://go-review.googlesource.com/12125
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/proc1.go

index 6e9bf882253c1804fa9e6d8b58e65e75c51d8765..fccc2ac70fe4d8332b27d1f5308b3a685eeb04af 100644 (file)
@@ -1831,6 +1831,7 @@ func reentersyscall(pc, sp uintptr) {
        if _g_.m.p.ptr().runSafePointFn != 0 {
                // runSafePointFn may stack split if run on this stack
                systemstack(runSafePointFn)
+               save(pc, sp)
        }
 
        _g_.m.syscalltick = _g_.m.p.ptr().syscalltick