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: <1901357.YAorP09rCo@vostro.rjw.lan>
Date:	Tue, 26 May 2015 03:08:17 +0200
From:	"Rafael J. Wysocki" <rjw@...ysocki.net>
To:	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	Sander Eikelenboom <linux@...elenboom.it>
Cc:	david.vrabel@...rix.com, xen-devel@...ts.xenproject.org,
	linux-kernel@...r.kernel.org
Subject: Re: [Xen-devel] Regression due to "device property: Make it possible to use secondary firmware nodes" Re: Xen-unstable + linux 4.1-mergewindow: problems with PV guest pci passthrough: pcifront pci-0: pciback not responding!!!

On Tuesday, May 26, 2015 01:42:16 AM Rafael J. Wysocki wrote:
> On Tuesday, May 26, 2015 01:22:12 AM Rafael J. Wysocki wrote:
> > On Friday, May 22, 2015 09:53:37 PM Boris Ostrovsky wrote:
> > > On 05/22/2015 04:11 AM, Sander Eikelenboom wrote:
> > > > Hello Sander,
> > > >
> 
> [cut]
> 
> > > (+Rafael again)
> > > 
> > > So the immediate cause of those errors is that pdev->evtchn is 0. 
> > > Backend is not notified and things not go well then.
> > > 
> > > And it is indeed caused by 97badf873ab60e841243b66133ff9eff2a46ef29:
> > > 
> > > We allocate pcifront_sd in pcifront_scan_root() and then pass it to 
> > > pci_scan_bus_parented() as sysdata. Eventually this sysdata is used in 
> > > pcibios_root_bridge_prepare() as pci_sysdata. It is dereferenced as 
> > > pci_sysdata->companion (which I believe is aliased to pcifront_sd->pdev)
> 
> Well, there is an int node field between them, so I'm not sure.
> 
> > > and then set_primary_fwnode() writes it, thus corrupting 
> > > pcifront_sd->pdev (and I think this is what sets evtchn to zero).
> 
> So the corruption happens when set_primary_fwnode() writes NULL to the
> 'secondary' field of object pointed to by 'fwnode'.
> 
> This isn't strictly necessary and we might avoid the crash by only
> writing to fwnode->secondary if fn is not NULL.
> 
> So, Sander please test the patch below too if possible.
> 
> Of course, that doesn't solve a problem of passing an incorrect pointer
> to ACPI_COMPANION_SET() in pcibios_root_bridge_prepare().

And here's one more thing to test.

Please let me know (a) if you get the stack trace from the WARN_ON() in the
patch below and (b) whether or not things work again with this patch applied.


---
 arch/x86/pci/acpi.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-pm/arch/x86/pci/acpi.c
===================================================================
--- linux-pm.orig/arch/x86/pci/acpi.c
+++ linux-pm/arch/x86/pci/acpi.c
@@ -483,8 +483,12 @@ struct pci_bus *pci_acpi_scan_root(struc
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
 	struct pci_sysdata *sd = bridge->bus->sysdata;
+	struct acpi_device *companion = sd->companion;
+
+	/* Protect against passing pointers of an incorrect type via sysdata. */
+	if (!WARN_ON(companion && companion->fwnode.type != FWNODE_ACPI))
+		ACPI_COMPANION_SET(&bridge->dev, companion);
 
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
 	return 0;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ