Commit 6f2c0f15 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

runtime: add check for malloc in a signal handler

Change-Id: Ic8ebbe81eb788626c01bfab238d54236e6e5ef2b
Reviewed-on: https://go-review.googlesource.com/9964
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent d4472799
...@@ -509,6 +509,9 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { ...@@ -509,6 +509,9 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {
if mp.mallocing != 0 { if mp.mallocing != 0 {
throw("malloc deadlock") throw("malloc deadlock")
} }
if mp.gsignal == getg() {
throw("malloc during signal")
}
mp.mallocing = 1 mp.mallocing = 1
shouldhelpgc := false shouldhelpgc := false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment