[CRIU] [PATCH] unix: allow --external unix[ino]:stub[string]

Ruslan Kuprieiev kupruser at gmail.com
Thu Mar 2 07:37:42 PST 2017



On 03/02/2017 05:25 PM, Pavel Emelyanov wrote:
> On 02/28/2017 04:47 PM, Ruslan Kuprieiev wrote:
>> Needles to say it's useful for debug, but it is also
>> very useful when you syncronise checkpoint/restore
>> whith a dumpee using unix socketpair and want it to
>> painlessly receive notification on restore.
>>
>> I.e. on dump, if --external unix[ino]:foo is specified,
>> criu will treat specified unix socket almost the same
>> way it handles criu service socket. It will dump it as
>> closed and will put "foo" string into images, to put
>> that "foo" string into that socket on restore. This is
>> almost identical to what criu does with service socket,
>> but instead of putting a Criu_Resp message into it on
>> restore, it puts an arbitrary string.
> OK, with the explanation why this option is good for dump,
> I have one question left on the patch itself, inline :)
>
>> @@ -1165,8 +1179,15 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd)
>>   			return -1;
>>   		}
>>   
>> -		if (send_criu_dump_resp(sks[1], true, true) == -1)
>> -			return -1;
>> +		if (ui->ue->stub) {
>> +			pr_warn("Writing stub %s to unix socket %#x\n",
>> +				(char *)ui->ue->stub, ui->ue->ino);
>> +			if (write(sks[1], ui->ue->stub, strlen(ui->ue->stub)) != strlen(ui->ue->stub))
>> +				return -1;
>> +		} else {
>> +			if (send_criu_dump_resp(sks[1], true, true) == -1)
>> +				return -1;
>> +		}
> This is the only place that you send the stub value at, but it's
> not external socket handling, it's the RPC socket that client uses
> to connect to CRIU and via which it receives the "restored" message.
>
> So your goal is actually not to allow for random stuff to be sent via
> external unix sockets, but rather to make criu send something
> meaningful via the RPC socket for self-dump case. Is it?

Actually no, it just shares a lot of logic with service socket, so I 
thought it
would be suitable to mark it as one. But I see what you mean, yeah, it 
really
should be handled in "external sockets" code, not "criu service socket".
I'll fix it and will send a new version shortly. Thanks!

>
>>   
>>   		close(sks[1]);
>>   		sk = sks[0];
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu



More information about the CRIU mailing list