Repository navigation
v0.2
Pre-release
Pre-release
viogpu: stop reading an IO_STATUS_BLOCK the I/O manager never wrote
Installing the driver over itself bugchecked 0x50 PAGE_FAULT_IN_NONPAGED_AREA
in InjectFramebufferResource, reached from the IRP_MJ_PNP hook while PnP was
restarting the device.
The hook queried the PDO's boot configuration with
IoBuildSynchronousFsdRequest() and then read the resource list out of the
IO_STATUS_BLOCK it had passed in. That helper reports its result by writing
the caller's status block from the I/O manager's special kernel APC, and the
hook runs inside PnP enumeration, where that APC can be deferred past the
hook's own return. The status block therefore still held whatever the stack
happened to contain -- at the crash, IoCallDriver had returned
STATUS_NOT_SUPPORTED (pci has no boot config to report once the device is
being restarted) while Information held a stale stack address, which the
resource walk then followed until it ran off the top of the kernel stack.
Nothing checked the IoCallDriver status or the list pointer, and the IRP was
leaked whenever the APC did not run.
- The query IRP is now allocated and freed here, with a completion routine
that signals an event and returns STATUS_MORE_PROCESSING_REQUIRED, so the
result is read straight out of Irp->IoStatus with no dependency on APC
delivery and no ambiguity about who frees the IRP.
- A failed query, or one that yields no list, forwards the original IRP to
the original dispatch, so a device with no boot configuration behaves
exactly as it would with the dispatch unpatched. A failure to inject no
longer fails the query either: the unmodified list is passed up instead.
- The fixup only applies to the PDO the fixup was installed for. The patched
dispatch belongs to \Driver\pci and is shared by every PCI device, so
IRP_MN_QUERY_RESOURCES for unrelated devices was being answered with a
framebuffer resource injected into their boot configurations.
- The dispatch is restored only while it is still ours, since a driver that
patched on top cannot be unlinked by putting the saved pointer back.
Validated: three install/verify cycles from a cold boot, device Started each
time, D3D11 device creation on the VirtIO adapter at all five feature levels,
no bugcheck; desktop renders after a clean cycle.
Assisted-by: Claude:claude-opus-5