Drivers that are verified using the No Reboot feature of Driver Verifier are not monitored as thoroughly as drivers that are loaded after a reboot. Whenever possible, enable the driver for verification, and then restart the system. Running the following command from an elevated command prompt causes Driver Verifier to preserve verification settings across reboots:C:\>verifier /flags 0x1 /driver myfault.sys New verifier settings: Special pool: Enabled Pool tracking: Disabled Force IRQL checking: Disabled I/O verification: Disabled Deadlock detection: Disabled DMA checking: Disabled Security checks: Disabled Force pending I/O requests: Disabled Low resources simulation: Disabled IRP Logging: Disabled Miscellaneous checks: Disabled Verified drivers: myfault.sys You must restart this computer for the changes to take effect.
When you run Notmyfault and cause a buffer overflow, the system will immediately crash and the analysis of the dump reports this:Probably caused by : myfault.sys ( myfault+61d )
A verbose analysis describes the stop code like this:DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION (d6) N bytes of memory was allocated and more than N bytes are being referenced. This cannot be protected by try-except. When possible, the guilty driver's name (Unicode string) is printed on the bugcheck screen and saved in KiBugCheckDriver. Arguments: Arg1: beb50000, memory referenced Arg2: 00000001, value 0 = read operation, 1 = write operation Arg3: 9201161d, if non-zero, the address which referenced memory. Arg4: 00000000, (reserved)
Special pool made an elusive bug into one that instantly reveals itself and makes the analysis trivial.
Code Overwrite and System Code Write Protection
A driver with a bug that causes corruption or misinterpretation of its own data structures can reference memory the driver doesn’t own when it interprets corrupted data as a memory pointer value. The target of the pointer can be anything in the virtual address space, including data belonging to other drivers, invalid memory, or the code of other drivers or the kernel. As with buffer overruns, by the time that corruption is detected and the system crashes, it’s usually impossible to identify the driver that caused the corruption. Enabling special pool increases the chance of catching wild-pointer bugs, but it does not catch code corruption.
When you run Notmyfault and select the Code Overwrite option, the Myfault driver corrupts the entry point to the
However, if you have more than 2 GB of memory, you’ll get a different type of crash because the attempt to corrupt the memory isn’t caught. Because