[CRIU] [PATCH] unix: Do not autobind unnamed unix sockets
Pavel Emelyanov
xemul at virtuozzo.com
Thu Jun 16 08:30:00 PDT 2016
On 06/16/2016 05:55 PM, Kirill Tkhai wrote:
>
>
> On 16.06.2016 17:10, Pavel Emelyanov wrote:
>> On 06/15/2016 01:57 PM, Kirill Tkhai wrote:
>>> addlen equal to sizeof(addr.sun_family) leads
>>> to autobinding of socket.
>>>
>>> If it had been autobinded when we dumped it,
>>> name.len wouldn't have been zero. So, this
>>> binding is wrong. Fix that.
>>>
>>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>>> ---
>>> criu/sk-unix.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/criu/sk-unix.c b/criu/sk-unix.c
>>> index c6cf672..9302d21 100644
>>> --- a/criu/sk-unix.c
>>> +++ b/criu/sk-unix.c
>>> @@ -958,7 +958,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui)
>>> if (prep_unix_sk_cwd(ui, &cwd_fd))
>>> return -1;
>>>
>>> - if (bind(sk, (struct sockaddr *)&addr,
>>> + if (ui->ue->name.len && bind(sk, (struct sockaddr *)&addr,
>>
>> Few lines below there's another check for ui->ue->name.len. Would you
>> merge them please?
>
> The whole below condition is about non-abstract bound sockets (*ui->name).
> The whole mine if() is just about sockets non-zero len.
>
> If we merge them into single "if (ui->ue->name.len)" we'll have to do
> subsequent if's. Also, below bracket paragraph already have subsequent if().
> I don't think it's a good idea. If you mean something else, explain, please.
No, I mean exactly this.
>>> sizeof(addr.sun_family) + ui->ue->name.len)) {
>>> pr_perror("Can't bind socket");
>>> goto done;
>>>
>>> _______________________________________________
>>> CRIU mailing list
>>> CRIU at openvz.org
>>> https://lists.openvz.org/mailman/listinfo/criu
>>> .
>>>
>>
> .
>
More information about the CRIU
mailing list