(2nd request) Unsuccessful Probe and Lock After Write

I sent this earlier and got no answer but didn’t actually ask a question.
Why am I unable to probe and lock the buffer that was just written (see
below)? Since there is a System VA does that mean it can be used to access
the buffer without probing and locking? I want to give the buffer address to
another thread so it can write the data. If I run WINDBG, it can see the
entire buffer given the system va address.

After a write operation occurs I have an MDL which I can’t probe and lock.
I make the call:
MmProbeAndLockPages(MdlChain, (KPROCESSOR_MODE)KernelMode, IoReadAccess);
I get the exception STATUS_ACCESS_VIOLATION. The MDL flags set are:
MDL_MAPPED_TO_SYSTEM_VA, MDL_ALLOCATED_FIXED_SIZE, MDL_PARTIAL. I get the
exception back in the main thread after synchronizing with the completion
routine.

Thanks,
Ken


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Ken,

I think the problem here is that there are plenty of reasons a probe and
lock pages can fail, so it is tough to suggest why this might be the case.
However, I would note that it sure seems like (from the additional
information you gave us) you have an MDL that isn’t mapped to a user virtual
address.

I say this because you did not state that the MDL_PAGES_LOCKED bit is set -
so this MDL is NOT already probed/locked. And, while you are specifying
kernel mode access, if the PTE entries for the virtual address of the MDL
are invalid, it is going to fail (kernel components can’t access invalid
memory locations any more than user mode components.) Thus, this isn’t an
access fault (writing on read-only memory, or accessing an address that is
not available in a given processor mode) but more likely it has to do with
the fact that the MDL was never built for a user virtual buffer.

For example, when satisfying a page fault, the Memory Manager builds an MDL
that describes a range of physical pages that haven’t been mapped into any
user virtual address space as of yet. If you tried to probe and lock the
pages from such an MDL it would just fail. My GUESS is that this is exactly
the case you’ve stumbled upon.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Ken Galipeau [mailto:xxxxx@legato.com]
Sent: Thursday, September 13, 2001 4:48 PM
To: File Systems Developers
Subject: [ntfsd] (2nd request) Unsuccessful Probe and Lock After Write

I sent this earlier and got no answer but didn’t actually ask a question.
Why am I unable to probe and lock the buffer that was just written (see
below)? Since there is a System VA does that mean it can be used to access
the buffer without probing and locking? I want to give the buffer address to
another thread so it can write the data. If I run WINDBG, it can see the
entire buffer given the system va address.

After a write operation occurs I have an MDL which I can’t probe and lock.
I make the call:
MmProbeAndLockPages(MdlChain, (KPROCESSOR_MODE)KernelMode, IoReadAccess);
I get the exception STATUS_ACCESS_VIOLATION. The MDL flags set are:
MDL_MAPPED_TO_SYSTEM_VA, MDL_ALLOCATED_FIXED_SIZE, MDL_PARTIAL. I get the
exception back in the main thread after synchronizing with the completion
routine.

Thanks,
Ken

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Tony,
Thanks for the reply. So how do I access the data pointed to by the MDL so I
can write it to disk? Can I use the System VA?

Thanks,
Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Tony Mason
Sent: Friday, September 14, 2001 4:53 PM
To: File Systems Developers
Subject: [ntfsd] RE: (2nd request) Unsuccessful Probe and Lock After
Write

Ken,

I think the problem here is that there are plenty of reasons a probe and
lock pages can fail, so it is tough to suggest why this might be the case.
However, I would note that it sure seems like (from the additional
information you gave us) you have an MDL that isn’t mapped to a user virtual
address.

I say this because you did not state that the MDL_PAGES_LOCKED bit is set -
so this MDL is NOT already probed/locked. And, while you are specifying
kernel mode access, if the PTE entries for the virtual address of the MDL
are invalid, it is going to fail (kernel components can’t access invalid
memory locations any more than user mode components.) Thus, this isn’t an
access fault (writing on read-only memory, or accessing an address that is
not available in a given processor mode) but more likely it has to do with
the fact that the MDL was never built for a user virtual buffer.

For example, when satisfying a page fault, the Memory Manager builds an MDL
that describes a range of physical pages that haven’t been mapped into any
user virtual address space as of yet. If you tried to probe and lock the
pages from such an MDL it would just fail. My GUESS is that this is exactly
the case you’ve stumbled upon.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Ken Galipeau [mailto:xxxxx@legato.com]
Sent: Thursday, September 13, 2001 4:48 PM
To: File Systems Developers
Subject: [ntfsd] (2nd request) Unsuccessful Probe and Lock After Write

I sent this earlier and got no answer but didn’t actually ask a question.
Why am I unable to probe and lock the buffer that was just written (see
below)? Since there is a System VA does that mean it can be used to access
the buffer without probing and locking? I want to give the buffer address to
another thread so it can write the data. If I run WINDBG, it can see the
entire buffer given the system va address.

After a write operation occurs I have an MDL which I can’t probe and lock.
I make the call:
MmProbeAndLockPages(MdlChain, (KPROCESSOR_MODE)KernelMode, IoReadAccess);
I get the exception STATUS_ACCESS_VIOLATION. The MDL flags set are:
MDL_MAPPED_TO_SYSTEM_VA, MDL_ALLOCATED_FIXED_SIZE, MDL_PARTIAL. I get the
exception back in the main thread after synchronizing with the completion
routine.

Thanks,
Ken

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@legato.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com