Hi,
I’m working on a driver for a webcam. I started getting memory corruption issue and hence enabled special pool in driver verifier. With special pools enabled, I started getting the BSOD C1 with sometimes as Parameter4 = 0x23 and sometimes 0x24. The system gives a BSOD after several thousands of transactions - not easily predictable.
There are two linked lists which I maintain in my driver - one for the pending IRPs (my own _IRPCONTEXT struct) and the other for pending URBs (my own _URBCONTEXT struct). Both these are allocated from NonPagedPool. The _IRPCONTEXT struct has always a fixed size (16 bytes). The _URBCONTEXT varies in size depending on the type of transfer (control, bulk or ISO). In one of the resolutions of the webcam, the transfer buffer length of ISO transfer is as large as 630k bytes!! Generally there are at least 6 to 8 ISO requests pending on the device.
I see that the verifier wraps my small allocations (_IRPCONTEXT) with non-accessible pages and also fills it with a pattern. However, memory is allocated from large pages for my _URBCOTEXT whose length is more than a page.
My understanding is that the verifier does NOT wrap large pages with inaccessible pages. Is this understanding correct?
Most of the memory corruption happens in my _IRPCONTEXT and few of them in the _URBCONTEXT . The verifier bug checks when I try to delete the context in the completion routine. BY this time, already the memory has been corrupted. The observation is that, there is always a memory corruption of 32 bytes or 64 bytes. I have taken a look at these values (in windbg). These values do not match any of my strings/structs. Also, this corruption ALWAYS happen within the “valid” page boundary - never in the inaccessible pages. Also, the actual data in these pages remain valid. The corruption happens somewhere outside my valid data boundary, but within the same page. I have tried the two options - “verify start” and “verify end” (in GFlags) and still the results are same.
So is there any other tool/technique by which I can detect who is corrupting the memory?
Any comments/hints are welcome.
Thanks,
Sri