[Qemu-devel] [PATCH 0/2] fix segfaults caused by accessing CPU in empty machine

Ziyue Yang posted 2 patches 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170217082704.23270-1-skiver.cloud.yzy@gmail.com
Test checkpatch passed
Test docker passed
Test s390x passed
monitor.c             | 10 +++++++---
target/i386/monitor.c |  7 +++++--
2 files changed, 12 insertions(+), 5 deletions(-)
[Qemu-devel] [PATCH 0/2] fix segfaults caused by accessing CPU in empty machine
Posted by Ziyue Yang 7 years, 2 months ago
From: Ziyue Yang <yzylivezh@hotmail.com>

Many QEMU monitor commands, like "info lapic", "info tlb" and so on
use mon_get_cpu or related wrappers to access CPU info without checking
whether the CPU exists.
This patch series fix the "info lapic" case, and is the base of the incoming
patch series aiming to eliminate segfaults caused by other QEMU commands
trying to access CPU that doesn't exist.

Ziyue Yang (2):
  monitor.c: make mon_get_cpu return NULL when there is no CPU
  target/i386/monitor.c: check return value of mon_get_cpu before using
    it

 monitor.c             | 10 +++++++---
 target/i386/monitor.c |  7 +++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

--
2.11.0


Re: [Qemu-devel] [PATCH 0/2] fix segfaults caused by accessing CPU in empty machine
Posted by Thomas Huth 7 years, 2 months ago
On 17.02.2017 09:27, Ziyue Yang wrote:
> From: Ziyue Yang <yzylivezh@hotmail.com>
> 
> Many QEMU monitor commands, like "info lapic", "info tlb" and so on
> use mon_get_cpu or related wrappers to access CPU info without checking
> whether the CPU exists.
> This patch series fix the "info lapic" case, and is the base of the incoming
> patch series aiming to eliminate segfaults caused by other QEMU commands
> trying to access CPU that doesn't exist.

 Hi,

FYI, I've posted a patch for all of these monitor commands that crash
without CPU already last month:

https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg02602.html

 Thomas


Re: [Qemu-devel] [PATCH 0/2] fix segfaults caused by accessing CPU in empty machine
Posted by Dr. David Alan Gilbert 7 years, 2 months ago
* Thomas Huth (thuth@redhat.com) wrote:
> On 17.02.2017 09:27, Ziyue Yang wrote:
> > From: Ziyue Yang <yzylivezh@hotmail.com>
> > 
> > Many QEMU monitor commands, like "info lapic", "info tlb" and so on
> > use mon_get_cpu or related wrappers to access CPU info without checking
> > whether the CPU exists.
> > This patch series fix the "info lapic" case, and is the base of the incoming
> > patch series aiming to eliminate segfaults caused by other QEMU commands
> > trying to access CPU that doesn't exist.
> 
>  Hi,
> 
> FYI, I've posted a patch for all of these monitor commands that crash
> without CPU already last month:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg02602.html

I've just sent that in my HMP pull:
https://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg04939.html

Ziyue Yang: Perhaps it's best to compare with the things in that
pull and check to see if you have any items that were not in that pull.

Dave

>  Thomas
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK