Tool\Way to leak System PTE

Hi,

I have been looking into an customer issue where
MmGetSystemAddressForMdlSafe() failed to assign system address space for an
user buffer.
(The user buffer was of size 256Mb and maybe fragmented sysptes be the
reason for failure )

[Customer Dump]

4: kd> !vm 1

*** Virtual Memory Usage ***

Physical Memory: 4190998 ( 16763992 Kb)

Free System PTEs: 32915570 ( 131662280 Kb)

******* 4 system PTE allocations have failed ******

Even though we have figured the probable fix BUT was trying to search for a
way\tool to simulate PTE leak to confirm the changes.
Can someone please guide how can we simulate PTE leak on 64bit windows 2012
setup?

[Test Machine]
0: kd> !vm 0x21
*** Virtual Memory Usage ***
Physical Memory: 262030 ( 1048120 Kb)

Free System PTEs: 33525661 ( 134102644 Kb)

Regards,
-Vipul

I’m not sure what you’re looking for.

Are you just looking to make your call to MmGetSystemAddressForMdlSafe fail
so that you can test your error handling? If so, Driver Verifier’s Low
Resource Simulation should help (though it’s really non-deterministic in
what’s it’s going to fail). The easiest thing to do though would be just to
change your code to return an error.

Or are you really looking to introduce a System PTE leak? I’m not sure what
this is going to tell you, but you could easily leak System PTEs by calling
MmAllocateMappingAddress and never freeing them.

-scott
OSR
@OSRDrivers

“Vipul” wrote in message news:xxxxx@ntdev…
Hi,

I have been looking into an customer issue where
MmGetSystemAddressForMdlSafe() failed to assign system address space for an
user buffer.
(The user buffer was of size 256Mb and maybe fragmented sysptes be the
reason for failure )

[Customer Dump]

4: kd> !vm 1

Virtual Memory Usage

Physical Memory: 4190998 ( 16763992 Kb)

Free System PTEs: 32915570 ( 131662280 Kb)

*4 system PTE allocations have failed

Even though we have figured the probable fix BUT was trying to search for a
way\tool to simulate PTE leak to confirm the changes.
Can someone please guide how can we simulate PTE leak on 64bit windows 2012
setup?

[Test Machine]
0: kd> !vm 0x21
Virtual Memory Usage
Physical Memory: 262030 ( 1048120 Kb)

Free System PTEs: 33525661 ( 134102644 Kb)

Regards,
-Vipul