The problem comes from the following set of events:
The caller maps the view of a section backed by a file in its virtual space.
Then, it attemps to write to the mapping. This is causing a legit page fault.
This brings us to MmNotPresentFaultSectionView() where MM will try to read the page from the FSD.
By doing so, it will mark the associated section segment as waiting for paging event.
Unfortunately, because the FSD is performing late CC init, MiPageRead() cannot succeed and the page is never loaded. And the section segment is still marked as waiting for input.
Later on, when calling NtUnmapViewOfSection(), we end to MmFreeSectionPage() which waits on reading to finish before unmapping. This cannot happen as it failed earlier. Hence the deadlock in MM which makes the callee stuck.
I guess our cleanup path in MmNotPresentFaultSectionView() is guilty as it doesn't reset states properly. Need to find out of to make this properly.
CCing zefklop, in case he would already have a quick win in mind.