qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 3/4] migration/vmstate: fix array of pointer


From: Halil Pasic
Subject: Re: [Qemu-devel] [RFC PATCH 3/4] migration/vmstate: fix array of pointers to struct
Date: Tue, 25 Oct 2016 15:33:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 10/25/2016 12:13 PM, Dr. David Alan Gilbert wrote:
> * Halil Pasic (address@hidden) wrote:
>> > Make VMS_ARRAY_OF_POINTER cope with null pointers. Previously the reward
>> > for trying to migrate an array with some null pointers in it was an
>> > illegal memory access, that is a swift and painless death of the
>> > process. Let's make vmstate cope with this scenario at least for
>> > pointers to structs. The general approach is when we encounter a null
>> > pointer (element) instead of following the pointer to save/load the data
>> > behind it we save/load a placeholder. This way we can detect if we
>> > expected a null pointer at the load side but not null data was saved
>> > instead. Sadly all other error scenarios are not detected by this scheme
>> > (and would require the usage of the JSON meta data).
>> > 
>> > Limitations: Does not work for pointers to primitives.
> Hmm is this needed - I mean could you do this just by giving the vmsd
> that defines the children of the array a '.needed' that tests if their
> pointer is NULL?
> 
> 

I do not think so: .needed is basically for subsections (also used
in migration/savevm.c via the exported vmstate_save_needed function),
and .field_exists is also no use for this (AFAIU). Have also tried
just to be sure, it did not work for me. 

If I did not convince you, a bit of a code proving me wrong would be
highly appreciated.

Thanks for the comment!

Halil




reply via email to

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