qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] Use after free problem somewhere in ahci.c or ich.c code
Date: Tue, 22 Aug 2017 18:25:04 -0400	[thread overview]
Message-ID: <355a2c68-e46b-97f7-12d0-1e72c8f09c13@redhat.com> (raw)
In-Reply-To: <5a85f2a6-feb7-dd11-53f2-91df6262a827@amsat.org>



On 08/22/2017 05:02 PM, Philippe Mathieu-Daudé wrote:
> On 08/22/2017 03:39 PM, John Snow wrote:
>> On 08/22/2017 02:15 PM, Thomas Huth wrote:
>>>
>>> Looks like there is a use-after-free problem somewhere in
>>> the ahci.c or ich.c code when trying to add the ich9-ahci
>>> on a old PC machine. Using valgrind, I get:
>>>
> 
> those old PC don't support AHCI hotplug, so realize() fails then
> unparent() is called.
> 
>> I'll look; it looks like it works okay for pc-i440fx-2.9 as well as 2.0
>> and 1.7.
>>
>> 1.6 appears to be the most modern board that has issues, as well as 1.4
>> and the pc-1.2 board you specify.
> 
> commit 9e047b982452 "piix4: add acpi pci hotplug support"
> 
> "Add support for acpi pci hotplug using the new infrastructure.
> PIIX4 legacy interface is maintained as is for machine types 1.7 and
> older."
> 
> I see piix4_pm_init() disabling use_acpi_pci_hotplug if xen_enabled(),
> later when piix4_device_plug_cb() is called for TYPE_PCI_DEVICE it
> checks xen_enabled() instead of checking use_acpi_pci_hotplug.
> Same happens in piix4_device_unplug_request_cb(), not sure it can be
> reached although.
> 
> My guess is changing !xen_enabled() -> s->use_acpi_pci_hotplug fixes
> this issue, but I'm not sure this is the safest way to fix it.
> 
> I'll send a patch.
> 
> Regards,
> 
> Phil.

Beat me to it! I'll review, thanks.

      reply	other threads:[~2017-08-22 22:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 18:15 [Qemu-devel] Use after free problem somewhere in ahci.c or ich.c code Thomas Huth
2017-08-22 18:39 ` John Snow
2017-08-22 21:02   ` Philippe Mathieu-Daudé
2017-08-22 22:25     ` John Snow [this message]

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=355a2c68-e46b-97f7-12d0-1e72c8f09c13@redhat.com \
    --to=jsnow@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).