Re: [PATCH] qemu: Avoid crashes in qemuDomainMachineIs*()

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

 



On Tue, Oct 10, 2017 at 04:21:02PM +0200, Andrea Bolognani wrote:
> Make sure pointers are non-NULL before dereferencing them, and
> add test suite coverage for the crashers doing so fixes.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1379218

Hmm, I don't think that is a good fix for the problem seen there.

We're parsing the CLI argv from an existing QEMU process and
when looking at the disk we're checking if the machine type
refers to a pseries guest.

The problem is that either the user might not have given any
-machine arg, or the -drive arg might occur *before* the
-machine arg is parsed.

Simply making the qemuDomainMachineIs* safe against NULL will
avoid the crash, but the ARGV parsing is still going to be
semantically broken.

As a more general point, we've tended to assume that machine
is always non-NULL throughout the code, because we rely on
the XML parsing to fill in defaults if omitted by the user.

I think rather than trying to fix up the assumption about
machine being non-NULL, we should restructure the ARGV
parsing into we need a 2 pass process.

In the first pass only look for the -machine arg. If no
-machine arg is given, we should fill in the default machine
for that emulator.

In the second pass process the rest of the ARGV, whereupon
we have a valid assumption that machine is non-NULL.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux