Hi all,
I want some memory pages to be locked in memory to be a share memory between user and kernel.
When I use MmMapLockedPagesSpecifyCache to lock some user memory space, it will crash sometimes.
Note:OS is win8 32bit
Here are my codes
lowAddress.QuadPart = 0;
highAddress.QuadPart = 0xFFFFFFFFFFFFFFFF;
totalBytes = 1024*1024;
mdl = MmAllocatePagesForMdl(lowAddress,highAddress,lowAddress,totalBytes);
if(!mdl)
return STATUS_INSUFFICIENT_RESOURCES;
__try{
userVAToReturn =
MmMapLockedPagesSpecifyCache(mdl, // MDL
UserMode, // Mode
MmCached, // Caching
NULL, // Address
FALSE, // Bugcheck?
HighPagePriority); // Priority
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
status = GetExceptionCode();
}
if(!userVAToReturn) {
MmFreePagesFromMdl(mdl);
IoFreeMdl(mdl);
return STATUS_INSUFFICIENT_RESOURCES;
}
*UserVa = userVAToReturn;
*PMemMdl = mdl;
return STATUS_SUCCESS;
debug message:
*******************************************************************************
* *
* 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: 843ee580, current process (virtual address for lock type 3, or PTE)
Arg4: c0011000, virtual address that could not be in-paged (or PTE contents if arg1 is a PTE address)
Debugging Details:
TRIAGER: Could not open triage file : c:\program files (x86)\windows kits\8.0\debuggers\x64\triage\modclass.ini, error 2
ERROR_CODE: (NTSTATUS) 0xd0000006 - 0x%p
BUGCHECK_STR: 0x7a_d0000006
DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT
PROCESS_NAME: RAPT.exe
CURRENT_IRQL: 2
DEVICE_OBJECT: 86043d80
DRIVER_OBJECT: 84f2f370
IMAGE_NAME: OsrSVMStor.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 50053064
FAULTING_MODULE: 82342000 fltmgr
LAST_CONTROL_TRANSFER: from 81ad1b63 to 81aa99d0
STACK_TEXT:
9ec0af3c 81ad1b63 00000003 b5296bc8 0000007a nt!RtlpBreakWithStatusInstruction
9ec0af8c 81ad11a4 00000003 81c26138 9ec0b394 nt!KiBugCheckDebugBreak+0x1c
9ec0b368 81aa863a 0000007a 00000001 d0000006 nt!KeBugCheck2+0x594
9ec0b38c 81aa8571 0000007a 00000001 d0000006 nt!KiBugCheck2+0xc6
9ec0b3ac 81b501ea 0000007a 00000001 d0000006 nt!KeBugCheckEx+0x19
9ec0b3e4 81a8758d c0011000 00000000 00000000 nt! ?? ::FNODOBFM::string'+0x25cc3 9ec0b43c 81dbd814 02200000 84400bfc 00000000 nt!MiMapLockedPagesInUserSpaceHelper+0xc6 9ec0b48c 81b50250 84400be0 000022ff 00000001 nt!MiMapLockedPagesInUserSpace+0x28f 9ec0b4f8 9ff78ebc 84400be0 00000001 00000001 nt! ?? ::FNODOBFM::
string’+0x25d1e
9ec0b564 9ff73fe5 840a1ff8 840a1ff4 516373d5 OsrSVMStor!CreateAndMapMemory+0xdc
9ec0b750 9ff72b1f 840a1c28 84f34830 874c1f58 OsrSVMStor!OsrUserHandleSrb+0x295
9ec0b77c 9ff72031 874c1f58 84f34830 9ec0b79e OsrSVMStor!OsrVmExecuteScsi+0x1af
9ec0b7a0 822da18d 874c1f58 84f34830 843ea920 OsrSVMStor!OsrHwStartIo+0x61
9ec0b7e0 822d9bed 842a10e0 00000000 9ec0b834 storport!RaidAdapterPostScatterGatherExecute+0x1f4
9ec0b7f0 822f2c53 842a10e0 8464f450 843ea920 storport!RaidAdapterExecuteXrb+0x4d
9ec0b834 822e3615 845cb030 843ea920 9ec0b854 storport!RaUnitStartIo+0x162
9ec0b874 822f3a1f 003ea990 843ea920 00000001 storport!RaidStartIoPacket+0x143
9ec0b89c 822f5c88 845cb0e8 00000000 843ea920 storport!RaidUnitSubmitRequest+0xca
9ec0b8e4 822e1a54 845cb0e8 843ea920 874b66c8 storport!RaUnitScsiIrp+0x206
9ec0b900 81baa07d 845cb030 843ea920 84f34830 storport!RaDriverScsiIrp+0x5d
9ec0b918 82303f68 9dfd6808 00100000 00000000 nt!IofCallDriver+0x3d
9ec0b96c 823041bd 845cb030 9dfd6808 00000001 storport!PortPassThroughSendAsync+0x117
9ec0b9a0 822fe8b8 845cb030 9dfd6808 00000001 storport!PortPassThroughExSendAsync+0x36
9ec0b9cc 822dcb62 842a10e0 845cb0e8 00000001 storport!RaidAdapterPassThrough+0x84
9ec0ba08 822e1b08 842a10e0 9dfd6808 845cb0e8 storport!RaidAdapterDeviceControlIrp+0x1d1
9ec0ba28 81baa07d 842a1028 9dfd6808 842a10e0 storport!RaDriverDeviceControlIrp+0x6a
9ec0ba40 823023fb 9dfd6808 845cb0e8 0004d014 nt!IofCallDriver+0x3d
9ec0ba68 822f54f6 845cb0e8 9dfd6808 9dfd6808 storport!RaUnitScsiPassThroughIoctl+0xe9
9ec0bab0 822e1aff 845cb0e8 9dfd6808 9dfd6974 storport!RaUnitDeviceControlIrp+0x23d
9ec0bad0 81baa07d 845cb030 9dfd6808 0004d014 storport!RaDriverDeviceControlIrp+0x61
9ec0bae8 82d22daa 9dfd6808 00000005 000012c0 nt!IofCallDriver+0x3d
9ec0bc10 82d076a9 84531718 9dfd6808 84343d38 CLASSPNP!ClassDeviceControl+0x13a
9ec0bc54 82d29d0f 84531718 9dfd6808 00000001 disk!DiskDeviceControl+0x105
9ec0bc70 82d2ffc9 84531718 9dfd6808 845317d0 CLASSPNP!ClassDeviceControlDispatch+0x8f
9ec0bc88 81baa07d 84531718 9dfd6808 9dfd6808 CLASSPNP!ClassGlobalDispatch+0x39
9ec0bca0 8837b066 84343d70 9dfd6808 00000050 nt!IofCallDriver+0x3d
9ec0bce4 88373cab 84343c80 9dfd6808 9dfd6974 partmgr!PmIoctlRedirect+0x61
9ec0bd04 883731d8 84343c80 84343d70 8460d778 partmgr!PmFilterDeviceControl+0xfd
9ec0bd38 81baa07d 84343c80 9dfd6808 9dfd6808 partmgr!PmGlobalDispatch+0x1d3
9ec0bd50 88373a0d 8460d6c0 9dfd6808 9dfd6974 nt!IofCallDriver+0x3d
9ec0bd74 883731d8 8460d6c0 9dfd6808 9dfd6990 partmgr!PmLegacyDeviceControl+0xe7
9ec0bda8 81baa07d 8460d6c0 9dfd6808 84608d28 partmgr!PmGlobalDispatch+0x1d3
9ec0bdc0 883bf5ae 9dfd6808 84608c70 845b300e nt!IofCallDriver+0x3d
9ec0bdf4 81baa07d 84608c70 9dfd6808 845b30d8 volmgr!VmDeviceControl+0x280
9ec0be0c 82c210a7 845b3020 9ec0be60 82c211e2 nt!IofCallDriver+0x3d
9ec0be18 82c211e2 845b3020 9dfd6808 8430d230 fvevol!FveFilterSkip+0x31
9ec0be60 81baa07d 845b3020 9dfd6808 9dfd6808 fvevol!FveFilterDeviceControl+0x130
9ec0be78 82cbe3c5 00000000 8430d160 9ec0bec8 nt!IofCallDriver+0x3d
9ec0be88 82cbe501 8430d160 9dfd6808 009b2f5d rdyboost!SmdDispatchPassthrough+0x69
9ec0bec8 81baa07d 8430d160 9dfd6808 9dfd6808 rdyboost!SmdDispatchDeviceControl+0x63
9ec0bee0 82c8243a 9ec0bfe0 845e8610 8434160e nt!IofCallDriver+0x3d
9ec0bf1c 81baa07d 845e8610 9dfd6808 84341600 volsnap!VolSnapDeviceControl+0x6e
9ec0bf34 82639844 97ff6a50 9ec0bf54 81aa8c62 nt!IofCallDriver+0x3d
9ec0bf40 81aa8c62 97ff6b18 ffffffff 81acf267 Ntfs!NtfsStorageDriverCallout+0x14
9ec0bf40 81a3ec8b 97ff6b18 ffffffff 81acf267 nt!KiSwitchKernelStackAndCallout+0x9e
97ff6ae0 81a3eb09 82639830 97ff6b18 00003000 nt!KeExpandKernelStackAndCalloutInternal+0x16b
97ff6afc 8263361e 82639830 97ff6b18 00003000 nt!KeExpandKernelStackAndCalloutEx+0x1e
97ff6b28 826b429a 9dfd6808 00000000 28eed83d Ntfs!NtfsCallStorageDriver+0x2a
97ff6b98 81baa07d 845eb018 9dfd6808 0000010e Ntfs!NtfsFsdDeviceControl+0xcb
97ff6bb0 823430f2 87414420 86043d80 0000010e nt!IofCallDriver+0x3d
97ff6be4 81baa07d 86043d80 9dfd6808 00000100 fltmgr!FltpDispatch+0xed
97ff6bfc 81c68baf 9dfd69e0 9dfd6808 00000050 nt!IofCallDriver+0x3d
97ff6c50 81c68622 86043d80 00000000 81c87601 nt!IopSynchronousServiceTail+0x10a
97ff6cf0 81c6824f 00000001 9dfd6808 00000000 nt!IopXxxControlFile+0x3b7
97ff6d24 81b220bc 000000cc 00000000 00000000 nt!NtDeviceIoControlFile+0x2a
97ff6d24 77b85ee4 000000cc 00000000 00000000 nt!KiFastCallEntry+0x12c
021ff900 77b84f96 77b1d408 000000cc 00000000 ntdll!KiFastSystemCallRet
021ff904 77b1d408 000000cc 00000000 00000000 ntdll!NtDeviceIoControlFile+0xa
021ff95c 7539d798 000000cc 00000000 00000000 verifier!AVrfpNtDeviceIoControlFile+0x10d
021ff9bc 756228c8 000000cc 0004d014 021ffa18 KERNELBASE!DeviceIoControl+0x77
021ff9e8 00401bd6 000000cc 0004d014 021ffa18 KERNEL32!DeviceIoControlImplementation+0x3d0
Thanks for any reply.