[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOJe8K1FPGr-2OgqaWOEz4ZHUONJ-p2yW6Uw-dVjXVurGmDwxA@mail.gmail.com>
Date: Thu, 3 Dec 2020 11:18:21 +0300
From: Denis Kirjanov <kda@...ux-powerpc.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
Michal Kubecek <mkubecek@...e.cz>
Subject: Re: [PATCH v3] net/af_unix: don't create a path for a binded socket
On 12/1/20, Jakub Kicinski <kuba@...nel.org> wrote:
> On Tue, 1 Dec 2020 12:33:06 +0300 Denis Kirjanov wrote:
>> in the case of the socket which is bound to an adress
>> there is no sense to create a path in the next attempts
>>
>> here is a program that shows the issue:
>>
>> int main()
>> {
>> int s;
>> struct sockaddr_un a;
>>
>> s = socket(AF_UNIX, SOCK_STREAM, 0);
>> if (s<0)
>> perror("socket() failed\n");
>>
>> printf("First bind()\n");
>>
>> memset(&a, 0, sizeof(a));
>> a.sun_family = AF_UNIX;
>> strncpy(a.sun_path, "/tmp/.first_bind", sizeof(a.sun_path));
>>
>> if ((bind(s, (const struct sockaddr*) &a, sizeof(a))) == -1)
>> perror("bind() failed\n");
>>
>> printf("Second bind()\n");
>>
>> memset(&a, 0, sizeof(a));
>> a.sun_family = AF_UNIX;
>> strncpy(a.sun_path, "/tmp/.first_bind_failed", sizeof(a.sun_path));
>>
>> if ((bind(s, (const struct sockaddr*) &a, sizeof(a))) == -1)
>> perror("bind() failed\n");
>> }
>>
>> kda@...S15-SP2:~> ./test
>> First bind()
>> Second bind()
>> bind() failed
>> : Invalid argument
>>
>> kda@...S15-SP2:~> ls -la /tmp/.first_bind
>> .first_bind .first_bind_failed
>>
>> Signed-off-by: Denis Kirjanov <kda@...ux-powerpc.org>
>
> Is the deadlock fixed by the patch Michal pointed out no longer present?
The thing that I'm not satisfied is that we're holding bindlock during
unix_mknod().
I'll send a next version
>
Powered by blists - more mailing lists