From: Brad Fitzpatrick Date: Tue, 12 May 2015 17:01:37 +0000 (-0700) Subject: runtime: add check for malloc in a signal handler X-Git-Tag: go1.5beta1~612 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6f2c0f1585e50bf2d8bcc11058373e38f5321227;p=gostls13.git runtime: add check for malloc in a signal handler Change-Id: Ic8ebbe81eb788626c01bfab238d54236e6e5ef2b Reviewed-on: https://go-review.googlesource.com/9964 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index a0cd8bb433..2d7e55643f 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -509,6 +509,9 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { if mp.mallocing != 0 { throw("malloc deadlock") } + if mp.gsignal == getg() { + throw("malloc during signal") + } mp.mallocing = 1 shouldhelpgc := false