]> Cypherpunks.ru repositories - gostls13.git/commit
runtime/pprof: prevent a deadlock that SIGPROF might create on mips{,le}
authorVladimir Stefanovic <vladimir.stefanovic@imgtec.com>
Thu, 4 May 2017 14:45:29 +0000 (16:45 +0200)
committerCherry Zhang <cherryyz@google.com>
Wed, 26 Jul 2017 13:29:59 +0000 (13:29 +0000)
commit835dfef939879b284d4c0f4e1726491f27e4f1ee
treed163be310654d08362c9f7b620bf8e4c46d0dca2
parentdf91b8044dbe790c69c16058330f545be069cc1f
runtime/pprof: prevent a deadlock that SIGPROF might create on mips{,le}

64bit atomics on mips/mipsle are implemented using spinlocks. If SIGPROF
is received while the program is in the critical section, it will try to
write the sample using the same spinlock, creating a deadloop.
Prevent it by creating a counter of SIGPROFs during atomic64 and
postpone writing the sample(s) until called from elsewhere, with
pc set to _LostSIGPROFDuringAtomic64.

Added a test case, per Cherry's suggestion. Works around #20146.

Change-Id: Icff504180bae4ee83d78b19c0d9d6a80097087f9
Reviewed-on: https://go-review.googlesource.com/42652
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/cpuprof.go
src/runtime/pprof/pprof_test.go
src/runtime/proc.go