[CRIU] [PATCH 1/3]v3 libcriu: criu_dump_me() and library header

Pavel Emelyanov xemul at parallels.com
Thu Aug 29 16:25:20 EDT 2013


On 08/30/2013 12:15 AM, Ruslan Kuprieiev wrote:
> On 08/30/2013 12:04 AM, Pavel Emelyanov wrote:
>> On 08/29/2013 11:44 PM, Ruslan Kuprieiev wrote:
>>> On 08/29/2013 11:21 PM, Pavel Emelyanov wrote:
>>>> On 08/29/2013 11:08 PM, Ruslan Kuprieiev wrote:
>>>>> Hi!
>>>>>
>>>>> Patch 1\3 contains criu_dump_me() for library and library header.
>>>>>           -- criu_dump_me() gets an argument of  type struct criu_dump_args
>>>>> from user program,
>>>>>             processes it and sends request to criu through unix domain
>>>>> socket.
>>>>>             Then, it gets flag from criu and returns it back to program.
>>>>>           -- libcriu.h contains definitions of flags, struct
>>>>> criu_dump_args etc.
>>>>>              So, it is to be used in user program.
>>>>>
>>>>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>>>>>
>>>>> +int criu_dump_me(struct criu_dump_args *arg)
>>>>> +{
>>>>> +	int socket_fd;
>>>>> +	int ret, c;
>>>>> +	struct sockaddr_un server_addr;
>>>>> +	socklen_t server_addr_len;
>>>> I'm trying to imagine how this all should work when a user that has some
>>>> 3rd party app linked with v0.7's libcriu.so upgrades criu and has v0.8's
>>>> one with criu_dump_args extended.
>>>>
>>>> In his software the new "tail" of this structure is not seen (as hi had it
>>>> compiled against old headers with shorted struct). Thus we'd see uninitialized
>>>> data here in the library and have no idea how to check this.
>>>>
>>>> I think we need the criu_alloc_args() call that will call malloc() with
>>>> proper size and zeroify the whole structure.
> Maybe, criu_alloc_args() should malloc "struct criu_dump_args *args" and 
> return "args" , witch will be like "opts" in crtools?

They cannot be equal, since there's a couple of things, that are missing
from opts, but are required on args. But yes -- they mostly overlap.

>>> Ok, i will fix it.
>>> By the way, maybe i should add version check? (maybe, after i fix what i
>>> should fix, and first patch will be applied)
>>> Correct me, if i'm mistaken.
>>> I should add criu_check_version(), that must be called right after
>>> connect to socket.
>>> It should send version of library and recv "true" if
>>> libversion<=criuversion or "false" if libversion>criuversion.
>>> Also add some CRIU_OLD_VERSION macro to return for "false" case.
>>>
>>> .
>>>
>>
>> yup
> 
> .
> 




More information about the CRIU mailing list