Received: from eggs.gnu.org ([140.186.70.92]:36308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QN1K6-0001sQ-Vr for qemu-devel@nongnu.org; Thu, 19 May 2011 07:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QN1K5-0000Wr-Un for qemu-devel@nongnu.org; Thu, 19 May 2011 07:23:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QN1K5-0000Wn-Ly for qemu-devel@nongnu.org; Thu, 19 May 2011 07:23:21 -0400 From: Markus Armbruster References: <1305796393-22786-1-git-send-email-kraxel@redhat.com> <1305796393-22786-2-git-send-email-kraxel@redhat.com> <4DD4FB3A.1060600@redhat.com> Date: Thu, 19 May 2011 13:23:18 +0200 In-Reply-To: <4DD4FB3A.1060600@redhat.com> (Gerd Hoffmann's message of "Thu, 19 May 2011 13:12:58 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Isaku Yamahata , qemu-devel@nongnu.org Gerd Hoffmann writes: > Hi, > > Markus Armbruster writes: > >> Gerd Hoffmann writes: >> >>> This patch makes qemu ignore unplug requests from the guest for pci >>> devices which are tagged as non-hotpluggable. Trouble spot is the >>> piix4 chipset with the ISA bridge. Requests to unplug that one will >>> make it go away together with all ISA bus devices, which are not >>> prepared to be unplugged and thus don't cleanup, leaving active >>> qemu timers behind in free'ed memory. >>> >>> Signed-off-by: Gerd Hoffmann >>> --- >>> hw/acpi_piix4.c | 4 +++- >>> 1 files changed, 3 insertions(+), 1 deletions(-) >>> >>> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c >>> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c >>> index 96f5222..6c908ff 100644 >>> --- a/hw/acpi_piix4.c >>> +++ b/hw/acpi_piix4.c >>> @@ -471,11 +471,13 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val) >>> BusState *bus = opaque; >>> DeviceState *qdev, *next; >>> PCIDevice *dev; >>> + PCIDeviceInfo *info; >>> int slot = ffs(val) - 1; >>> >>> QLIST_FOREACH_SAFE(qdev,&bus->children, sibling, next) { >>> dev = DO_UPCAST(PCIDevice, qdev, qdev); >>> - if (PCI_SLOT(dev->devfn) == slot) { >>> + info = container_of(qdev->info, PCIDeviceInfo, qdev); >>> + if (PCI_SLOT(dev->devfn) == slot&& !info->no_hotplug) { >>> qdev_free(qdev); >>> } >>> } >> >> Looks good, but what about pcie_cap_slot_hotplug()? > > Dunno, didn't look at q35 yet. I'd expect the root bus isn't > hot-pluggable, so the guest wouldn't be able to rip out any essential > chipset devices. But having someone more familier with pcie + q35 > double-check would be good ... I guess that would be Isaku Yamahata (cc'ed).