diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index a0cd8bb4330..2d7e55643f7 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