Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
xen.35285
xsa449.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xsa449.patch of Package xen.35285
From: Roger Pau Monne <roger.pau@citrix.com> Subject: pci: fail device assignment if phantom functions cannot be assigned The current behavior is that no error is reported if (some) phantom functions fail to be assigned during device add or assignment, so the operation succeeds even if some phantom functions are not correctly setup. This can lead to devices possibly being successfully assigned to a domU while some of the device phantom functions are still assigned to dom0. Even when the device is assigned domIO before being assigned to a domU phantom functions might fail to be assigned to domIO, and also fail to be assigned to the domU, leaving them assigned to dom0. Since the device can generate requests using the IDs of those phantom functions, given the scenario above a device in such state would be in control of a domU, but still capable of generating transactions that use a context ID targeting dom0 owned memory. Modify device assign in order to attempt to deassign the device if phantom functions failed to be assigned. Note that device addition is not modified in the same way, as in that case the device is assigned to a trusted domain, and hence partial assign can lead to device malfunction but not a security issue. This is XSA-449 / CVE-2023-46839 Fixes: 4e9950dc1bd2 ('IOMMU: add phantom function support') Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1562,24 +1562,36 @@ static int assign_device(struct domain * pdev->fault.count = 0; - if ( (rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag)) ) - goto done; + rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag); - for ( ; pdev->phantom_stride; rc = 0 ) + while ( pdev->phantom_stride && !rc ) { devfn += pdev->phantom_stride; if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) ) break; rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag); - if ( rc ) - printk(XENLOG_G_WARNING "d%d: assign %04x:%02x:%02x.%u failed (%d)\n", - d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - rc); } done: + if ( rc ) + { + printk(XENLOG_G_WARNING "%pd: assign %s(%04x:%02x:%02x.%u) failed (%d)\n", + d, devfn != pdev->devfn ? "phantom function " : "", + seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc); + + if ( devfn != pdev->devfn && + deassign_device(d, seg, bus, pdev->devfn) && + !is_hardware_domain(d) && d != dom_io ) + /* + * Device with phantom functions that failed to both assign and + * rollback. Crash the target domain, as the state of the + * functions at this point is unknown and Xen has no way to assert + * consistent context assignment among them. + */ + domain_crash(d); + } /* The device is assigned to dom_io so mark it as quarantined */ - if ( !rc && d == dom_io ) + else if ( d == dom_io ) pdev->quarantine = true; pcidevs_unlock();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor