lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA1PR21MB13352A1D7C4575CB83CE47A1BF15A@SA1PR21MB1335.namprd21.prod.outlook.com>
Date:   Wed, 16 Aug 2023 19:30:40 +0000
From:   Dexuan Cui <decui@...rosoft.com>
To:     Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "jgg@...pe.ca" <jgg@...pe.ca>,
        "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        "kw@...ux.com" <kw@...ux.com>, KY Srinivasan <kys@...rosoft.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "lpieralisi@...nel.org" <lpieralisi@...nel.org>,
        "Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
        "robh@...nel.org" <robh@...nel.org>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        "helgaas@...nel.org" <helgaas@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] PCI: hv: Fix a crash in hv_pci_restore_msi_msg()
 during hibernation

> From: Kuppuswamy Sathyanarayanan
> <sathyanarayanan.kuppuswamy@...ux.intel.com>
> Sent: Wednesday, August 16, 2023 11:12 AM
> [...]
> On 8/16/2023 10:59 AM, Dexuan Cui wrote:
> > When a Linux VM with an assigned PCI device runs on Hyper-V, if the PCI
> > device driver is not loaded yet (i.e. MSI-X/MSI is not enabled on the
> > device yet), doing a VM hibernation triggers a panic in
> > hv_pci_restore_msi_msg() -> msi_lock_descs(&pdev->dev), because
> > pdev->dev.msi.data is still NULL.
> >
> > Avoid the panic by checking if MSI-X/MSI is enabled.
> >
> > Fixes: dc2b453290c4 ("PCI: hv: Rework MSI handling")
> > Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> > ---
> >
> > Changes in v2:
> >      Replaced the test "if (!pdev->dev.msi.data)" with
> > 		      "if (!pdev->msi_enabled && !pdev->msix_enabled)".
> >        Thanks Michael!
> >      Updated the changelog accordingly.
> >
> >   drivers/pci/controller/pci-hyperv.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-
> hyperv.c
> > index 2d93d0c4f10d..bed3cefdaf19 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -3983,6 +3983,9 @@ static int hv_pci_restore_msi_msg(struct pci_dev
> *pdev, void *arg)
> >   	struct msi_desc *entry;
> >   	int ret = 0;
> >
> > +	if (!pdev->msi_enabled && !pdev->msix_enabled)
> > +		return 0;
> Isn't this is a error condition? Don't you want to return error here?

This is not an error.  If a PCI device driver is not loaded or not installed, 
MSI-X/MSI is not enabled on the device, so pdev->msi_enabled is 0
and pdev->msix_enabled is 0. In this case, it's still legit for a user to request
the system (i.e. here it's a Linux VM running on Hyper-V) to hibernate -- in
this case, we should not try to save/restore the MSI/MSI-X state, and we
should not let the hibernation fail; here we should just ignore the device
by returning a success ("return 0;").

> > +
> >   	msi_lock_descs(&pdev->dev);
> >   	msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
> >   		irq_data = irq_get_irq_data(entry->irq);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ