]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.5] runtime: prevent sigprof during all stack barrier ops
authorAustin Clements <austin@google.com>
Wed, 18 Nov 2015 19:10:40 +0000 (14:10 -0500)
committerAustin Clements <austin@google.com>
Fri, 20 Nov 2015 19:55:36 +0000 (19:55 +0000)
commit08ea82529a12506da7b329c2d0f6af57b714514a
tree6815d0a582e5d37e20d5d799e766db3d3a7111fe
parent7ab4cba9ad76f8853f11de1a72ff1db790c5ea61
[release-branch.go1.5] runtime: prevent sigprof during all stack barrier ops

A sigprof during stack barrier insertion or removal can crash if it
detects an inconsistency between the stkbar array and the stack
itself. Currently we protect against this when scanning another G's
stack using stackLock, but we don't protect against it when unwinding
stack barriers for a recover or a memmove to the stack.

This commit cleans up and improves the stack locking code. It
abstracts out the lock and unlock operations. It uses the lock
consistently everywhere we perform stack operations, and pushes the
lock/unlock down closer to where the stack barrier operations happen
to make it more obvious what it's protecting. Finally, it modifies
sigprof so that instead of spinning until it acquires the lock, it
simply doesn't perform a traceback if it can't acquire it. This is
necessary to prevent self-deadlock.

Updates #11863, which introduced stackLock to fix some of these
issues, but didn't go far enough.

Updates #12528.

Change-Id: I9d1fa88ae3744d31ba91500c96c6988ce1a3a349
Reviewed-on: https://go-review.googlesource.com/17036
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/17057
src/runtime/mgcmark.go
src/runtime/proc1.go