drivers/gop: Prove console framebuffer ownership via ConOut - #3
Merged
Conversation
Lunar Lake firmware (Lenovo 83JT, QPCN13WW) installs GOP on a console aggregate handle: it carries no device path, and no PCI function records an EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER relation naming it. Both existing proofs therefore fail and the framebuffer's source is reported unknown, even though the firmware knows exactly which device scans it out. For that one handle the firmware states the answer in its own ConOut variable. On this machine it reads PciRoot(0x0)/Pci(0x2,0x0)/AcpiAdr(0x80011400), naming 00:02.0 — the Arc 130V/140V function. Add a third proof, gated on the GOP handle being exactly gST->ConsoleOutHandle, that walks that multi-instance path and resolves each instance through EFI_PCI_IO_PROTOCOL. Every instance that resolves must agree on one function; a console scanning out via two devices proves ownership of neither and stays unknown. This remains a firmware-asserted binding, not an inference from display class or framebuffer address. LocateDevicePath stops only at an end-of-entire-path node, so an instance closed by an end-of-instance node would let it read into the next instance. The variable is read into our own buffer, so promote that node for the call and restore it after. Also add revision 1 of the framebuffer-source extension: a per-framebuffer probe mask recording how far each proof got. Rung-level notes can then name the firmware shape that defeated attribution — no device path, a path with no PCI prefix, a ConOut naming two devices — which are indistinguishable from an unknown source alone, and are different bugs. The revision-0 prefix is unchanged, so existing readers are unaffected. Signed-off-by: Cass Sheng <cass@microperceptron.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lunar Lake firmware (Lenovo 83JT, QPCN13WW) installs GOP on a console aggregate handle: it carries no device path, and no PCI function records an EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER relation naming it. Both existing proofs therefore fail and the framebuffer's source is reported unknown, even though the firmware knows exactly which device scans it out.
For that one handle the firmware states the answer in its own ConOut variable. On this machine it reads
PciRoot(0x0)/Pci(0x2,0x0)/AcpiAdr(0x80011400), naming 00:02.0 — the Arc 130V/140V function. Add a third proof, gated on the GOP handle being exactly gST->ConsoleOutHandle, that walks that multi-instance path and resolves each instance through EFI_PCI_IO_PROTOCOL. Every instance that resolves must agree on one function; a console scanning out via two devices proves ownership of neither and stays unknown. This remains a firmware-asserted binding, not an inference from display class or framebuffer address.
LocateDevicePath stops only at an end-of-entire-path node, so an instance closed by an end-of-instance node would let it read into the next instance. The variable is read into our own buffer, so promote that node for the call and restore it after.
Also add revision 1 of the framebuffer-source extension: a per-framebuffer probe mask recording how far each proof got. Rung-level notes can then name the firmware shape that defeated attribution — no device path, a path with no PCI prefix, a ConOut naming two devices — which are indistinguishable from an unknown source alone, and are different bugs. The revision-0 prefix is unchanged, so existing readers are unaffected.