All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Stefan Weil <sw@weilnetz.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write
Date: Sun, 8 Jan 2012 12:12:43 +0200	[thread overview]
Message-ID: <20120108101242.GA26189@redhat.com> (raw)
In-Reply-To: <4F0969BB.7080208@redhat.com>

On Sun, Jan 08, 2012 at 12:02:35PM +0200, Avi Kivity wrote:
> On 01/08/2012 11:17 AM, Michael S. Tsirkin wrote:
> > 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 <gson@gson.org>
> > > >>Signed-off-by: Avi Kivity <avi@redhat.com>
> > > >
> > > >Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > > >
> > > >>---
> > > >>
> > > >>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 :-)
> 
> What's unusual?
> 
> 
> > This seems to be how memory API behaves ... right, Avi?
> > Maybe this should be documented somewhere.
> 
> Document what?

That address passed to callbacks is in fact an offset
from start of the region.

> -- 
> error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-01-08 10:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 14:28 [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write Avi Kivity
2012-01-04 14:47 ` Michael S. Tsirkin
2012-01-04 15:34   ` Alexander Graf
2012-01-05 15:14   ` Stefan Weil
2012-01-08  9:17     ` Michael S. Tsirkin
2012-01-08 10:02       ` Avi Kivity
2012-01-08 10:12         ` Michael S. Tsirkin [this message]
2012-01-08 10:48           ` Avi Kivity
2012-01-08 12:45             ` Michael S. Tsirkin
2012-01-08 12:53               ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120108101242.GA26189@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.