[suspend] Wrap mmap and unmmap around critical sections to better handle library...
commitc02307527f76d3f6edb49f6e89b1356287d730d5
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 10 Sep 2015 18:48:14 +0000 (10 14:48 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 10 Sep 2015 18:56:19 +0000 (10 14:56 -0400)
treea2667ff7f52b57400486d31b267265839925c2ed
parente82dc9b80ae76784f6e17d2d465e1b7e880a0982
[suspend] Wrap mmap and unmmap around critical sections to better handle library interposing. Fixes #19379

Instruments uses library interposing to record calls to mmap and munmap. It does take lock within the interposers
which means the async suspend could suspend a thread holding such lock while sgen tries to mmap more memory in,
causing a deadlock.

The workaround is to protect our uses of mmap and munmap in the hopes that they are enough to reduce the likelihood
of those hangs happening.
mono/utils/mono-mmap.c