Hi from Germany,
since several years our NDIS miniport driver (NDIS Version 6.6) with our NDIS PCIe NIC (DMA busmaster adapter) runs without any problems on Windows machines.
New mainboards with BIOS enabled kernel DMA protection (âenabledâ seems to be default) result in a blue screen, when the computer starts and the miniport driver is enabled:
DRIVER_VERIFIER_DMA_VIOLATION (e6)
An illegal DMA operation was attempted by a driver being verified.
Arguments:
Arg1: 0000000000000026, IOMMU detected DMA violation.
Arg2: 0000000000000000, Device Object of faulting device.
Arg3: 00000000000c1f80, Faulting information (usually faulting physical address).
Arg4: 0000000000000006, Fault type (hardware specific).
PROCESS_NAME: System
STACK_TEXT:
fffff80285a6cea8 fffff802
7eadab47 : 00000000000000e6 00000000
00000026 0000000000000000 00000000
000c1f80 : nt!KeBugCheckEx
fffff80285a6ceb0 fffff802
7eac6a6b : 0000000000000000 00000000
00000000 fffff8027f249dd0 fffff802
7f249dd0 : nt!IvtHandleInterrupt+0x1a7
fffff80285a6cf10 fffff802
7e927f55 : fffff8027f2f3cc0 fffff802
85a5da50 fffff8027f2f3d70 00000000
00000000 : nt!HalpIommuInterruptRoutine+0x4b
fffff80285a6cf40 fffff802
7e9f75cc : fffff80285a5da50 fffff802
7f2f3cc0 00000000000007c4 fffff802
7e9fc940 : nt!KiCallInterruptServiceRoutine+0xa5
fffff80285a6cf90 fffff802
7e9f79d7 : fffff80285a5daf0 00000000
00000001 0000000000040046 fffff802
7e870188 : nt!KiInterruptSubDispatchNoLock+0x11c
fffff80285a5d9d0 fffff802
7e9f977a : 0000000000000000 00000000
00000000 fffff8027f327600 00000000
000007c4 : nt!KiInterruptDispatchNoLock+0x37
fffff80285a5db60 00000000
00000000 : fffff80285a5e000 fffff802
85a57000 0000000000000000 00000000
00000000 : nt!KiIdleLoop+0x5a
SYMBOL_NAME: nt!IvtHandleInterrupt+1a7
MODULE_NAME: nt
IMAGE_NAME: ntkrnlmp.exe
According to the modules list of WinDbg the miniport driver seems to be loaded.
The BSD occurs on Windows 10 and 11 operating systems.
The stop code DRIVER_VERIFIER_DMA_VIOLATION gives a false indication - driver verifier is not (specifically) enabled at the machines!
More info on kernel DMA protection can be found under
how-windows-protects-against-dma-drive-by-attacks
Another user has posted on the internet:
âTo work around this issue, disable Kernel DMA Protection in BIOS. ⌠Microsoft is aware of this issue. A resolution will be provided in an upcoming release.â
See
stop-code-driver-verifier-dma-violation.md
The Microsoft (see link above) writes:
âWindows leverages the system Input/Output Memory Management Unit (IOMMU) to block external peripherals from starting and performing DMA unless the drivers for these peripherals support memory isolation (such as DMA-remapping).â
Our miniport driver allocates memory with the following code:
// Register a DMA channel. !! Necessary, otherwise NdisMAllocateSharedMemory will fail.
//
NdisZeroMemory(&dmaDescription, sizeof(NDIS_DMA_DESCRIPTION));
dmaDescription.DemandMode = FALSE;
dmaDescription.AutoInitialize = FALSE;
dmaDescription.DmaChannelSpecified = FALSE;
dmaDescription.DmaWidth = Width32Bits;
dmaDescription.DmaSpeed = Compatible;
dmaDescription.DmaPort = 0;
dmaDescription.DmaChannel = 0;
status = NdisMRegisterDmaChannel(&Adapter->MiniportDmaHandle, Adapter->MiniportAdapterHandle, 0, TRUE, &dmaDescription, 4);
NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->lengthSMComplete, FALSE, &Adapter->pSMvirtualStartOriginal, &Adapter->pSMphysicalStartOriginal);
Under
enabling-dma-remapping-for-device-drivers
you can find only, that I can add:
[MyServiceInstall_AddReg]
HKR,Parameters,DmaRemappingCompatible,0x00010001,1 ; where 1 = opt-in
to the INF file with the opt-in parameter = 1 meaning
âThis indicates to the system that your driver is fully compatible with DMA remapping.â
My questions are:
- How can a driver and/or PCIx adapter made compatible with DMA remapping?
- Can I avoid the BSD by software means and without disabling the kernel DMA protection in BIOS?
- Is it correct, that Microsoft is aware of the problem (is it a MS problem?) and is working on a solution?
Thanks a lot!
Carsten