[suspend] Wrap mmap and unmmap around critical sections to better handle library...
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 10 Sep 2015 18:48:14 +0000 (14:48 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 10 Sep 2015 18:55:37 +0000 (14:55 -0400)
commitda47e00abd3509a4a248cfcf8004f0921108238e
tree350ebd7e99f973b9a1ea10885a096780f9fd65eb
parentd7906b3e5a5e1282bef9f30beddddb1a8427d234
[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