All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write
Date: Thu, 05 Jan 2012 16:14:29 +0100	[thread overview]
Message-ID: <4F05BE55.8030209@weilnetz.de> (raw)
In-Reply-To: <20120104144721.GA5961@redhat.com>

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?

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

Regards,
Stefan

  parent reply	other threads:[~2012-01-07 12:51 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 [this message]
2012-01-08  9:17     ` Michael S. Tsirkin
2012-01-08 10:02       ` Avi Kivity
2012-01-08 10:12         ` Michael S. Tsirkin
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=4F05BE55.8030209@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=avi@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.