qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qtest protocol: should memset/read/write etc of a size


From: John Snow
Subject: Re: [Qemu-devel] qtest protocol: should memset/read/write etc of a size of 0 bytes be permitted?
Date: Thu, 4 Aug 2016 14:49:18 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0



On 08/04/2016 02:46 PM, Peter Maydell wrote:
I've upgraded to a more recent version of clang, which now produces
undefined-behaviour warnings for passing NULL pointers to some library
functions. One of the things it has shown up is that some of the
qtest tests ask for "memset" with size zero. In our current implementation
this results in qtest.c calling g_malloc(0), which returns NULL, and
then calling memset(NULL, chr, 0), which is UB.

So should we:
(1) declare the qtest protocol commands 'memset', 'read', 'write'
etc which operate on a lump of guest memory of specified size to
support size == 0 as meaning "do nothing"

This would be easy to do.

(2) declare that size == 0 is not valid and make it return a failure
code back down the qtest pipe (and fix the offending tests)


This is probably the nicer thing to do -- if memset of length 0 is undefined, probably qmemset and friends should also be undefined by extension.

I reserve the right to change my mind depending on how gnarly it is to untangle.

I assume you're hoping for 2.7.

?

The offending tests are i386/ahci/flush/simple and i386/ahci/max
(because ahci_io() calls qmemset() with a zero size.)

thanks
-- PMM


--js



reply via email to

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