MmProbeAndLockPages assertion

Hi,

The following is my situation:

  1. The Driver verifier is up & running against my FSD
  2. “Q” is the drive mounted by my FSD (no filters here)
  3. first, copy c:\winnt\notepad.exe to q:\bin
  4. then IMMEDIATELY try to execute q:\bin\notepad.exe

The following is the assert I always get in the Windbg:

*** Assertion failed: Pfn1->u3.e1.LockCharged == 1
*** Source File: D:\nt\private\ntos\mm\iosup.c, line 772

Break, Ignore, Terminate Process or Terminate Thread (bipt)?

The stack is as follows:

Args to Child
819c9390 804826e5 0000a5aa nt!DbgBreakPoint
8044f318 8044f2f8 00000304 nt!RtlAssert+0x9a
ff895408 00000000 00000001 nt!MmProbeAndLockPages+0x5da
ff895408 00000000 00000001 nt!VerifierProbeAndLockPages+0x47
… My FSD’s read dispatch…
00000000 825e30d8 825e30c8 nt!IovSpecialIrpCallDriver+0xe4
ff890c48 825e30d8 f57c4b30 nt!IoPageRead+0xb1
ff890c48 f57c4c88 00000000 nt!MiCreateImageFileMap+0xfa
f57c4d14 000f001f 00000000 nt!MmCreateSection+0x92f
05ffd4c8 000f001f 00000000 nt!NtCreateSection+0x145
05ffd4c8 000f001f 00000000 nt!KiSystemService+0x10a
05ffd4c8 000f001f 00000000 NTDLL!NtCreateSection+0xb
000c7330 000e3330 00000000 KERNEL32!CreateProcessW+0x61d

The following is the line of code that causes this assert:

MmProbeAndLockPages( mdl, KernelMode,
( MajorFunction == IRP_MJ_READ ?
IoWriteAccess : IoReadAccess ) );

So, I am in the Paging-Read path of my FSD, and am
preparing the MDL to pass to the lower-level disk driver
(for physical read).

If I do hit “i” (ignore), notepad.exe does run fine…

Any suggestions on what I could be doing wrong in preparing
the MDL? The following is what I am basically doing:

MDL* mdl = IoAllocateMdl( myBuffer, mySize, FALSE, FALSE, irp );
// verified mdl pointer

__try
{
MmProbeAndLockPages( mdl, KernelMode,
( majorFunction == IRP_MJ_READ ?
IoWriteAccess : IoReadAccess ) );

Status = IoCallDriver( DeviceObject, irp );
}
__except(…)

… somewhere down the line:
MmUnlockPages( mdl );
IoFreeMdl( mdl );

Thanks.

-Vipul.

NEVER probe and lock pages for paging I/O - THEY DO NOT EXIST IN VM YET!

The VM system is trying to satisfy a page fault. Once the RIGHT DATA is in
those pages, it can then create virtual mappings, but until that time what
you have is just a list of physical pages. Trying to probe/lock them is
going to lead to catastrophic results.

Regards,

Tony

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

Hope to see you at the next OSR file systems class in San Jose, CA September
16, 2002!

-----Original Message-----
From: Vipul [mailto:xxxxx@excite.com]
Sent: Monday, August 19, 2002 6:13 PM
To: File Systems Developers
Subject: [ntfsd] MmProbeAndLockPages assertion

Hi,

The following is my situation:

  1. The Driver verifier is up & running against my FSD
  2. “Q” is the drive mounted by my FSD (no filters here)
  3. first, copy c:\winnt\notepad.exe to q:\bin
  4. then IMMEDIATELY try to execute q:\bin\notepad.exe

The following is the assert I always get in the Windbg:

*** Assertion failed: Pfn1->u3.e1.LockCharged == 1
*** Source File: D:\nt\private\ntos\mm\iosup.c, line 772

Break, Ignore, Terminate Process or Terminate Thread (bipt)?

The stack is as follows:

Args to Child
819c9390 804826e5 0000a5aa nt!DbgBreakPoint
8044f318 8044f2f8 00000304 nt!RtlAssert+0x9a
ff895408 00000000 00000001 nt!MmProbeAndLockPages+0x5da
ff895408 00000000 00000001 nt!VerifierProbeAndLockPages+0x47
… My FSD’s read dispatch…
00000000 825e30d8 825e30c8 nt!IovSpecialIrpCallDriver+0xe4
ff890c48 825e30d8 f57c4b30 nt!IoPageRead+0xb1
ff890c48 f57c4c88 00000000 nt!MiCreateImageFileMap+0xfa
f57c4d14 000f001f 00000000 nt!MmCreateSection+0x92f
05ffd4c8 000f001f 00000000 nt!NtCreateSection+0x145
05ffd4c8 000f001f 00000000 nt!KiSystemService+0x10a
05ffd4c8 000f001f 00000000 NTDLL!NtCreateSection+0xb
000c7330 000e3330 00000000 KERNEL32!CreateProcessW+0x61d

The following is the line of code that causes this assert:

MmProbeAndLockPages( mdl, KernelMode,
( MajorFunction == IRP_MJ_READ ?
IoWriteAccess : IoReadAccess ) );

So, I am in the Paging-Read path of my FSD, and am
preparing the MDL to pass to the lower-level disk driver
(for physical read).

If I do hit “i” (ignore), notepad.exe does run fine…

Any suggestions on what I could be doing wrong in preparing
the MDL? The following is what I am basically doing:

MDL* mdl = IoAllocateMdl( myBuffer, mySize, FALSE, FALSE, irp );
// verified mdl pointer

__try
{
MmProbeAndLockPages( mdl, KernelMode,
( majorFunction == IRP_MJ_READ ?
IoWriteAccess : IoReadAccess ) );

Status = IoCallDriver( DeviceObject, irp );
}
__except(…)

… somewhere down the line:
MmUnlockPages( mdl );
IoFreeMdl( mdl );

Thanks.

-Vipul.


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%