qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH] spapr: fix core unplug crash


From: Bharata B Rao
Subject: Re: [Qemu-ppc] [PATCH] spapr: fix core unplug crash
Date: Sun, 10 Jul 2016 20:17:20 +0530
User-agent: Mutt/1.6.1 (2016-04-27)

On Fri, Jul 08, 2016 at 05:47:01PM +0200, Greg Kurz wrote:
> On Fri, 08 Jul 2016 15:12:07 +0200
> Greg Kurz <address@hidden> wrote:
> 
> > If the host has 8 threads/core and the guest is started with:
> > 
> > -smp cores=1,threads=4,maxcpus=12
> > 
> > It is possible to crash QEMU by doing:
> > 
> > (qemu) device_add host-spapr-cpu-core,core-id=16,id=foo
> > (qemu) device_del foo
> > Segmentation fault
> > 
> > This is caused because spapr_core_unplug() assumes cpu_dt_id == core_id.
> > Even if it happens to be the case when the host and guest have the same
> > number of threads per core, it is conceptually wrong and we may pass a
> > bogus id to spapr_dr_connector_by_id() and spapr_core_release() crashes.
> > 
> > Let's use cc->core_id, which is the id that was used to create th DR
> > connector.
> 
> My bad, I got excited and pointed out the wrong culprit... it is cpu_index
> again of course ! Please find an updated explanation to be put in the
> changelog after "Segmentation fault":
> 
> ========================================================================
> This happens because spapr_core_unplug() assumes cpu_dt_id == core_id.
> As long as cpu_dt_id is derived from the non-table cpu_index, this is
> only true when you plug cores with contiguous ids.
> 
> It is safer to be consistent: the DR connector was created with an
> index that is immediately written to cc->core_id, and spapr_core_plug()
> also relies on cc->core_id.
> 
> Let's use it also in spapr_core_unplug().
> ========================================================================
> 
> > 
> > Signed-off-by: Greg Kurz <address@hidden>

Reviewed-by: Bharata B Rao <address@hidden>

This prevents the crash, but unplug still fails and that will be fixed
only by having your patchset where device tree id is derived from
core index.

Regards,
Bharata.




reply via email to

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