After 6 years, I made a blog thingy again. This time about MmScrubMemory. An innocuous looking function that has bitten my ass several times in the last several years. And if you're developing a hypervisor, it might've bitten yours, too. wbenny.github.io/2024-11-21-…

Nov 22, 2024 · 1:05 AM UTC

4
27
96
10,065
Sort replies: Relevant Recent Liked
Replying to @PetrBenes
Wow, the more you know! I think some regions ought to be excluded from scrub smhow, i.e. uefi RT, dev mapped io? ☠️: you may inc refcount atomically, but OS does not! However, modern OS [spin]-locks pfn itself before adjust, so you can too: _MMPFN.u2.LockBit (pfn+18, bit 3F).
2
4
638
Oh I didn't look into mapped IO to be honest, but it would make sense not to touch it. But from a brief look, I see that MmScrubMemory takes the PFN list directly from MmPhysicalMemoryBlock (or MI_PARTITION::Core.MemoryRuns), which contains only physical memory ranges.
1
2
237
Replying to @PetrBenes
Loved it, looking forward to reading more 👏🏽
1
326