[libvirt] [PATCH 2/2] qemu: domain: Prevent overflows in memory alignment code
Guido Günther
agx at sigxcpu.org
Tue Jan 5 23:05:14 UTC 2016
Hi,
On Mon, Jan 04, 2016 at 09:39:20AM +0100, Peter Krempa wrote:
> On Sun, Jan 03, 2016 at 18:26:56 +0100, Guido Günther wrote:
> > Hi,
> > On Tue, Dec 01, 2015 at 03:11:05PM +0100, Peter Krempa wrote:
> > > Since libvirt for dubious historical reasons stores memory size as
> > > kibibytes, it's possible that the alignments done in the qemu code
> > > overflow the the maximum representable size in bytes. The XML parser
> > > code handles them in bytes in some stages. Prevent this by doing
> > > overflow checks when alinging the size and add a test case.
> >
> > It seems this broke the build on i386:
> >
> > https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=i386&ver=1.3.0-1&stamp=1450436203
> > (search for memory-align-fail)
> >
> > I did not investigate further yet though.
>
> This should be already fixed ...
>
> commit ace1ee225f5cd87fb095054a6a19bdcd0fa57518
> Author: Peter Krempa <pkrempa at redhat.com>
> Date: Thu Dec 10 14:36:51 2015 +0100
>
> test: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference
>
> Always return LLONG_MAX even on 32 bit systems. The limitation
> originates from our use of "unsigned long" in several APIs. The internal
> data type is unsigned long long. Make the test suite deterministic by
> removing the architecture difference.
>
> Flaw was introduced in 645881139b3d2c86acf9d644c3a1471520bc9e57 where
> I've added a test that uses too large numbers.
That fixes it, thanks for pointing this out!
Cheers,
-- Guido
More information about the libvir-list
mailing list