RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 843282 - libvirt reads PCI_BRIDGE_CONTROL from wrong device
Summary: libvirt reads PCI_BRIDGE_CONTROL from wrong device
Keywords:
Status: CLOSED DUPLICATE of bug 842017
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-25 22:52 UTC by Alex Williamson
Modified: 2012-09-05 06:54 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-05 06:54:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Alex Williamson 2012-07-25 22:52:02 UTC
Description of problem:
src/util/pci.c:pciTrySecondaryBusReset:

    /* Read the control register, set the reset flag, wait 200ms,
     * unset the reset flag and wait 200ms.
     */
    ctl = pciRead16(dev, PCI_BRIDGE_CONTROL);
                    ^^^

    pciWrite16(parent, PCI_BRIDGE_CONTROL, ctl | PCI_BRIDGE_CTL_RESET);

    usleep(200 * 1000); /* sleep 200ms */

    pciWrite16(parent, PCI_BRIDGE_CONTROL, ctl);

    usleep(200 * 1000); /* sleep 200ms */

Why are we reading the PCI_BRIDGE_CONTROL from dev (the device we want reset) and writing and restoring to parent?  The initial read should also be from the parent bridge.

Version-Release number of selected component (if applicable):
libvirt-0.9.13-2.el6

How reproducible:
Unknown, found in code read

Steps to Reproduce:
1.
2.
3.
  
Actual results:
Hard to predict, the bridge control register is offset 0x3e which is standard PCI config space for a device (min_gnt/max_lat) which may contain data.  So we're potentially blasting arbitrary bits into the bridge control register.

Expected results:


Additional info:

Comment 2 Osier Yang 2012-09-05 06:54:03 UTC
(In reply to comment #0)
> Description of problem:
> src/util/pci.c:pciTrySecondaryBusReset:
> 
>     /* Read the control register, set the reset flag, wait 200ms,
>      * unset the reset flag and wait 200ms.
>      */
>     ctl = pciRead16(dev, PCI_BRIDGE_CONTROL);
>                     ^^^
> 
>     pciWrite16(parent, PCI_BRIDGE_CONTROL, ctl | PCI_BRIDGE_CTL_RESET);
> 
>     usleep(200 * 1000); /* sleep 200ms */
> 
>     pciWrite16(parent, PCI_BRIDGE_CONTROL, ctl);
> 
>     usleep(200 * 1000); /* sleep 200ms */
> 
> Why are we reading the PCI_BRIDGE_CONTROL from dev (the device we want
> reset) and writing and restoring to parent?  The initial read should also be
> from the parent bridge.

I think this is caused by old codes assumes any device with devices/functions
behind the same bus is refused at the very beginning of secondary bus resetting,
so it should be fixed with 842017 together. And on the other hand, it's hard
for QE to very this bug. So close this as DUPLICATE.

*** This bug has been marked as a duplicate of bug 842017 ***


Note You need to log in before you can comment on or make changes to this bug.