From: Austin Clements Date: Mon, 13 Jul 2015 22:30:10 +0000 (-0400) Subject: runtime: fix saved PC/SP after safe-point function in syscall X-Git-Tag: go1.5beta2~18 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e42413cecc17bfd963ffe01341aad8dd42b9b816;p=gostls13.git runtime: fix saved PC/SP after safe-point function in syscall 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 --- diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index 6e9bf88225..fccc2ac70f 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -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