MmMapLockedPagesSpecifyCache: Execption under Server2003-32

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.


NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
{
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,
LowestAcceptableAddress,
HighestAcceptableAddress,
BoundaryAddressMultiple,
MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}

The allocation works fine. As you can see I checked that CommonBufferMdl and
KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request from user
space I call to the following code:



case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon IOCTL
request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,
NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
break;

When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs) Free
x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE contents
if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to
set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx” referenced
memory at “0x%08lx”. The required data was not placed into memory because of
an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,

154:
NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner

As you can see the reason for the exception is MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There are no
relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.

Make sure your debugger has the symbols loaded, then repost the crash stack again.

You might want to fix your symbols.

.symfix
.reload -f -n

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
Sent: Tuesday, December 13, 2011 7:17 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.

----------------------------------------------------------------------------
-------------------------------------------------------------------
NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt) {
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,

LowestAcceptableAddress,

HighestAcceptableAddress,

BoundaryAddressMultiple,

MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}
----------------------------------------------------------------------------
-------------------------------------------------------------------
The allocation works fine. As you can see I checked that CommonBufferMdl and
KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request from user
space I call to the following code:

----------------------------------------------------------------------------
-------------------------------------------------------------------

case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY )pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon IOCTL
request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,
NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
break;

----------------------------------------------------------------------------
------------------------------------------------------------------
When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:
----------------------------------------------------------------------------
--------------------------------------------------------------------
Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c)
Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
WARNING: Unable to verify timestamp for ntkrnlpa.exe
ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs) Free
x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
WARNING: Unable to verify timestamp for ntkrnlpa.exe
ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list





Bugcheck Analysis






Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

WARNING: Unable to verify timestamp for mssmbios.sys
ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
WARNING: Unable to verify timestamp for wdf01000.sys
ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
WARNING: Unable to verify timestamp for Npfs.SYS
ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS

******
******
Your debugger is not using the correct symbols
******
In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.
******
Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.
******
Type referenced: nt!_KPRCB
******


******
******
Your debugger is not using the correct symbols
******
In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.
******
Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.
******
Type referenced: nt!_KPRCB
******


******
******
Your debugger is not using the correct symbols
******
In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.
******
Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.
******
Type referenced: nt!_KPRCB
******

Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner
---------

20: kd> !analyze -v




Bugcheck Analysis



***


KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE contents
if arg1 is a PTE address)

Debugging Details:
------------------

** Kernel symbols are WRONG. Please fix symbols to do analysis.




Your debugger is not using the correct symbols

In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.

Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.

Type referenced: nt!_KPRCB





Your debugger is not using the correct symbols

In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.

Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.

Type referenced: nt!_KPRCB





Your debugger is not using the correct symbols

In order for this command to work properly, your symbol path
must point to .pdb files that have full type information.

Certain .pdb files (such as the public OS symbols) do not
contain the required information. Contact the group that
provided you with these symbols if you need this command to
work.

Type referenced: nt!_KPRCB



ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to
set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx” referenced
memory at “0x%08lx”. The required data was not placed into memory because of

an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,
> 154:
> NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner
----------------------------------------------------------------------------
-----------------------------------------------------------

As you can see the reason for the exception is MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There are no
relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool
(DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages()
with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under
stress what you may think is a non-paged and locked down buffer actually
isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.


NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
{
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,

LowestAcceptableAddress,

HighestAcceptableAddress,

BoundaryAddressMultiple,

MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}

The allocation works fine. As you can see I checked that
CommonBufferMdl and KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request
from user space I call to the following code:



case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon
IOCTL request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,

NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
break;

When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
Free x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************

* *
* Bugcheck Analysis *
* *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************

* *
* Bugcheck Analysis *
* *
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically
caused by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed
because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE
contents if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ;
.reload’ to set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
referenced memory at “0x%08lx”. The required data was not placed into
memory because of an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may
be wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004
Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,
> 154: NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner

As you can see the reason for the exception is
MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There
are no relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Dear Mark,

I tried it but without try/except. Instead of MmBuildMdlForNonPagedPool I
called to:
MmProbeAndLockPages (devExt->pMdl, UserMode, IoReadAccess );

With MmProbeAndLockPages I got exception upon DriverEntry (when I enabled
the driver)

Thanks,
Zvika.

-----Original Message-----
From: Mark S. Edwards
Sent: Tuesday, December 13, 2011 6:01 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under
Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool
(DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages()
with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under
stress what you may think is a non-paged and locked down buffer actually
isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.


NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
{
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,

LowestAcceptableAddress,

HighestAcceptableAddress,

BoundaryAddressMultiple,

MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}

The allocation works fine. As you can see I checked that CommonBufferMdl
and KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request from
user space I call to the following code:



case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon IOCTL
request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,

NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
break;

When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
Free x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused
by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed
because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE
contents if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to
set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
referenced memory at “0x%08lx”. The required data was not placed into
memory because of an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,
> 154: NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner

As you can see the reason for the exception is
MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There are no
relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

That’s because the MmProbeAndLock() has to be called with KernelMode access.

I also noticed that you do:
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,

Do you only have one user mode client that will call you ? If not, this
will break when multiple processes are involved. Each different process
will require it’s own mapping in to it’s own user space.

Mark.

On 13/12/2011 17:03, Zvi Vered wrote:

Dear Mark,

I tried it but without try/except. Instead of
MmBuildMdlForNonPagedPool I called to:
MmProbeAndLockPages (devExt->pMdl, UserMode, IoReadAccess );

With MmProbeAndLockPages I got exception upon DriverEntry (when I
enabled the driver)

Thanks,
Zvika.

-----Original Message----- From: Mark S. Edwards
Sent: Tuesday, December 13, 2011 6:01 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under
Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool
(DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages()
with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under
stress what you may think is a non-paged and locked down buffer actually
isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:
> Dear Members,
>
> Upon DriverEntry I call to the following code to allocate a 16MB of
> configuous buffer.
>
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>
> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
> {
> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>
> DevExt->KernelCommonBuffer =
> MmAllocateContiguousMemorySpecifyCache (COMMON_BUFFER_SIZE,
>
> LowestAcceptableAddress,
>
> HighestAcceptableAddress,
>
> BoundaryAddressMultiple,
>
> MmCached);
> if (!DevExt->KernelCommonBuffer)
> {
> KdPrint ((“MmAllocateContiguousMemory failed\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> DevExt->CommonBufferMdl = IoAllocateMdl
> (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);
>
> if (!DevExt->CommonBufferMdl)
> {
> KdPrint ((“IoAllocateMdl failed.\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>
> return STATUS_SUCCESS;
> }
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>
> The allocation works fine. As you can see I checked that
> CommonBufferMdl and KernelCommonBuffer are valid
>
> Now I have to map this buffer to user space. So upon IOCTL request
> from user space I call to the following code:
>
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>
> …
> case FIOA_ALLOCATE_COMMON_BUFFER:
> status = WdfRequestRetrieveOutputBuffer
> (Request,sizeof(FIOA_READ_LONG_REPLY),
> &pOutBuffer, &Length);
>
> pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;
>
> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>
> //Map common buffer to user space. This can be done only upon
> IOCTL request
> __try
> {
> devExt->UserSpaceCommonBuffer =
> MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
> UserMode,
> MmCached ,
> NULL,
> FALSE,
>
> NormalPagePriority);
>
> if (!devExt->UserSpaceCommonBuffer)
> {
> KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
> }
> }
> __except (EXCEPTION_EXECUTE_HANDLER)
> {
> devExt->UserSpaceCommonBuffer = 0x0;
> KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
> %x\n”,GetExceptionCode()));
> }
>
> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>
> WdfRequestCompleteWithInformation
> (Request,STATUS_SUCCESS,sizeof(long));
> break;
> …
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
>
> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
> Following is the analyze -v of the dump file:
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
> Copyright (c) Microsoft Corporation. All rights reserved.
>
>
> Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is:
> M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
> Executable search path is:
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24
> procs) Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS
> Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
> Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
> System Uptime: 0 days 0:23:15.890
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Loading Kernel Symbols
> …
> …
> Loading User Symbols
> Loading unloaded module list
> …
> *******************************************************************************
>
> * *
> * Bugcheck Analysis *
> * *
> *******************************************************************************
>
>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> *** WARNING: Unable to verify timestamp for mssmbios.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> mssmbios.sys
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> Unable to load image wdf01000.sys, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for wdf01000.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
> *** WARNING: Unable to verify timestamp for Npfs.SYS
> *** ERROR: Module load completed but symbols could not be loaded for
> Npfs.SYS
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
> *******************************************************************************
>
> * *
> * Bugcheck Analysis *
> * *
> *******************************************************************************
>
>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically
> caused by
> a bad block in the paging file or disk controller error. Also see
> KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
> it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed
> because
> a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or
> PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> *************************************************************************
>
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
>
> ADDITIONAL_DEBUG_TEXT:
> Use ‘!findthebuild’ command to search for the target build information.
> If the build information is available, run ‘!findthebuild -s ;
> .reload’ to set symbol path and load symbols.
>
> MODULE_NAME: Pci9x5x
>
> FAULTING_MODULE: 80800000 nt
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> WARNING: Stack unwind information not available. Following frames may
> be wrong.
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
> b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
> b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004
> Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
> b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
> b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
> b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
> b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150: UserMode,
> 151:
> MmCached ,
> 152: NULL,
> 153: FALSE,
>> 154: NormalPagePriority);
> 155:
> 156: if (!devExt->UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint ((“MmMapLockedPagesSpecifyCache
> failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> IMAGE_NAME: Pci9x5x.sys
>
> BUCKET_ID: WRONG_SYMBOLS
>
> Followup: MachineOwner
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>
>
> As you can see the reason for the exception is
> MmMapLockedPagesSpecifyCache.
>
> I built the driver with “build -ceZ -w” and also ran PreFast. There
> are no relevant warnings.
>
> But why ??? What am I doing wrong ?
>
> Is it possible that mapping to user space is not possible under
> Server2003-32 ?
>
> The buffer has to be contiguous because this is what the FPGA needs.
>
> I read many answers on this problem but did not find an answer.
>
> Thank you in advance for your reply.
>
> Best regards,
> Zvika.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

After fixing symbols, please post the output of these commands (in addition to !analyze -v):

!pte
!vad 1

For example:

!pte c0006000
!vad 00c00000 1

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Tuesday, December 13, 2011 7:33 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

You might want to fix your symbols.

.symfix
.reload -f -n

The MmAllocateContiguousMemory/MmBuildMdlForNonPagedPool/MmMapLockedPagesSpecifyCache(UserMode) sequence should work.

MmMapLockedPagesSpecifyCache(KernelMode) with an MDL built using MmBuildMdlForNonPagedPool is the operation that’s disallowed (drivers are instead supposed to reuse the existing system mapping by calling MmGetSystemAddressForMdlSafe). I don’t think verifier actually catches this, but checked builds will assert on it.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark S. Edwards
Sent: Tuesday, December 13, 2011 8:02 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages() with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under stress what you may think is a non-paged and locked down buffer actually isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.




NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION
DevExt) {
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,

LowestAcceptableAddress,

HighestAcceptableAddress,

BoundaryAddressMultiple,

MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}



The allocation works fine. As you can see I checked that
CommonBufferMdl and KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request
from user space I call to the following code:





case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon
IOCTL request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,

NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
break;


When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:



Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c)
Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe Windows Server 2003 Kernel Version 3790 (Service Pack 2)
MP (24 procs) Free x86 compatible
Product: Server, suite: TerminalServer SingleUserTS Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8 Debug session
time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00) System Uptime: 0 days
0:23:15.890 Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32
error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

**********************************************************************
*********

* *
* Bugcheck Analysis *
* *
**********************************************************************
*********

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
***
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
***
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
*** Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
**********************************************************************
*********

* *
* Bugcheck Analysis *
* *
**********************************************************************
*********

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically
caused by a bad block in the paging file or disk controller error.
Also see KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or
0xC0000185, it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed
because a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or
PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE
contents if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
***
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
***
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
**********************************************************************
***

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ;
.reload’ to set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
referenced memory at “0x%08lx”. The required data was not placed into
memory because of an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may
be wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9 b84c3a3c
8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372 b84c3b7c
f72fa072 7b57a1f8 7ad0cfe8 00000004
Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0 b84c3bec
f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac b84c3c0c f7300824
852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824 b84c3c3c
8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec b84c3d6c
0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,
> 154: NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner


As you can see the reason for the exception is
MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There
are no relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Pavel,

I have some very similar code to expose a buffer from
MmAllocateContiguousMemory() in to user mode processes and Verifier
complained about MmBuildForNonPagedPool() being used rather than
MmProbeAndLockPages().

Indeed, it got rid of random BSOD for the case where the allocated
memory wasn’t actually locked.

Mark.

On 13/12/2011 20:06, Pavel Lebedynskiy wrote:

The MmAllocateContiguousMemory/MmBuildMdlForNonPagedPool/MmMapLockedPagesSpecifyCache(UserMode) sequence should work.

MmMapLockedPagesSpecifyCache(KernelMode) with an MDL built using MmBuildMdlForNonPagedPool is the operation that’s disallowed (drivers are instead supposed to reuse the existing system mapping by calling MmGetSystemAddressForMdlSafe). I don’t think verifier actually catches this, but checked builds will assert on it.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark S. Edwards
Sent: Tuesday, December 13, 2011 8:02 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages() with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under stress what you may think is a non-paged and locked down buffer actually isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:

> Dear Members,
>
> Upon DriverEntry I call to the following code to allocate a 16MB of
> configuous buffer.
>
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> —
>
> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION
> DevExt) {
> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>
> DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
> (COMMON_BUFFER_SIZE,
>
> LowestAcceptableAddress,
>
> HighestAcceptableAddress,
>
> BoundaryAddressMultiple,
>
> MmCached);
> if (!DevExt->KernelCommonBuffer)
> {
> KdPrint ((“MmAllocateContiguousMemory failed\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> DevExt->CommonBufferMdl = IoAllocateMdl
> (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);
>
> if (!DevExt->CommonBufferMdl)
> {
> KdPrint ((“IoAllocateMdl failed.\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>
> return STATUS_SUCCESS;
> }
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> —
>
> The allocation works fine. As you can see I checked that
> CommonBufferMdl and KernelCommonBuffer are valid
>
> Now I have to map this buffer to user space. So upon IOCTL request
> from user space I call to the following code:
>
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> —
>
> …
> case FIOA_ALLOCATE_COMMON_BUFFER:
> status = WdfRequestRetrieveOutputBuffer
> (Request,sizeof(FIOA_READ_LONG_REPLY),
> &pOutBuffer,&Length);
>
> pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;
>
> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>
> //Map common buffer to user space. This can be done only upon
> IOCTL request
> __try
> {
> devExt->UserSpaceCommonBuffer =
> MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
> UserMode,
> MmCached ,
> NULL,
> FALSE,
>
> NormalPagePriority);
>
> if (!devExt->UserSpaceCommonBuffer)
> {
> KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
> }
> }
> __except (EXCEPTION_EXECUTE_HANDLER)
> {
> devExt->UserSpaceCommonBuffer = 0x0;
> KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
> %x\n”,GetExceptionCode()));
> }
>
> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>
> WdfRequestCompleteWithInformation
> (Request,STATUS_SUCCESS,sizeof(long));
> break;
> …
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> –
>
> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
> Following is the analyze -v of the dump file:
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----
>
> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c)
> Microsoft Corporation. All rights reserved.
>
>
> Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is:
> M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
> Executable search path is:
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe Windows Server 2003 Kernel Version 3790 (Service Pack 2)
> MP (24 procs) Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8 Debug session
> time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00) System Uptime: 0 days
> 0:23:15.890 Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32
> error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe Loading Kernel Symbols
> …
> …
> Loading User Symbols
> Loading unloaded module list
> …
> **********************************************************************
> *********
>
> * *
> * Bugcheck Analysis *
> * *
> **********************************************************************
> *********
>
>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> *** WARNING: Unable to verify timestamp for mssmbios.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> mssmbios.sys
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> Unable to load image wdf01000.sys, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for wdf01000.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
> *** WARNING: Unable to verify timestamp for Npfs.SYS
> *** ERROR: Module load completed but symbols could not be loaded for
> Npfs.SYS
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> *** Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
> **********************************************************************
> *********
>
> * *
> * Bugcheck Analysis *
> * *
> **********************************************************************
> *********
>
>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically
> caused by a bad block in the paging file or disk controller error.
> Also see KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or
> 0xC0000185, it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed
> because a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or
> PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> **********************************************************************
> ***
>
> ADDITIONAL_DEBUG_TEXT:
> Use ‘!findthebuild’ command to search for the target build information.
> If the build information is available, run ‘!findthebuild -s ;
> .reload’ to set symbol path and load symbols.
>
> MODULE_NAME: Pci9x5x
>
> FAULTING_MODULE: 80800000 nt
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> WARNING: Stack unwind information not available. Following frames may
> be wrong.
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9 b84c3a3c
> 8083c965 c0600030 8524cd88 00000021 nt+0x52458
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372 b84c3b7c
> f72fa072 7b57a1f8 7ad0cfe8 00000004
> Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0 b84c3bec
> f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac b84c3c0c f7300824
> 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824 b84c3c3c
> 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec b84c3d6c
> 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150: UserMode,
> 151: MmCached ,
> 152: NULL,
> 153: FALSE,
>
>> 154: NormalPagePriority);
>>
> 155:
> 156: if (!devExt->UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint ((“MmMapLockedPagesSpecifyCache
> failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> IMAGE_NAME: Pci9x5x.sys
>
> BUCKET_ID: WRONG_SYMBOLS
>
> Followup: MachineOwner
> ----------------------------------------------------------------------
> -----------------------------------------------------------------
>
>
> As you can see the reason for the exception is
> MmMapLockedPagesSpecifyCache.
>
> I built the driver with “build -ceZ -w” and also ran PreFast. There
> are no relevant warnings.
>
> But why ??? What am I doing wrong ?
>
> Is it possible that mapping to user space is not possible under
> Server2003-32 ?
>
> The buffer has to be contiguous because this is what the FPGA needs.
>
> I read many answers on this problem but did not find an answer.
>
> Thank you in advance for your reply.
>
> Best regards,
> Zvika.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The verifier’s hook for MmBuildMdlForNonPagedPool makes sure that Mdl->StartVa does not point to an address in paged pool. MmAllocateContiguousMemory will pass this check (I just tried this on win8, and looking at WS03 sources it should also work there).

The documentation for MmBuildMdlForNonPagedPool also specifically mentions MmAllocateContiguousMemory as one of the acceptable sources for the MDL’s buffer.

Using MmBuildMdlForNonPagedPool with an MDL describing a pageable buffer is of course a bug and can cause all sorts of issues, but this is not what the OP is doing.

Pavel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark S. Edwards
Sent: Tuesday, December 13, 2011 12:19 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

Pavel,

I have some very similar code to expose a buffer from
MmAllocateContiguousMemory() in to user mode processes and Verifier complained about MmBuildForNonPagedPool() being used rather than MmProbeAndLockPages().

Indeed, it got rid of random BSOD for the case where the allocated memory wasn’t actually locked.

Mark.

On 13/12/2011 20:06, Pavel Lebedynskiy wrote:

The MmAllocateContiguousMemory/MmBuildMdlForNonPagedPool/MmMapLockedPagesSpecifyCache(UserMode) sequence should work.

MmMapLockedPagesSpecifyCache(KernelMode) with an MDL built using MmBuildMdlForNonPagedPool is the operation that’s disallowed (drivers are instead supposed to reuse the existing system mapping by calling MmGetSystemAddressForMdlSafe). I don’t think verifier actually catches this, but checked builds will assert on it.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark S.
Edwards
Sent: Tuesday, December 13, 2011 8:02 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under
Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages() with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under stress what you may think is a non-paged and locked down buffer actually isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:

> Dear Members,
>
> Upon DriverEntry I call to the following code to allocate a 16MB of
> configuous buffer.
>
> ---------------------------------------------------------------------
> -
> ---------------------------------------------------------------------
> -
> —
>
> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION
> DevExt) {
> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>
> DevExt->KernelCommonBuffer =
> MmAllocateContiguousMemorySpecifyCache
> (COMMON_BUFFER_SIZE,
>
> LowestAcceptableAddress,
>
> HighestAcceptableAddress,
>
> BoundaryAddressMultiple,
>
> MmCached);
> if (!DevExt->KernelCommonBuffer)
> {
> KdPrint ((“MmAllocateContiguousMemory failed\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> DevExt->CommonBufferMdl = IoAllocateMdl
> (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);
>
> if (!DevExt->CommonBufferMdl)
> {
> KdPrint ((“IoAllocateMdl failed.\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>
> return STATUS_SUCCESS;
> }
> ---------------------------------------------------------------------
> -
> ---------------------------------------------------------------------
> -
> —
>
> The allocation works fine. As you can see I checked that
> CommonBufferMdl and KernelCommonBuffer are valid
>
> Now I have to map this buffer to user space. So upon IOCTL request
> from user space I call to the following code:
>
> ---------------------------------------------------------------------
> -
> ---------------------------------------------------------------------
> -
> —
>
> …
> case FIOA_ALLOCATE_COMMON_BUFFER:
> status = WdfRequestRetrieveOutputBuffer
> (Request,sizeof(FIOA_READ_LONG_REPLY),
> &pOutBuffer,&Length);
>
> pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;
>
> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>
> //Map common buffer to user space. This can be done only upon
> IOCTL request
> __try
> {
> devExt->UserSpaceCommonBuffer =
> MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
> UserMode,
> MmCached ,
> NULL,
> FALSE,
>
> NormalPagePriority);
>
> if (!devExt->UserSpaceCommonBuffer)
> {
> KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
> }
> }
> __except (EXCEPTION_EXECUTE_HANDLER)
> {
> devExt->UserSpaceCommonBuffer = 0x0;
> KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
> %x\n”,GetExceptionCode()));
> }
>
> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>
> WdfRequestCompleteWithInformation
> (Request,STATUS_SUCCESS,sizeof(long));
> break;
> …
> ---------------------------------------------------------------------
> -
> ---------------------------------------------------------------------
> -
> –
>
> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
> Following is the analyze -v of the dump file:
> ---------------------------------------------------------------------
> -
> ---------------------------------------------------------------------
> -
> ----
>
> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright
> (c) Microsoft Corporation. All rights reserved.
>
>
> Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is:
> M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
> Executable search path is:
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe Windows Server 2003 Kernel Version 3790 (Service Pack 2)
> MP (24 procs) Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8 Debug
> session
> time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00) System Uptime: 0 days
> 0:23:15.890 Unable to load image \WINDOWS\system32\ntkrnlpa.exe,
> Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe Loading Kernel Symbols
> …
> …
> Loading User Symbols
> Loading unloaded module list
> …
> *********************************************************************
> *
> *********
>
> * *
> * Bugcheck Analysis *
> * *
> *********************************************************************
> *
> *********
>
>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> *** WARNING: Unable to verify timestamp for mssmbios.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> mssmbios.sys
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> Unable to load image wdf01000.sys, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for wdf01000.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
> *** WARNING: Unable to verify timestamp for Npfs.SYS
> *** ERROR: Module load completed but symbols could not be loaded for
> Npfs.SYS
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> *** Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
> *********************************************************************
> *
> *********
>
> * *
> * Bugcheck Analysis *
> * *
> *********************************************************************
> *
> *********
>
>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically
> caused by a bad block in the paging file or disk controller error.
> Also see KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or
> 0xC0000185, it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed
> because a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or
> PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> ***
> *************************************************************************
> *** ***
> *** ***
> *** Your debugger is not using the correct symbols ***
> *** ***
> *** In order for this command to work properly, your symbol path ***
> *** must point to .pdb files that have full type information. ***
> *** ***
> *** Certain .pdb files (such as the public OS symbols) do not ***
> *** contain the required information. Contact the group that ***
> *** provided you with these symbols if you need this command to ***
> *** work. ***
> *** ***
> *** Type referenced: nt!_KPRCB ***
> *** ***
> *********************************************************************
> *
> ***
>
> ADDITIONAL_DEBUG_TEXT:
> Use ‘!findthebuild’ command to search for the target build information.
> If the build information is available, run ‘!findthebuild -s ;
> .reload’ to set symbol path and load symbols.
>
> MODULE_NAME: Pci9x5x
>
> FAULTING_MODULE: 80800000 nt
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> WARNING: Stack unwind information not available. Following frames may
> be wrong.
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9 b84c3a3c
> 8083c965 c0600030 8524cd88 00000021 nt+0x52458
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372 b84c3b7c
> f72fa072 7b57a1f8 7ad0cfe8 00000004
> Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
> b84c3bec
> f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac b84c3c0c
> f7300824
> 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
> b84c3c3c
> 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec b84c3d6c
> 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150: UserMode,
> 151: MmCached ,
> 152: NULL,
> 153: FALSE,
>
>> 154: NormalPagePriority);
>>
> 155:
> 156: if (!devExt->UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint ((“MmMapLockedPagesSpecifyCache
> failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> IMAGE_NAME: Pci9x5x.sys
>
> BUCKET_ID: WRONG_SYMBOLS
>
> Followup: MachineOwner
> ---------------------------------------------------------------------
> -
> -----------------------------------------------------------------
>
>
> As you can see the reason for the exception is
> MmMapLockedPagesSpecifyCache.
>
> I built the driver with “build -ceZ -w” and also ran PreFast. There
> are no relevant warnings.
>
> But why ??? What am I doing wrong ?
>
> Is it possible that mapping to user space is not possible under
> Server2003-32 ?
>
> The buffer has to be contiguous because this is what the FPGA needs.
>
> I read many answers on this problem but did not find an answer.
>
> Thank you in advance for your reply.
>
> Best regards,
> Zvika.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Make sure that you zero the memory before you return the address to the user. Users should not see stuff left over in kernel memory because it may lead to a security breach…

–Mark Cariddi
OSR Open Systems Resources, Inc.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
Sent: Tuesday, December 13, 2011 10:17 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] MmMapLockedPagesSpecifyCache: Execption under Server2003-32

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of configuous buffer.


NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt) {
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,
LowestAcceptableAddress,
HighestAcceptableAddress,
BoundaryAddressMultiple,
MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

DevExt->CommonBufferMdl = IoAllocateMdl (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}

The allocation works fine. As you can see I checked that CommonBufferMdl and KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request from user space I call to the following code:



case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer (Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon IOCTL request
__try
{
devExt->UserSpaceCommonBuffer = MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,
NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation (Request,STATUS_SUCCESS,sizeof(long));
break;

When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs) Free
x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE contents
if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to
set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx” referenced
memory at “0x%08lx”. The required data was not placed into memory because of
an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,

154:
NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner

As you can see the reason for the exception is MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There are no
relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Zvika,
I write a simple driver based on your description. I verified this driver
on Windows 2003 32bit(Actually it is in virtual machine, 16MB contiguous is
too big for it, so I just change size to 1MB). It works, there is no any
BSOD on it. I also verified it on win7 32 bit and I works as well.
Thanks.
Marvin

On Tue, Dec 13, 2011 at 11:17 PM, Zvi Vered wrote:

> Dear Members,
>
> Upon DriverEntry I call to the following code to allocate a 16MB of
> configuous buffer.
>
> ------------------------------ ------------------------------
> ------------------------------ ------------------------------
> -----------------------
> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
> {
> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>
> DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpec
ifyCache
> (COMMON_BUFFER_SIZE,
>
> LowestAcceptableAddress,
>
> HighestAcceptableAddress,
>
> BoundaryAddressMultiple,
>
> MmCached);
> if (!DevExt->KernelCommonBuffer)
> {
> KdPrint ((“MmAllocateContiguousMemory failed\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> DevExt->CommonBufferMdl = IoAllocateMdl (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE,
> FALSE, NULL);
>
> if (!DevExt->CommonBufferMdl)
> {
> KdPrint ((“IoAllocateMdl failed.\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>
> return STATUS_SUCCESS;
> }
> ------------------------------
------------------------------
> ------------------------------
------------------------------
> -----------------------
> The allocation works fine. As you can see I checked that CommonBufferMdl
> and KernelCommonBuffer are valid
>
> Now I have to map this buffer to user space. So upon IOCTL request from
> user space I call to the following code:
>
> ------------------------------
------------------------------
> ------------------------------
------------------------------
> -----------------------
> …
> case FIOA_ALLOCATE_COMMON_BUFFER:
> status = WdfRequestRetrieveOutputBuffer (Request,sizeof(FIOA_READ_

> LONG_REPLY),
> &pOutBuffer, &Length);
>
> pReadReply = (FIOA_READ_LONG_REPLY )pOutBuffer;
>
> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>
> //Map common buffer to user space. This can be done only upon IOCTL
> request
> _try
> {
> devExt->UserSpaceCommonBuffer = MmMapLockedPagesSpecifyCache(**
> devExt->CommonBufferMdl,
> UserMode,
> MmCached ,
> NULL,
> FALSE,
> NormalPagePriority);
>
> if (!devExt->**UserSpaceCommonBuffer)
> {
> KdPrint (("MmMapLockedPagesSpecifyCache failed.\n"));
> }
> }
>__except (EXCEPTION_EXECUTE_HANDLER)
> {
> devExt->UserSpaceCommonBuffer = 0x0;
> KdPrint (("MmMapLockedPagesSpecifyCache caused exception:
> %x\n",GetExceptionCode()));
> }
>
> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>
> WdfRequestCompleteWithInformat
ion (Request,STATUS_SUCCESS,

> sizeof(long));
> break;
> …
> ------------------------------ ------------------------------
> ------------------------------ ------------------------------
> ----------------------
> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
> Following is the analyze -v of the dump file:
> ------------------------------ ------------------------------
> ------------------------------ ------------------------------
> ------------------------
> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
> Copyright (c) Microsoft Corporation. All rights reserved.
>
>
> Loading Dump File [\1public\PUBLIC\a99059*Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is: M:\zvi_vered\module\FIO_YOYO*

> windows\module\objchk_wnet
x86\i386
> Executable search path is:
> Unable to load image \WINDOWS\system32\ntkrnlpa.
exe, Win32 error 0n2
> WARNING: Unable to verify timestamp for ntkrnlpa.exe
>
ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
> Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS
> Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
> Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
> System Uptime: 0 days 0:23:15.890
> Unable to load image \WINDOWS\system32\ntkrnlpa. exe, Win32 error 0n2
>
WARNING: Unable to verify timestamp for ntkrnlpa.exe
> ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Loading Kernel Symbols
> …

> …

> Loading User Symbols
> Loading unloaded module list
> …
>
>

> *
> * Bugcheck Analysis
> *
>
>

>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> WARNING: Unable to verify timestamp for mssmbios.sys
>
ERROR: Module load completed but symbols could not be loaded for
> mssmbios.sys
> Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> Unable to load image wdf01000.sys, Win32 error 0n2
>
WARNING: Unable to verify timestamp for wdf01000.sys
> ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
>
WARNING: Unable to verify timestamp for Npfs.SYS
> ERROR: Module load completed but symbols could not be loaded for
> Npfs.SYS
>

>
>

>

>
Your debugger is not using the correct symbols
>

>
In order for this command to work properly, your symbol path
>
must point to .pdb files that have full type information.
>

>
Certain .pdb files (such as the public OS symbols) do not
>
contain the required information. Contact the group that
>
provided you with these symbols if you need this command to
>
work.
>

>
Type referenced: nt!_KPRCB
>

>
****************
>
>
***************************************************
>
>

>

>
Your debugger is not using the correct symbols
>

>
In order for this command to work properly, your symbol path
>
must point to .pdb files that have full type information.
>

>
Certain .pdb files (such as the public OS symbols) do not
>
contain the required information. Contact the group that
>
provided you with these symbols if you need this command to
>
work.
>

>
Type referenced: nt!_KPRCB
>

>
***************************************************
>
>
***************************************************
>
>

>

>
Your debugger is not using the correct symbols
>

>
In order for this command to work properly, your symbol path
>
must point to .pdb files that have full type information.
>

>
Certain .pdb files (such as the public OS symbols) do not
>
contain the required information. Contact the group that
>
provided you with these symbols if you need this command to
>
work.
>

>
Type referenced: nt!_KPRCB
>

>
***************************************************
>
> Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
>
*********
>
> *
> * Bugcheck Analysis
> *
>

> **************
>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically caused
> by
> a bad block in the paging file or disk controller error. Also see
> KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
> it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed because
> a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
>
Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> ***************************************************
>

> ******
> ******
> Your debugger is not using the correct symbols
> ******
> In order for this command to work properly, your symbol path
> must point to .pdb files that have full type information.
> ******
> Certain .pdb files (such as the public OS symbols) do not
> contain the required information. Contact the group that
> provided you with these symbols if you need this command to
> work.
> ******
> Type referenced: nt!_KPRCB
> ******
> ***************************************************
>

> ***************************************************
>

> ******
> ******
> Your debugger is not using the correct symbols
> ******
> In order for this command to work properly, your symbol path
> must point to .pdb files that have full type information.
> ******
> Certain .pdb files (such as the public OS symbols) do not
> contain the required information. Contact the group that
> provided you with these symbols if you need this command to
> work.
> ******
> Type referenced: nt!_KPRCB
> ******
> ***************************************************
>

> ***************************************************
>

> ******
> ******
> Your debugger is not using the correct symbols
> ******
> In order for this command to work properly, your symbol path
> must point to .pdb files that have full type information.
> ******
> Certain .pdb files (such as the public OS symbols) do not
> contain the required information. Contact the group that
> provided you with these symbols if you need this command to
> work.
> ******
> Type referenced: nt!_KPRCB
> ******
> ***************************************************
>

>
> ADDITIONAL_DEBUG_TEXT:
> Use ‘!findthebuild’ command to search for the target build information.
> If the build information is available, run ‘!findthebuild -s ; .reload’ to
> set symbol path and load symbols.
>
> MODULE_NAME: Pci9x5x
>
> FAULTING_MODULE: 80800000 nt
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> WARNING: Stack unwind information not available. Following frames may be
> wrong.
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
> b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
> b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_yoyo**windows\module\iocontrol.c @ 154]
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
> b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
> b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
> b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
> b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1 [m:\zvi_vered\module\fio_yoyo**windows\module\iocontrol.c
> @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150: UserMode,
> 151: MmCached ,
> 152: NULL,
> 153: FALSE,
>
>> 154: NormalPagePriority);
>>
> 155:
> 156: if (!devExt->**UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint ((“**MmMapLockedPagesSpecifyCache
> failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> IMAGE_NAME: Pci9x5x.sys
>
> BUCKET_ID: WRONG_SYMBOLS
>
> Followup: MachineOwner
> ------------------------------ ------------------------------
> ------------------------------ ------------------------------
> ---------------
>
> As you can see the reason for the exception is
> MmMapLockedPagesSpecifyCache.
>
> I built the driver with “build -ceZ -w” and also ran PreFast. There are no
> relevant warnings.
>
> But why ??? What am I doing wrong ?
>
> Is it possible that mapping to user space is not possible under
> Server2003-32 ?
>
> The buffer has to be contiguous because this is what the FPGA needs.
>
> I read many answers on this problem but did not find an answer.
>
> Thank you in advance for your reply.
>
> Best regards,
> Zvika.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.**cfm?name=ListServerhttp:
></http:>

And some questions to you:

  1. How much physical memory in your PC?
  2. Did you enable PAE?
  3. Did you try it on Win7?

On Wed, Dec 14, 2011 at 11:23 AM, Marvin(Fan) Zhang wrote:

> Hi Zvika,
> I write a simple driver based on your description. I verified this driver
> on Windows 2003 32bit(Actually it is in virtual machine, 16MB contiguous is
> too big for it, so I just change size to 1MB). It works, there is no any
> BSOD on it. I also verified it on win7 32 bit and I works as well.
> Thanks.
> Marvin
>
>
> On Tue, Dec 13, 2011 at 11:17 PM, Zvi Vered wrote:
>
>> Dear Members,
>>
>> Upon DriverEntry I call to the following code to allocate a 16MB of
>> configuous buffer.
>>
>> ------------------------------ ------------------------------
>> ------------------------------ ------------------------------
>> -----------------------
>> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
>> {
>> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
>> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
>> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>>
>> DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpec
ifyCache
>> (COMMON_BUFFER_SIZE,
>>
>> LowestAcceptableAddress,
>>
>> HighestAcceptableAddress,
>>
>> BoundaryAddressMultiple,
>>
>> MmCached);
>> if (!DevExt->KernelCommonBuffer)
>> {
>> KdPrint ((“MmAllocateContiguousMemory failed\n”));
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> DevExt->CommonBufferMdl = IoAllocateMdl (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE,
>> FALSE, NULL);
>>
>> if (!DevExt->CommonBufferMdl)
>> {
>> KdPrint ((“IoAllocateMdl failed.\n”));
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>>
>> return STATUS_SUCCESS;
>> }
>> ------------------------------
------------------------------
>> ------------------------------
------------------------------
>> -----------------------
>> The allocation works fine. As you can see I checked that CommonBufferMdl
>> and KernelCommonBuffer are valid
>>
>> Now I have to map this buffer to user space. So upon IOCTL request from
>> user space I call to the following code:
>>
>> ------------------------------
------------------------------
>> ------------------------------
------------------------------
>> -----------------------
>> …
>> case FIOA_ALLOCATE_COMMON_BUFFER:
>> status = WdfRequestRetrieveOutputBuffer (Request,sizeof(FIOA_READ_*
>> *LONG_REPLY),
>> &pOutBuffer, &Length);
>>
>> pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;
>>
>> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>>
>> //Map common buffer to user space. This can be done only upon IOCTL
>> request
>> __try
>> {
>> devExt->UserSpaceCommonBuffer = MmMapLockedPagesSpecifyCache(

>> devExt->CommonBufferMdl,
>> UserMode,
>> MmCached ,
>> NULL,
>> FALSE,
>> NormalPagePriority);
>>
>> if (!devExt->UserSpaceCommonBuffer)
>> {
>> KdPrint (("MmMapLockedPagesSpecifyCache failed.\n"));
>> }
>> }
>>__except (EXCEPTION_EXECUTE_HANDLER)
>> {
>> devExt->UserSpaceCommonBuffer = 0x0;
>> KdPrint (("MmMapLockedPagesSpecifyCache caused exception:
>> %x\n",GetExceptionCode()));
>> }
>>
>> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>>
>> WdfRequestCompleteWithInformat
ion (Request,STATUS_SUCCESS,

>> sizeof(long));
>> break;
>> …
>> ------------------------------
------------------------------
>> ------------------------------
------------------------------
>> ----------------------
>> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
>> Following is the analyze -v of the dump file:
>> ------------------------------
------------------------------
>> ------------------------------
------------------------------**
>> ------------------------
>> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
>> Copyright (c) Microsoft Corporation. All rights reserved.
>>
>>
>> Loading Dump File [\1public\PUBLIC\a99059*Mini121311-01.dmp]
>> Mini Kernel Dump File: Only registers and stack trace are available
>>
>> Symbol search path is: M:\zvi_vered\module\FIO_YOYO\
>> windows\module\objchk_wnet_
x86\i386
>> Executable search path is:
>> Unable to load image \WINDOWS\system32\ntkrnlpa. exe, Win32 error 0n2
>>
WARNING: Unable to verify timestamp for ntkrnlpa.exe
>> ERROR: Module load completed but symbols could not be loaded for
>> ntkrnlpa.exe
>> Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
>> Free x86 compatible
>> Product: Server, suite: TerminalServer SingleUserTS
>> Machine Name:
>> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
>> Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
>> System Uptime: 0 days 0:23:15.890
>> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
>> WARNING: Unable to verify timestamp for ntkrnlpa.exe
>>
ERROR: Module load completed but symbols could not be loaded for
>> ntkrnlpa.exe
>> Loading Kernel Symbols
>> …
>> …
>> Loading User Symbols
>> Loading unloaded module list
>> …
>>
*********************************************************
>>
>> *
>> * Bugcheck Analysis
>> *
>>
******************************************
>> **************
>>
>> Use !analyze -v to get detailed debugging information.
>>
>> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>>
>>
WARNING: Unable to verify timestamp for mssmbios.sys
>> ERROR: Module load completed but symbols could not be loaded for
>> mssmbios.sys
>>
Kernel symbols are WRONG. Please fix symbols to do analysis.
>>
>> Unable to load image wdf01000.sys, Win32 error 0n2
>> WARNING: Unable to verify timestamp for wdf01000.sys
>>
ERROR: Module load completed but symbols could not be loaded for
>> wdf01000.sys
>> WARNING: Unable to verify timestamp for Npfs.SYS
>>
ERROR: Module load completed but symbols could not be loaded for
>> Npfs.SYS
>> ***************************************************
>>

>> ******
>> ******
>> Your debugger is not using the correct symbols
>> ******
>> In order for this command to work properly, your symbol path
>> must point to .pdb files that have full type information.
>> ******
>> Certain .pdb files (such as the public OS symbols) do not
>> contain the required information. Contact the group that
>> provided you with these symbols if you need this command to
>> work.
>> ******
>> Type referenced: nt!_KPRCB
>> ******
>> **********************************
>>

>>
>>

>> ******
>> ******
>> Your debugger is not using the correct symbols
>> ******
>> In order for this command to work properly, your symbol path
>> must point to .pdb files that have full type information.
>> ******
>> Certain .pdb files (such as the public OS symbols) do not
>> contain the required information. Contact the group that
>> provided you with these symbols if you need this command to
>> work.
>> ******
>> Type referenced: nt!_KPRCB
>> ******
>>
>>

>>
>>

>> ******
>> ******
>> Your debugger is not using the correct symbols
>> ******
>> In order for this command to work properly, your symbol path
>> must point to .pdb files that have full type information.
>> ******
>> Certain .pdb files (such as the public OS symbols) do not
>> contain the required information. Contact the group that
>> provided you with these symbols if you need this command to
>> work.
>> ******
>> Type referenced: nt!_KPRCB
>> ******
>>
>>

>> Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>>
>> Followup: MachineOwner
>> ---------
>>
>> 20: kd> !analyze -v
>>
>>

>> *
>> * Bugcheck Analysis
>> *
>>
>>

>>
>> KERNEL_DATA_INPAGE_ERROR (7a)
>> The requested page of kernel data could not be read in. Typically caused
>> by
>> a bad block in the paging file or disk controller error. Also see
>> KERNEL_STACK_INPAGE_ERROR.
>> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
>> it means the disk subsystem has experienced a failure.
>> If the error status is 0xC000009A, then it means the request failed
>> because
>> a filesystem failed to make forward progress.
>> Arguments:
>> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
>> Arg2: d0000006, error status (normally i/o status code)
>> Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
>> Arg4: c0006000, virtual address that could not be in-paged (or PTE
>> contents if arg1 is a PTE address)
>>
>> Debugging Details:
>> ------------------
>>
>> Kernel symbols are WRONG. Please fix symbols to do analysis.
>>
>>

>>
>>

>>

>>
Your debugger is not using the correct symbols
>>

>>
In order for this command to work properly, your symbol path
>>
must point to .pdb files that have full type information.
>>

>>
Certain .pdb files (such as the public OS symbols) do not
>>
contain the required information. Contact the group that
>>
provided you with these symbols if you need this command to
>>
work.
>>

>>
Type referenced: nt!_KPRCB
>>

>>

>>
>>

>>
>>

>>

>>
Your debugger is not using the correct symbols
>>

>>
In order for this command to work properly, your symbol path
>>
must point to .pdb files that have full type information.
>>

>>
Certain .pdb files (such as the public OS symbols) do not
>>
contain the required information. Contact the group that
>>
provided you with these symbols if you need this command to
>>
work.
>>

>>
Type referenced: nt!_KPRCB
>>

>>

>>
>>

>>
>>

>>

>>
Your debugger is not using the correct symbols
>>

>>
In order for this command to work properly, your symbol path
>>
must point to .pdb files that have full type information.
>>

>>
Certain .pdb files (such as the public OS symbols) do not
>>
contain the required information. Contact the group that
>>
provided you with these symbols if you need this command to
>>
work.
>>

>>
Type referenced: nt!_KPRCB
>>

>>

>> *************
>>
>> ADDITIONAL_DEBUG_TEXT:
>> Use ‘!findthebuild’ command to search for the target build information.
>> If the build information is available, run ‘!findthebuild -s ; .reload’
>> to set symbol path and load symbols.
>>
>> MODULE_NAME: Pci9x5x
>>
>> FAULTING_MODULE: 80800000 nt
>>
>> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>>
>> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
>> referenced memory at “0x%08lx”. The required data was not placed into
>> memory because of an I/O error status of “0x%08lx”.
>>
>> BUGCHECK_STR: 0x7a_d0000006
>>
>> CUSTOMER_CRASH_COUNT: 1
>>
>> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>>
>> CURRENT_IRQL: 0
>>
>> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>>
>> STACK_TEXT:
>> WARNING: Stack unwind information not available. Following frames may be
>> wrong.
>> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
>> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
>> b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
>> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
>> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
>> b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004
>> Pci9x5x!PLxEvtIoControl+0x1a1 [m:\zvi_vered\module\fio_yoyo**windows\module\iocontrol.c
>> @ 154]
>> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
>> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
>> b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
>> b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
>> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
>> b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
>> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
>> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
>> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
>> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
>> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
>> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
>> b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
>> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>>
>>
>> STACK_COMMAND: kb
>>
>> FOLLOWUP_IP:
>> Pci9x5x!PLxEvtIoControl+1a1 [m:\zvi_vered\module\fio_yoyo**windows\module\iocontrol.c
>> @ 154]
>> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>>
>> FAULTING_SOURCE_CODE:
>> 150: UserMode,
>> 151: MmCached ,
>> 152: NULL,
>> 153: FALSE,
>>
>>> 154: NormalPagePriority);
>>>
>> 155:
>> 156: if (!devExt->**UserSpaceCommonBuffer)
>> 157: {
>> 158: KdPrint (("MmMapLockedPagesSpecifyCache
>> failed.\n"));
>> 159: }
>>
>>
>> SYMBOL_STACK_INDEX: 5
>>
>> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>>
>> FOLLOWUP_NAME: MachineOwner
>>
>> IMAGE_NAME: Pci9x5x.sys
>>
>> BUCKET_ID: WRONG_SYMBOLS
>>
>> Followup: MachineOwner
>> ------------------------------
------------------------------
>> ------------------------------
------------------------------
>> ---------------
>>
>> As you can see the reason for the exception is
>> MmMapLockedPagesSpecifyCache.
>>
>> I built the driver with “build -ceZ -w” and also ran PreFast. There are
>> no relevant warnings.
>>
>> But why ??? What am I doing wrong ?
>>
>> Is it possible that mapping to user space is not possible under
>> Server2003-32 ?
>>
>> The buffer has to be contiguous because this is what the FPGA needs.
>>
>> I read many answers on this problem but did not find an answer.
>>
>> Thank you in advance for your reply.
>>
>> Best regards,
>> Zvika.
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.
cfm?name=ListServerhttp:
>>
>
></http:>

See below…

Dear Members,

Upon DriverEntry I call to the following code to allocate a 16MB of
configuous buffer.


NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
{
PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};

DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
(COMMON_BUFFER_SIZE,
LowestAcceptableAddress,
HighestAcceptableAddress,
BoundaryAddressMultiple,
MmCached);
if (!DevExt->KernelCommonBuffer)
{
KdPrint ((“MmAllocateContiguousMemory failed\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}
*****
If it was successful, you seem to be ignoring the warning associated with
the mapping request. This would be the place to zero those bytes out.

From
http://msdn.microsoft.com/en-us/library/windows/hardware/ff554629(v=vs.85).aspx

Warning A driver that maps kernel memory into user address space must
avoid exposing potentially sensitive kernel data to untrusted processes.
Uninitialized buffers, such as buffers that are allocated from pool, must
be explicitly filled with zeros before they are mapped. In addition, the
size of a user-mode buffer that is allocated from pool must be a multiple
of the virtual memory page size to prevent any part of the pages in the
buffer from being used for other allocations. Finally, buffers must not be
freed back to the pool while they are still mapped to user address space.

Why is it that you are expecting us to be able to deduce what your code is
doing when there are no declarations provided for variables? For example,
I might presume that DevExt->KernelCommonBuffer is declared as a PBOID,
but without seeing your actual declaration, I am merely presuming that you
have done this right.
*****

DevExt->CommonBufferMdl = IoAllocateMdl
(DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);

if (!DevExt->CommonBufferMdl)
{
KdPrint ((“IoAllocateMdl failed.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}

MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);

return STATUS_SUCCESS;
}

The allocation works fine. As you can see I checked that CommonBufferMdl
and
KernelCommonBuffer are valid

Now I have to map this buffer to user space. So upon IOCTL request from
user
space I call to the following code:



case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer
(Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon
IOCTL
request
__try
{
devExt->UserSpaceCommonBuffer =
MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,
NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
%x\n”,GetExceptionCode()));
}

pReadReply->Data = devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation
(Request,STATUS_SUCCESS,sizeof(long));
****
What does sizeof(long) have to do with any known form of reality?
sizeof(PVOID) might make sense, but the presumption that sizeof(PVOID) ==
sizeonf(long) is not supportable.
****
break;

When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
Following is the analyze -v of the dump file:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is:
M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
Executable search path is:
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
Free
x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
*** ERROR: Module load completed but symbols could not be loaded for
ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
*** ERROR: Module load completed but symbols could not be loaded for
mssmbios.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.
*********

Not clear what this means given the wrong symbols are being used to decode
the dump

*********

Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for
wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
*** ERROR: Module load completed but symbols could not be loaded for
Npfs.SYS
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused
by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed
because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE
contents
if arg1 is a PTE address)

Debugging Details:

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: nt!_KPRCB ***
*** ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to
set symbol path and load symbols.

MODULE_NAME: Pci9x5x

FAULTING_MODULE: 80800000 nt

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
referenced
memory at “0x%08lx”. The required data was not placed into memory because
of
an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
b84c3d70 00000000 00000000 00000000 00000000 0x12fd44

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1
[m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,
> 154:
> NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache
failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Pci9x5x.sys

BUCKET_ID: WRONG_SYMBOLS

Followup: MachineOwner

As you can see the reason for the exception is
MmMapLockedPagesSpecifyCache.

I built the driver with “build -ceZ -w” and also ran PreFast. There are no
relevant warnings.

But why ??? What am I doing wrong ?

Is it possible that mapping to user space is not possible under
Server2003-32 ?

The buffer has to be contiguous because this is what the FPGA needs.

I read many answers on this problem but did not find an answer.

Thank you in advance for your reply.

Best regards,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> Dear Mark,

I tried it but without try/except. Instead of MmBuildMdlForNonPagedPool I
called to:
MmProbeAndLockPages (devExt->pMdl, UserMode, IoReadAccess );

With MmProbeAndLockPages I got exception upon DriverEntry (when I enabled
the driver)
*******
First, note there is no such thing as “an exception” in a question. There
is a very specific exception, and the problem is ALWAYS accompanied by a
!analyze -v report. So the statement that you “got exception” is
meaningless and a waste of time.

Second, you did not show the code you used when you did
MmProbeAndLockPages, so how are we supposed to guess what is going on.

Note that ALL sample code has to show the declarations of ALL the
variables relevant to the question, in particular, if you have SomeCall(A,
B, &C) then the question is meaningless unless you have shown the
declarations of A, B and C; how do we know you are declaring them
properly?

The PTP (Psychic Transfer Protocol) is not supported on my machine.
joe
********

Thanks,
Zvika.

-----Original Message-----
From: Mark S. Edwards
Sent: Tuesday, December 13, 2011 6:01 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] MmMapLockedPagesSpecifyCache: Execption under
Server2003-32

You haven’t run this under verifier, have you ?

Verifier should tell you that you don’t call MmBuildMdlForNonPagedPool
(DevExt->CommonBufferMdl), you should instead call MmProbeAndLockPages()
with the usual try/except catching.

I’m not saying this your root cause, but it is an issue that under
stress what you may think is a non-paged and locked down buffer actually
isn’t.

Mark.

On 13/12/2011 15:17, Zvi Vered wrote:
> Dear Members,
>
> Upon DriverEntry I call to the following code to allocate a 16MB of
> configuous buffer.
>
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
> NTSTATUS AllocateContinuousPhysicalMemory (IN PDEVICE_EXTENSION DevExt)
> {
> PHYSICAL_ADDRESS HighestAcceptableAddress = {0x0,0xFFFFFFFF};
> PHYSICAL_ADDRESS LowestAcceptableAddress = {0x0,0x0};
> PHYSICAL_ADDRESS BoundaryAddressMultiple = {0x0,0x0};
>
> DevExt->KernelCommonBuffer = MmAllocateContiguousMemorySpecifyCache
> (COMMON_BUFFER_SIZE,
>
> LowestAcceptableAddress,
>
> HighestAcceptableAddress,
>
> BoundaryAddressMultiple,
>
> MmCached);
> if (!DevExt->KernelCommonBuffer)
> {
> KdPrint ((“MmAllocateContiguousMemory failed\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> DevExt->CommonBufferMdl = IoAllocateMdl
> (DevExt->KernelCommonBuffer,COMMON_BUFFER_SIZE,FALSE, FALSE, NULL);
>
> if (!DevExt->CommonBufferMdl)
> {
> KdPrint ((“IoAllocateMdl failed.\n”));
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> MmBuildMdlForNonPagedPool (DevExt->CommonBufferMdl);
>
> return STATUS_SUCCESS;
> }
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
> The allocation works fine. As you can see I checked that CommonBufferMdl
> and KernelCommonBuffer are valid
>
> Now I have to map this buffer to user space. So upon IOCTL request from
> user space I call to the following code:
>
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
> …
> case FIOA_ALLOCATE_COMMON_BUFFER:
> status = WdfRequestRetrieveOutputBuffer
> (Request,sizeof(FIOA_READ_LONG_REPLY),
> &pOutBuffer, &Length);
>
> pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;
>
> bytesReturned = sizeof(FIOA_READ_LONG_REPLY);
>
> //Map common buffer to user space. This can be done only upon
> IOCTL
> request
> __try
> {
> devExt->UserSpaceCommonBuffer =
> MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
> UserMode,
> MmCached ,
> NULL,
> FALSE,
>
> NormalPagePriority);
>
> if (!devExt->UserSpaceCommonBuffer)
> {
> KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
> }
> }
> __except (EXCEPTION_EXECUTE_HANDLER)
> {
> devExt->UserSpaceCommonBuffer = 0x0;
> KdPrint ((“MmMapLockedPagesSpecifyCache caused exception:
> %x\n”,GetExceptionCode()));
> }
>
> pReadReply->Data = devExt->UserSpaceCommonBuffer;
>
> WdfRequestCompleteWithInformation
> (Request,STATUS_SUCCESS,sizeof(long));
> break;
> …
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> When I send the FIOA_ALLOCATE_COMMON_BUFFER request I get blue dump.
> Following is the analyze -v of the dump file:
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
> Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
> Copyright (c) Microsoft Corporation. All rights reserved.
>
>
> Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is:
> M:\zvi_vered\module\FIO_YOYO\windows\module\objchk_wnet_x86\i386
> Executable search path is:
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
> Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS
> Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
> Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
> System Uptime: 0 days 0:23:15.890
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for ntkrnlpa.exe
> *** ERROR: Module load completed but symbols could not be loaded for
> ntkrnlpa.exe
> Loading Kernel Symbols
> …
> …
> Loading User Symbols
> Loading unloaded module list
> …
> *******************************************************************************
> * *
> * Bugcheck Analysis *
> * *
> *******************************************************************************
>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> *** WARNING: Unable to verify timestamp for mssmbios.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> mssmbios.sys
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> Unable to load image wdf01000.sys, Win32 error 0n2
> *** WARNING: Unable to verify timestamp for wdf01000.sys
> *** ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
> *** WARNING: Unable to verify timestamp for Npfs.SYS
> *** ERROR: Module load completed but symbols could not be loaded for
> Npfs.SYS
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
> Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
> *******************************************************************************
> * *
> * Bugcheck Analysis *
> * *
> *******************************************************************************
>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically
> caused
> by
> a bad block in the paging file or disk controller error. Also see
> KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
> it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed
> because
> a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or
> PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
> ***** Kernel symbols are WRONG. Please fix symbols to do analysis.
>
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
> *************************************************************************
> ***
> ***
> ***
> ***
> *** Your debugger is not using the correct symbols
> ***
> ***
> ***
> *** In order for this command to work properly, your symbol path
> ***
> *** must point to .pdb files that have full type information.
> ***
> ***
> ***
> *** Certain .pdb files (such as the public OS symbols) do not
> ***
> *** contain the required information. Contact the group that
> ***
> *** provided you with these symbols if you need this command to
> ***
> *** work.
> ***
> ***
> ***
> *** Type referenced: nt!_KPRCB
> ***
> ***
> ***
> *************************************************************************
>
> ADDITIONAL_DEBUG_TEXT:
> Use ‘!findthebuild’ command to search for the target build information.
> If the build information is available, run ‘!findthebuild -s ; .reload’
> to
> set symbol path and load symbols.
>
> MODULE_NAME: Pci9x5x
>
> FAULTING_MODULE: 80800000 nt
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> WARNING: Stack unwind information not available. Following frames may be
> wrong.
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt+0x27c63
> b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt+0x51cd9
> b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt+0x52458
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt+0x3c965
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt+0x53372
> b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004
> Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
> b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
> b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
> b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt+0x1df65
> b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt+0xf5437
> b84c3d00 808eed08 0000077c 00000758 00000000 nt+0xf61bf
> b84c3d34 8088978c 0000077c 00000758 00000000 nt+0xeed08
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt+0x8978c
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
> b84c3d6c 0012fd44 00000000 00000000 00000000 Npfs+0x4d00
> b84c3d70 00000000 00000000 00000000 00000000 0x12fd44
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1
> [m:\zvi_vered\module\fio_yoyo\windows\module\iocontrol.c @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150: UserMode,
> 151: MmCached
> ,
> 152: NULL,
> 153: FALSE,
>> 154: NormalPagePriority);
> 155:
> 156: if (!devExt->UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint ((“MmMapLockedPagesSpecifyCache
> failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> IMAGE_NAME: Pci9x5x.sys
>
> BUCKET_ID: WRONG_SYMBOLS
>
> Followup: MachineOwner
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>
> As you can see the reason for the exception is
> MmMapLockedPagesSpecifyCache.
>
> I built the driver with “build -ceZ -w” and also ran PreFast. There are
> no
> relevant warnings.
>
> But why ??? What am I doing wrong ?
>
> Is it possible that mapping to user space is not possible under
> Server2003-32 ?
>
> The buffer has to be contiguous because this is what the FPGA needs.
>
> I read many answers on this problem but did not find an answer.
>
> Thank you in advance for your reply.
>
> Best regards,
> Zvika.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Dear Members,

  1. The Server I have has 4GB of physical RAM.

  2. PTE is not enabled. There is no boot.ini in my server.

  3. I tried to call RtlZeroMemory right after MmAllocateContiguousMemorySpecifyCache but the results were the same.

  4. COMMON_BUFFER_SIZE is (16*1024*1024) so this size is aligned to page size.

  5. The definition of the device extension is:

typedef struct _DEVICE_EXTENSION {

PVOID KernelCommonBuffer;
PVOID UserSpaceCommonBuffer;
PMDL CommonBufferMdl;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;

  1. I tried calling to MmProbeAndLockPages (DevExt->CommonBufferMdl, KernelMode, IoWriteAccess) but the result were the same.

  2. Following is the “Analyze -v” with the symbols of “Windows Server 2003-32-SP2”:

Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is: srv*;D:\Temp\symbols
Executable search path is: M:\zvi_vered\module\FIO_VLRTR\windows\module\objchk_wnet_x86\i386
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs) Free x86 compatible
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
System Uptime: 0 days 0:23:15.890
Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntkrnlpa.exe
Loading Kernel Symbols


Loading User Symbols
Loading unloaded module list

*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 7A, {1, d0000006, 8524cd88, c0006000}

*** WARNING: Unable to verify timestamp for mssmbios.sys
Unable to load image wdf01000.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for wdf01000.sys
*** ERROR: Module load completed but symbols could not be loaded for wdf01000.sys
*** WARNING: Unable to verify timestamp for Npfs.SYS
Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )

Followup: MachineOwner

20: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

KERNEL_DATA_INPAGE_ERROR (7a)
The requested page of kernel data could not be read in. Typically caused by
a bad block in the paging file or disk controller error. Also see
KERNEL_STACK_INPAGE_ERROR.
If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
it means the disk subsystem has experienced a failure.
If the error status is 0xC000009A, then it means the request failed because
a filesystem failed to make forward progress.
Arguments:
Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
Arg2: d0000006, error status (normally i/o status code)
Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
Arg4: c0006000, virtual address that could not be in-paged (or PTE contents if arg1 is a PTE address)

Debugging Details:

ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx” referenced memory at “0x%08lx”. The required data was not placed into memory because of an I/O error status of “0x%08lx”.

BUGCHECK_STR: 0x7a_d0000006

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP

PROCESS_NAME: Console.exe

CURRENT_IRQL: 2

LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63

STACK_TEXT:
b84c39ec 80851cd9 0000007a 00000001 d0000006 nt!KeDelayExecutionThread+0x99
b84c3a20 80852458 8524cd88 c0600030 8524ce68 nt!MiMapViewOfDataSection+0x533
b84c3a3c 8083c965 c0600030 8524cd88 00000021 nt!MiPfPutPagesInTransition+0x256
b84c3a90 80853372 8522b000 8524ce68 c0006280 nt!MmProbeAndLockPages+0x623
b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt!MiDecommitPages+0x2ca
b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1 [m:\zvi_vered\module\fio_vlrtr\windows\module\iocontrol.c @ 154]
WARNING: Stack unwind information not available. Following frames may be wrong.
b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt!IoCsqInitialize+0x31
b84c3c64 808f61bf 85234138 852e4368 84a5c388 nt!IopParseSymbolicLinkName+0xc1
b84c3d00 808eed08 0000077c 00000758 00000000 nt!IopGetDeviceInterfaces+0x5ab
b84c3d34 8088978c 0000077c 00000758 00000000 nt!IopLoadDriver+0x634
b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt!MiReserveSystemPtes+0x1ca
b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
b84c3d80 00000000 00000000 00000000 00000000 Npfs!NpCompleteStalledWrites+0x26

STACK_COMMAND: kb

FOLLOWUP_IP:
Pci9x5x!PLxEvtIoControl+1a1 [m:\zvi_vered\module\fio_vlrtr\windows\module\iocontrol.c @ 154]
b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]

FAULTING_SOURCE_CODE:
150: UserMode,
151: MmCached ,
152: NULL,
153: FALSE,

154: NormalPagePriority);
155:
156: if (!devExt->UserSpaceCommonBuffer)
157: {
158: KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
159: }

SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: Pci9x5x

IMAGE_NAME: Pci9x5x.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46

FAILURE_BUCKET_ID: 0x7a_d0000006_Pci9x5x!PLxEvtIoControl+1a1

BUCKET_ID: 0x7a_d0000006_Pci9x5x!PLxEvtIoControl+1a1

Followup: MachineOwner


Shoud I run:

!pte c0006000
!vad 00c00000 1

With RS232 cable connected to the server or can it run on a crashdump file (offline) ?

Thank you in advance for your reply.
Zvika.

Very strange. Your driver should have had BSOD in
MmMapLockedPagesSpecifyCache . However, according to call stack,
MiDecommitPages make you BSOD.
Could you repost iocontrol.c from line 100 ~ line 200?

On Wed, Dec 14, 2011 at 5:28 PM, wrote:

> Dear Members,
>
> 1. The Server I have has 4GB of physical RAM.
>
> 2. PTE is not enabled. There is no boot.ini in my server.
>
> 3. I tried to call RtlZeroMemory right after
> MmAllocateContiguousMemorySpecifyCache but the results were the same.
>
> 4. COMMON_BUFFER_SIZE is (1610241024) so this size is aligned to page
> size.
>
> 5. The definition of the device extension is:
>
> typedef struct _DEVICE_EXTENSION {
> …
> PVOID KernelCommonBuffer;
> PVOID UserSpaceCommonBuffer;
> PMDL CommonBufferMdl;
> } DEVICE_EXTENSION, PDEVICE_EXTENSION;
>
> 6. I tried calling to MmProbeAndLockPages (DevExt->CommonBufferMdl,
> KernelMode, IoWriteAccess) but the result were the same.
>
> 7. Following is the “Analyze -v” with the symbols of “Windows Server
> 2003-32-SP2”:
>
> Loading Dump File [\1public\PUBLIC\a99059\Mini121311-01.dmp]
> Mini Kernel Dump File: Only registers and stack trace are available
>
> Symbol search path is: srv
;D:\Temp\symbols
> Executable search path is:
> M:\zvi_vered\module\FIO_VLRTR\windows\module\objchk_wnet_x86\i386
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
> WARNING: Unable to verify timestamp for ntkrnlpa.exe
> Windows Server 2003 Kernel Version 3790 (Service Pack 2) MP (24 procs)
> Free x86 compatible
> Product: Server, suite: TerminalServer SingleUserTS
> Machine Name:
> Kernel base = 0x80800000 PsLoadedModuleList = 0x808a6ea8
> Debug session time: Tue Dec 13 11:33:33.408 2011 (UTC + 2:00)
> System Uptime: 0 days 0:23:15.890
> Unable to load image \WINDOWS\system32\ntkrnlpa.exe, Win32 error 0n2
>
WARNING: Unable to verify timestamp for ntkrnlpa.exe
> Loading Kernel Symbols
> …
> …
> Loading User Symbols
> Loading unloaded module list
> …
>
> *****
>
>
> * Bugcheck Analysis
>
>
>
>
>

>
> Use !analyze -v to get detailed debugging information.
>
> BugCheck 7A, {1, d0000006, 8524cd88, c0006000}
>
> WARNING: Unable to verify timestamp for mssmbios.sys
> Unable to load image wdf01000.sys, Win32 error 0n2
>
WARNING: Unable to verify timestamp for wdf01000.sys
> ERROR: Module load completed but symbols could not be loaded for
> wdf01000.sys
>
WARNING: Unable to verify timestamp for Npfs.SYS
> Probably caused by : Pci9x5x.sys ( Pci9x5x!PLxEvtIoControl+1a1 )
>
> Followup: MachineOwner
> ---------
>
> 20: kd> !analyze -v
>
> *****
>
>
> * Bugcheck Analysis
>
>
>
>
>

>
> KERNEL_DATA_INPAGE_ERROR (7a)
> The requested page of kernel data could not be read in. Typically caused
> by
> a bad block in the paging file or disk controller error. Also see
> KERNEL_STACK_INPAGE_ERROR.
> If the error status is 0xC000000E, 0xC000009C, 0xC000009D or 0xC0000185,
> it means the disk subsystem has experienced a failure.
> If the error status is 0xC000009A, then it means the request failed because
> a filesystem failed to make forward progress.
> Arguments:
> Arg1: 00000001, lock type that was held (value 1,2,3, or PTE address)
> Arg2: d0000006, error status (normally i/o status code)
> Arg3: 8524cd88, current process (virtual address for lock type 3, or PTE)
> Arg4: c0006000, virtual address that could not be in-paged (or PTE
> contents if arg1 is a PTE address)
>
> Debugging Details:
> ------------------
>
>
> ERROR_CODE: (NTSTATUS) 0xd0000006 - The instruction at “0x%08lx”
> referenced memory at “0x%08lx”. The required data was not placed into
> memory because of an I/O error status of “0x%08lx”.
>
> BUGCHECK_STR: 0x7a_d0000006
>
> CUSTOMER_CRASH_COUNT: 1
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP
>
> PROCESS_NAME: Console.exe
>
> CURRENT_IRQL: 2
>
> LAST_CONTROL_TRANSFER: from 80851cd9 to 80827c63
>
> STACK_TEXT:
> b84c39ec 80851cd9 0000007a 00000001 d0000006 nt!KeDelayExecutionThread+0x99
> b84c3a20 80852458 8524cd88 c0600030 8524ce68
> nt!MiMapViewOfDataSection+0x533
> b84c3a3c 8083c965 c0600030 8524cd88 00000021
> nt!MiPfPutPagesInTransition+0x256
> b84c3a90 80853372 8522b000 8524ce68 c0006280 nt!MmProbeAndLockPages+0x623
> b84c3ae8 b8de5b01 8522b000 00000001 00000001 nt!MiDecommitPages+0x2ca
> b84c3b7c f72fa072 7b57a1f8 7ad0cfe8 00000004 Pci9x5x!PLxEvtIoControl+0x1a1
> [m:\zvi_vered\module\fio_vlrtr\windows\module\iocontrol.c @ 154]
> WARNING: Stack unwind information not available. Following frames may be
> wrong.
> b84c3ba0 f72fb3d0 7b57a1f8 7ad0cfe8 00000004 wdf01000+0x2f072
> b84c3bd0 f72fd9ac 7ad0cfe8 852f3010 84a85e00 wdf01000+0x303d0
> b84c3bec f72fea36 84a85e00 00000000 84a215e8 wdf01000+0x329ac
> b84c3c0c f7300824 852f3010 852e4368 85301668 wdf01000+0x33a36
> b84c3c30 f72efa3f 852e4368 b84c3c50 8081df65 wdf01000+0x35824
> b84c3c3c 8081df65 85234138 852e4368 84a5c388 wdf01000+0x24a3f
> b84c3c50 808f5437 852e43fc 84a5c388 852e4368 nt!IoCsqInitialize+0x31
> b84c3c64 808f61bf 85234138 852e4368 84a5c388
> nt!IopParseSymbolicLinkName+0xc1
> b84c3d00 808eed08 0000077c 00000758 00000000
> nt!IopGetDeviceInterfaces+0x5ab
> b84c3d34 8088978c 0000077c 00000758 00000000 nt!IopLoadDriver+0x634
> b84c3d64 7c8285ec badb0d00 0012fd44 00000000 nt!MiReserveSystemPtes+0x1ca
> b84c3d68 badb0d00 0012fd44 00000000 00000000 0x7c8285ec
> b84c3d80 00000000 00000000 00000000 00000000
> Npfs!NpCompleteStalledWrites+0x26
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> Pci9x5x!PLxEvtIoControl+1a1
> [m:\zvi_vered\module\fio_vlrtr\windows\module\iocontrol.c @ 154]
> b8de5b01 8b55d8 mov edx,dword ptr [ebp-28h]
>
> FAULTING_SOURCE_CODE:
> 150:
> UserMode,
> 151:
> MmCached ,
> 152:
> NULL,
> 153:
> FALSE,
> > 154:
> NormalPagePriority);
> 155:
> 156: if (!devExt->UserSpaceCommonBuffer)
> 157: {
> 158: KdPrint
> ((“MmMapLockedPagesSpecifyCache failed.\n”));
> 159: }
>
>
> SYMBOL_STACK_INDEX: 5
>
> SYMBOL_NAME: Pci9x5x!PLxEvtIoControl+1a1
>
> FOLLOWUP_NAME: MachineOwner
>
> MODULE_NAME: Pci9x5x
>
> IMAGE_NAME: Pci9x5x.sys
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4ee71b46
>
> FAILURE_BUCKET_ID: 0x7a_d0000006_Pci9x5x!PLxEvtIoControl+1a1
>
> BUCKET_ID: 0x7a_d0000006_Pci9x5x!PLxEvtIoControl+1a1
>
> Followup: MachineOwner
> ---------
>
>
> -----------------------------------------------------------------------------------------------------------------
>
> Shoud I run:
>
> !pte c0006000
> !vad 00c00000 1
>
> With RS232 cable connected to the server or can it run on a crashdump file
> (offline) ?
>
> Thank you in advance for your reply.
> Zvika.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

“Marvin(Fan) Zhang” wrote in message
news:xxxxx@ntdev…
> Very strange. Your driver should have had BSOD in
> MmMapLockedPagesSpecifyCache . However, according to call stack,
> MiDecommitPages make you BSOD.

Maybe it is not in MiDecommitPages but in some private functions. Note the
offset.

– pa

Dear Pavel,

What are “private functions” ? How can I set the code so that all functions will be “public” ?

Following Mr. Zhang request here is the code of IoControl.c:

/*++

Copyright (c) Microsoft Corporation. All rights reserved.

THIS CODE AND INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.

Module Name:

IoControl.c

Abstract:

Environment:

Kernel mode

–*/

#include “precomp.h”
#include “…\Common\FioAdapterIoControl.h”

/***************************************************************************
Function: PlxIoDeviceControl

Description:
****************************************************************************/
VOID PLxEvtIoControl ( IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t OutputBufferLength,
IN size_t InputBufferLength,
IN ULONG IoControlCode)
/*++

Routine Description:

This event is called when the framework receives IRP_MJ_DEVICE_CONTROL
requests from the system.

Arguments:

Queue - Handle to the framework queue object that is associated
with the I/O request.
Request - Handle to a framework request object.

OutputBufferLength - length of the request’s output buffer,
if an output buffer is available.
InputBufferLength - length of the request’s input buffer,
if an input buffer is available.

IoControlCode - the driver-defined or system-defined I/O control code
(IOCTL) that is associated with the request.
Return Value:

VOID

–*/
{
WDFDEVICE device;
PDEVICE_EXTENSION devExt = NULL;
size_t bytesReturned = 0;
BOOLEAN requestPending = FALSE;
NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
//unsigned long Address;
unsigned long Length;
void *pInBuffer;
void *pOutBuffer;

FIOA_WRITE_LONG *pWriteRequest;
FIOA_READ_LONG *pReadRequest;

FIOA_READ_LONG_REPLY *pReadReply;

WDFREQUEST InternalRequest;
WDFREQUEST DpcRequest;

PMDL CommonBufferMdl;
PVOID CommonBufferVirtualAddress;
ULONG CommonBufferLength;
PUCHAR pDst;

UNREFERENCED_PARAMETER(InputBufferLength);
UNREFERENCED_PARAMETER(OutputBufferLength);

KdPrint((“–> PlxEvtIoDeviceControl Code=%x\n”,IoControlCode));
//
// initialize variables
//
device = WdfIoQueueGetDevice(Queue);

devExt = PLxGetDeviceContext(device);

switch (IoControlCode)
{
case FIOA_WRITE_LONG_CODE:
status = WdfRequestRetrieveInputBuffer (Request,sizeof(FIOA_WRITE_LONG),
&pInBuffer, &Length);
pWriteRequest = (FIOA_WRITE_LONG *)pInBuffer;

/*KdPrint((“Write (Address=%x,Data=%x)\n”,pWriteRequest->Address,
pWriteRequest->Data));*/
WRITE_REGISTER_ULONG((PULONG)(devExt->Bar1Address+pWriteRequest->Address),
pWriteRequest->Data);

bytesReturned = 0;

WdfRequestCompleteWithInformation (Request,STATUS_SUCCESS,bytesReturned);
break;

case FIOA_READ_LONG_CODE:
status = WdfRequestRetrieveInputBuffer (Request,sizeof(FIOA_READ_LONG),
&pInBuffer, &Length);
pReadRequest = (FIOA_READ_LONG *)pInBuffer;

status = WdfRequestRetrieveOutputBuffer (Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);
pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

//KdPrint((“ReadLong: Address=%x\n”,pReadRequest->Address));

pReadReply->Data = READ_REGISTER_ULONG ((PULONG)(devExt->Bar1Address+pReadRequest->Address));

//KdPrint((“ReadLong: Data=%x\n”,pReadReply->Data));

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

WdfRequestCompleteWithInformation (Request,STATUS_SUCCESS,bytesReturned);
break;

case FIOA_INTERRUPT_CODE:
//Forward IOCTL request to a queue. Request will be completed in DPC
//status = WdfRequestForwardToIoQueue(Request,devExt->InternalQueue);
break;

case FIOA_ALLOCATE_COMMON_BUFFER:
status = WdfRequestRetrieveOutputBuffer (Request,sizeof(FIOA_READ_LONG_REPLY),
&pOutBuffer, &Length);

pReadReply = (FIOA_READ_LONG_REPLY *)pOutBuffer;

bytesReturned = sizeof(FIOA_READ_LONG_REPLY);

//Map common buffer to user space. This can be done only upon IOCTL request
__try
{
devExt->UserSpaceCommonBuffer = MmMapLockedPagesSpecifyCache(devExt->CommonBufferMdl,
UserMode,
MmCached ,
NULL,
FALSE,
NormalPagePriority);

if (!devExt->UserSpaceCommonBuffer)
{
KdPrint ((“MmMapLockedPagesSpecifyCache failed.\n”));
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
devExt->UserSpaceCommonBuffer = 0x0;
KdPrint ((“MmMapLockedPagesSpecifyCache caused exception: %x\n”,GetExceptionCode()));
}

pReadReply->Data = (unsigned long)devExt->UserSpaceCommonBuffer;

WdfRequestCompleteWithInformation (Request,STATUS_SUCCESS,sizeof(long));
break;
}

KdPrint((“<– PlxEvtIoDeviceControl\n”));

return;
}

Thanks,
Zvika.

Until the correct symbols are loaded by the debugger, the crash stack is bogus.