qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf i


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write
Date: Sun, 8 Jan 2012 11:17:08 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 05, 2012 at 04:14:29PM +0100, Stefan Weil wrote:
> Am 04.01.2012 15:47, schrieb Michael S. Tsirkin:
> >On Wed, Jan 04, 2012 at 04:28:42PM +0200, Avi Kivity wrote:
> >>Commit d0ed8076cbdc261 converted the PCI config access to the memory
> >>API, but also inadvertantly changed it to accept unaligned writes,
> >>and corrupt the index register in the process. This causes a regression
> >>booting NetBSD.
> >>
> >>Fix by ignoring unaligned or non-dword writes.
> >>
> >>https://bugs.launchpad.net/qemu/+bug/897771
> >>
> >>Reported-by: Andreas Gustafsson <address@hidden>
> >>Signed-off-by: Avi Kivity <address@hidden>
> >
> >Acked-by: Michael S. Tsirkin <address@hidden>
> >
> >>---
> >>
> >>hw/pci_host.c | 3 +++
> >>1 files changed, 3 insertions(+), 0 deletions(-)
> >>
> >>diff --git a/hw/pci_host.c b/hw/pci_host.c
> >>index 44c6c20..8041778 100644
> >>--- a/hw/pci_host.c
> >>+++ b/hw/pci_host.c
> >>@@ -101,6 +101,9 @@ static void pci_host_config_write(void
> >>*opaque, target_phys_addr_t addr,
> >>
> >>PCI_DPRINTF("%s addr " TARGET_FMT_plx " len %d val %"PRIx64"\n",
> >>__func__, addr, len, val);
> >>+ if (addr != 0 || len != 4) {
> >>+ return;
> >>+ }
> >>s->config_reg = val;
> >>}
> >>
> >>-- 
> >>1.7.7.1
> 
> Non dword writes are quite common. I get them with Linux kernels, too.
> Do you really want to ignore them?

Are you sure?
Note this is an io write at cf8. Not an unaligned config write.

> And the check for unaligned writes is, well, unusual :-)

This seems to be how memory API behaves ... right, Avi?
Maybe this should be documented somewhere.

> Regards,
> Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]