Fix CVE-2011-1751.
Hi folks,
Urgent security fix. Details are in the commit message.
please pull,
Gerd
Gerd Hoffmann (1):
Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
The following changes since commit 96d19bcbf5f679bbaaeab001b572c367fbfb2b03:
ahci: Unbreak bar registration (2011-05-16 10:15:47 -0500)
are available in the git repository at:
git://git.kraxel.org/qemu CVE-2011-1751
Gerd Hoffmann (1):
Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
PATCH 1/1 Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
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.
--- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
hw/acpi_piix4.c +3 -1
@@ -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); } }
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
Quoted 21 lines · Gerd Hoffmann
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 <[email protected]>--- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/acpi_piix4.c +1
-0@@ -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;
hw/acpi_piix4.c static void pciej_write(void *opaque, uint32_t addr, uint32_t val) · line 483
Quoted 10 lines
hw/acpi_piix4.c +2
-1int 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()?
Re: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
Hi,
Quoted 11 lines
Quoted 11 lines
hw/acpi_piix4.c +1
-0@@ -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 ;
Quoted 10 lines
hw/acpi_piix4.c static void pciej_write(void *opaque, uint32_t addr, uint32_t val) · line 483
Quoted 8 lines
hw/acpi_piix4.c +2
-1QLIST_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 ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
Quoted 41 lines · Gerd Hoffmann
Hi,
Quoted 26 lines · Markus Armbruster
Quoted 24 lines · Gerd Hoffmann
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 <[email protected]>--- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/acpi_piix4.c +0
-0hw/acpi_piix4.c +1
-0@@ -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 ;Quoted 10 lines
hw/acpi_piix4.c static void pciej_write(void *opaque, uint32_t addr, uint32_t val) · line 483
Quoted 8 lines
hw/acpi_piix4.c +2
-1QLIST_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()?
Quoted 4 lines
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).
Re: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751)
Quoted 43 lines · Markus Armbruster
Quoted 41 lines · Gerd Hoffmann
Hi,
Quoted 36 lines · Markus Armbruster
Quoted 22 lines · Gerd Hoffmann
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 <[email protected]>--- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/acpi_piix4.c +0
-0hw/acpi_piix4.c +1
-0@@ -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;hw/acpi_piix4.c static void pciej_write(void *opaque, uint32_t addr, uint32_t val) · line 483
Quoted 10 lines
hw/acpi_piix4.c +2
-1int 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()?
Quoted 6 lines
Quoted 4 lines
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).
The root pci bus of q35 isn't hot pluggable. The pcie bus with the hotplug capability means that the slot in the bus is always hot pluggable. So pcie_cap_slot_hotplug() doesn't need to check no_hotplug.
If some sort of check is wanted, the check should be done at the device initialization, I think.
Populating a non-hotpluggable devince in hot pluggable slot doesn't make sense.
thanks,
Signature · 1 line
yamahata