aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/trace.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/trace.go b/src/runtime/trace.go
index 58956383a3..805c34f483 100644
--- a/src/runtime/trace.go
+++ b/src/runtime/trace.go
@@ -529,7 +529,12 @@ func traceEvent(ev byte, skip int, args ...uint64) {
nstk = callers(skip, buf.stk[:])
} else if gp != nil {
gp = mp.curg
- nstk = gcallers(gp, skip, buf.stk[:])
+ // This may happen when tracing a system call,
+ // so we must lock the stack.
+ if gcTryLockStackBarriers(gp) {
+ nstk = gcallers(gp, skip, buf.stk[:])
+ gcUnlockStackBarriers(gp)
+ }
}
if nstk > 0 {
nstk-- // skip runtime.goexit