Re: fs, net: deadlock between bind/splice on af_unix
From: Cong Wang
Date: Thu Feb 09 2017 - 20:38:29 EST
On Tue, Feb 7, 2017 at 6:20 AM, Mateusz Guzik <mguzik@xxxxxxxxxx> wrote:
>
> Yes, but unix_release_sock is expected to leave the file behind.
> Note I'm not claiming there is a leak, but that racing threads will be
> able to trigger a condition where you create a file and fail to bind it.
>
Which is expected, right? No one guarantees the success of file
creation is the success of bind, the previous code does but it is not
part of API AFAIK. Should a sane user-space application check
the file creation for a successful bind() or just check its return value?
> What to do with the file now?
>
We just do what unix_release_sock() does, so why do you keep
asking the same question?
If you still complain about the race with user-space, think about the
same race in-between a successful bind() and close(), nothing is new.