(Win 2000)

From the user app, I'm calling my kernel driver to fill the given
buffer with some data. The IOCTL is of type METHOD_OUT_DIRECT. The
buffer size can be from 128K to about 2MB. From the driver, I use
MmGetSystemAddressForMdlSafe() to get the address of the buffer. The
DDK doc says that the address is valid because it has been locked by
the manager already.

This has been working well for almost all the cases, but when I run
the app/driver together with a test program that creates a lot of
threads and takes up almost all of the system memory, I get a page
fault on the user buffer (without Soft-Ice, the sytem just reboots).
I've been told that when the OS is low on resources and experiences a
lot of page stealing, my "safe" buffer address may no longer be valid.

How can I be sure that the address MmGetSystemAddressForMdlSafe()
returns is valid? Would it help calling MmProbeAndLockPages()? I
don't mind if the OS fails to give me a valid address while the system
is very busy and low on memory, I'm just trying to avoid the reboot.

Re: Page Fault on locked memory by Maxim

Maxim
Tue Jun 01 12:37:57 CDT 2004

> How can I be sure that the address MmGetSystemAddressForMdlSafe()
> returns is valid?

It just returns NULL on failure.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Re: Page Fault on locked memory by ppp_l_qqq

ppp_l_qqq
Thu Jun 03 11:19:15 CDT 2004

Well, the problem is that it didn't return NULL.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message news:<O#oVT7$REHA.2976@TK2MSFTNGP10.phx.gbl>...
> > How can I be sure that the address MmGetSystemAddressForMdlSafe()
> > returns is valid?
>
> It just returns NULL on failure.

Re: Page Fault on locked memory by Alexander

Alexander
Thu Jun 03 15:02:12 CDT 2004

Are you touching system address or user-space address?

"the veloper" <ppp_l_qqq@yahoo.com> wrote in message
news:de0ced42.0406030819.4fdbf7ad@posting.google.com...
> Well, the problem is that it didn't return NULL.
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:<O#oVT7$REHA.2976@TK2MSFTNGP10.phx.gbl>...
> > > How can I be sure that the address MmGetSystemAddressForMdlSafe()
> > > returns is valid?
> >
> > It just returns NULL on failure.