[libvirt] [PATCH] vbox: avoid provoking assertions in VBoxSVC

Matthias Bolte matthias.bolte at googlemail.com
Sun Apr 22 08:46:27 UTC 2012


Am 20. April 2012 08:48 schrieb Matthias Bolte <matthias.bolte at googlemail.com>:
> Am 20. April 2012 01:07 schrieb Eric Blake <eblake at redhat.com>:
>> On 04/17/2012 10:50 AM, Eric Blake wrote:
>>> On 04/13/2012 07:04 AM, Jean-Baptiste Rouault wrote:
>>>> Passing a NULL pointer to IMachine::delete virtualbox API
>>>> causes VBoxSVC to raise an assertion. This patch passes
>>>> an empty array instead.
>>>> ---
>>>>  src/vbox/vbox_tmpl.c |    3 ++-
>>>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
>>>> index 68e3b05..be25828 100644
>>>> --- a/src/vbox/vbox_tmpl.c
>>>> +++ b/src/vbox/vbox_tmpl.c
>>>> @@ -5294,7 +5294,8 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
>>>>
>>>>          ((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress);
>>>>  # else
>>>> -        machine->vtbl->Delete(machine, 0, NULL, &progress);
>>>> +        vboxArray array = VBOX_ARRAY_INITIALIZER;
>>>> +        machine->vtbl->Delete(machine, 0, (IMedium**)&array, &progress);
>>>>  # endif
>>>
>>> ACK and Pushed.
>
> Actually, this is not how vboxArray is supposed to be used. vboxArray
> is a wrapper with specific implementations for MSCOM and XPCOM. You
> cannot just cast it to a VirtualBox API type.
>
>> Phooey.  Now I'm getting compile failure:
>>
>> cc1: warnings being treated as errors
>> In file included from vbox/vbox_V4_0.c:13:
>> vbox/vbox_tmpl.c: In function 'vboxDomainUndefineFlags':
>> vbox/vbox_tmpl.c:5298: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>
> I think we need a new vboxArrayPass/Set function to get this right. I
> might have time to take care of this tomorrow, if nobody fixed it
> before then.

No, it much simpler than that, see

https://www.redhat.com/archives/libvir-list/2012-April/msg01211.html

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list