ext/pci: fix crash on devices with non-standard PCI segment#802
ext/pci: fix crash on devices with non-standard PCI segment#802bartlomiejkida wants to merge 1 commit into
Conversation
|
PipelineRetryFailed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #802 +/- ##
==========================================
- Coverage 70.12% 70.11% -0.01%
==========================================
Files 61 61
Lines 14001 14004 +3
==========================================
+ Hits 9818 9819 +1
- Misses 4183 4185 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| port_id = sbdf_to_path(libvirt_name) | ||
| try: | ||
| port_id = sbdf_to_path(libvirt_name) | ||
| except (AssertionError, ValueError, KeyError): |
There was a problem hiding this comment.
I don't like catching AssertionError here. Asserts should never trigger - if they do, it means a but somewhere (might be also in the assert condition itself).
But also, shouldn't the VMD case be handled by the regex match above already? It has 4 hex digits for segment, but VMD devices have 5, so it shouldn't match there.
|
|
Summary
On Dell Latitude 5420 (and likely other Tiger Lake laptops), Intel VMD (Volume Management Device) is enabled by default in BIOS. VMD creates a virtual PCI segment 10000: for the storage devices it manages:
When qubesd enumerates PCI devices, sbdf_to_path() hits an AssertionError on these devices because their bus topology doesn't match the expected hierarchy. This crashes the entire admin.vm.device.pci.Available API call, making qvm-pci unusable.
Full lspci on this machine:
Fix
Catch the AssertionError from sbdf_to_path() in PCIDevice.init and convert it to UnsupportedDevice. The existing handler in on_device_list_pci already skips unsupported devices gracefully with a warning log. VMD-managed devices cannot be passed through to VMs via standard PCI passthrough anyway, so skipping them is the correct behavior.
This patch fixes qvm-pci, but also qubes-global-config, which needs to load the PCI device list first.
Closes QubesOS/qubes-issues#10847