From: Igor Mammedov <imammedo@redhat.com>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, sathnaga@linux.vnet.ibm.com,
dgilbert@redhat.com, armbru@redhat.com,
Greg Kurz <groug@kaod.org>
Subject: Re: [Qemu-devel] [FIX PATCH] monitor: Don't return CPU marked for unplug as monitor CPU
Date: Mon, 16 Oct 2017 11:09:46 +0200 [thread overview]
Message-ID: <20171016110946.58d847ca@nial.brq.redhat.com> (raw)
In-Reply-To: <1508137406-5222-1-git-send-email-bharata@linux.vnet.ibm.com>
On Mon, 16 Oct 2017 12:33:26 +0530
Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> The following sequence of steps kill the QEMU:
>
> - Hotplug a CPU
> - Change the default CPU to the newly hotplugged cpu using "cpu" HMP command.
> - Hot unplug the CPU
> - Run "info cpus"
>
> Fix this by not letting monitor_get_cpu() to return a CPU which is marked
> for unplug.
>
> Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
> monitor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/monitor.c b/monitor.c
> index fe0d1bd..8d60e57 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1053,7 +1053,7 @@ int monitor_set_cpu(int cpu_index)
>
> CPUState *mon_get_cpu(void)
> {
> - if (!cur_mon->mon_cpu) {
> + if (!cur_mon->mon_cpu || cur_mon->mon_cpu->unplug) {
mon_cpu could be freed so it would cause use after free,
Greg was looking into the same issue see his patch:
"PATCH] monitor: fix dangling CPU pointer"
> if (!first_cpu) {
> return NULL;
> }
prev parent reply other threads:[~2017-10-16 9:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 7:03 [Qemu-devel] [FIX PATCH] monitor: Don't return CPU marked for unplug as monitor CPU Bharata B Rao
2017-10-16 9:09 ` Igor Mammedov [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=20171016110946.58d847ca@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=bharata@linux.vnet.ibm.com \
--cc=dgilbert@redhat.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=sathnaga@linux.vnet.ibm.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).