Windows 10 GPIO Driver - Driver verifier issue

Processor: Intel Baytrail Based.
OS: Windows 10 64 bit - 1607 version.
**Driver implementation: **
1, Our driver is based on the https://github.com/Microsoft/Windows-driver-samples/tree/master/gpio/samples/simdevice
2. We did the necessary BIOS changes required.
3. We added an IOCTL function, to have an user interface.
4. Installed Intel GPIO Host Controller driver as well.

Driver functioning:
The driver is functioning under normal scenario (no issues are seen). We are doing a loopback and both read and write are functioning. This is without running/enabling the verifier tool.

Issue description:
When we enabled the verifier (Standard and with all drivers enabled). We are getting the BSOD - SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION. On debugging further here is what we found

  • the issue happens only when reading a GPIO pin; writing to a GPIO pin doesn’t cause any error.
  • when we removed the line WdfObjectDelete(IoctlRequest); from tee simdevice.c file, we are not seeing BSOD. But, it leads to memory leak.
    - Most Importantly, the issue doesn’t occur on Windows 10 1809 version, with the same set of binaries.

Questions:
Is there any known bugs like this in version 1607? As far as we searched, we couldn’t locate any.
Our driver, is same as simdevice.c; we just added an IOCTL. However, we also tried testing it from DriverEntry to make sure for this issue. And yes, from DriverEntry if we call the TestReadWrite for GPIO read, again, we see the same crash as described above.
Any suggestions on this issues are welcome.

Thank you.

Is there any known bugs like this in version 1607

Nope.

Any suggestions on this issues are welcome.

I don’t see anything wrong with the code in the sample.

That means you’re stuck debugging the problem. Use the crash dump. Be sure to enable WDF Verifier, with verbose tracing. Look at the IFR (!wdfkd.wdflogdump). Be sure you haven’t accidentally enabled one of the low resource simulations in Windows Driver Verifier.

Peter

sankarraj85 wrote:

When we enabled the verifier (Standard and with all drivers enabled). We are getting the BSOD - SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION. On debugging further here is what we found

* the issue happens only when reading a GPIO pin; writing to a GPIO pin doesn’t cause any error.
* when we removed the line WdfObjectDelete(IoctlRequest); from tee simdevice.c file, we are not seeing BSOD. But, it leads to memory leak.

What this tells me is that the “size” value in your ioctl doesn’t match
what the ACPI processing is trying to copy, so it’s copying bytes past
the end of the buffer.  For a METHOD_BUFFERED ioctl, that wouldn’t be
detected until the IRP was freed.  What byte count are you passing in
your read/write calls?