From e42413cecc17bfd963ffe01341aad8dd42b9b816 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 13 Jul 2015 18:30:10 -0400 Subject: [PATCH] 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 --- src/runtime/proc1.go | 1 + 1 file changed, 1 insertion(+) 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 -- 2.50.0