Skip to content

ext/pci: fix crash on devices with non-standard PCI segment#802

Open
bartlomiejkida wants to merge 1 commit intoQubesOS:mainfrom
bartlomiejkida:main
Open

ext/pci: fix crash on devices with non-standard PCI segment#802
bartlomiejkida wants to merge 1 commit intoQubesOS:mainfrom
bartlomiejkida:main

Conversation

@bartlomiejkida
Copy link
Copy Markdown

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:

10000:e0:17.0 SATA controller: Intel Corporation Tiger Lake-LP SATA Controller (rev 20)
10000:e0:1d.0 PCI bridge: Intel Corporation Tiger Lake-LP PCI Express Root Port #9 (rev 20)

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:

[root@dom0 ~]# lspci
0000:00:00.0 Host bridge: Intel Corporation Tiger Lake-UP3/H35 4 cores Host Bridge/DRAM Registers (rev 01)
0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)
0000:00:04.0 Signal processing controller: Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant (rev 01)
0000:00:07.0 PCI bridge: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #0 (rev 01)
0000:00:07.1 PCI bridge: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #1 (rev 01)
0000:00:0d.0 USB controller: Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller (rev 01)
0000:00:0d.2 USB controller: Intel Corporation Tiger Lake-LP Thunderbolt 4 NHI #0 (rev 01)
0000:00:0e.0 RAID bus controller: Intel Corporation Volume Management Device NVMe RAID Controller
0000:00:12.0 Serial controller: Intel Corporation Tiger Lake-LP Integrated Sensor Hub (rev 20)
0000:00:14.0 USB controller: Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller (rev 20)
0000:00:14.2 RAM memory: Intel Corporation Tiger Lake-LP Shared SRAM (rev 20)
0000:00:14.3 Network controller: Intel Corporation Wi-Fi 6 AX201 (rev 20)
0000:00:15.0 Serial bus controller: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0 (rev 20)
0000:00:15.1 Serial bus controller: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #1 (rev 20)
0000:00:16.0 Communication controller: Intel Corporation Tiger Lake-LP Management Engine Interface (rev 20)
0000:00:16.3 Serial controller: Intel Corporation Tiger Lake-LP Active Management Technology - SOL (rev 20)
0000:00:17.0 System peripheral: Intel Corporation RST VMD Managed Controller
0000:00:1c.0 PCI bridge: Intel Corporation Tiger Lake-LP PCI Express Root Port #7 (rev 20)
0000:00:1d.0 System peripheral: Intel Corporation RST VMD Managed Controller
0000:00:1f.0 ISA bridge: Intel Corporation Tiger Lake-LP LPC Controller (rev 20)
0000:00:1f.3 Audio device: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller (rev 20)
0000:00:1f.4 SMBus: Intel Corporation Tiger Lake-LP SMBus Controller (rev 20)
0000:00:1f.5 Serial bus controller: Intel Corporation Tiger Lake-LP SPI Controller (rev 20)
0000:00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (13) I219-LM (rev 20)
0000:01:00.0 PCI bridge: Intel Corporation JHL7440 Thunderbolt 3 Bridge [Titan Ridge DD 2018] (rev 06)
0000:02:02.0 PCI bridge: Intel Corporation JHL7440 Thunderbolt 3 Bridge [Titan Ridge DD 2018] (rev 06)
0000:02:04.0 PCI bridge: Intel Corporation JHL7440 Thunderbolt 3 Bridge [Titan Ridge DD 2018] (rev 06)
0000:03:00.0 USB controller: Intel Corporation JHL7440 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] (rev 06)
0000:71:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A PCI Express Card Reader (rev 01)
10000:e0:17.0 SATA controller: Intel Corporation Tiger Lake-LP SATA Controller (rev 20)
10000:e0:1d.0 PCI bridge: Intel Corporation Tiger Lake-LP PCI Express Root Port #9 (rev 20)
10000:e1:00.0 Non-Volatile memory controller: Sandisk Corp IX SN530 NVMe SSD / microSD Express Card (DRAM-less) (rev 01)

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

@ben-grande
Copy link
Copy Markdown
Contributor

PipelineRetryFailed

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.11%. Comparing base (2488f2b) to head (db3fb63).

Files with missing lines Patch % Lines
qubes/ext/pci.py 50.00% 2 Missing ⚠️
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     
Flag Coverage Δ
unittests 70.11% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qubes-global-config crash on 4.3.0

2 participants