Thread (1 message) 1 message, 1 author, 2015-11-17

Re: [PATCH] unix: avoid use-after-free in ep_remove_wait_queue (w/ Fixes:)

From: Rainer Weikusat <hidden>
Date: 2015-11-17 21:38:23
Also in: linux-fsdevel, lkml

David Miller [off-list ref] writes:
From: Rainer Weikusat <redacted>
Date: Mon, 16 Nov 2015 22:28:40 +0000
quoted
An AF_UNIX datagram socket being the client in an n:1 association with
some server socket is only allowed to send messages to the server if the
receive queue of this socket contains at most sk_max_ack_backlog
datagrams.
[...]
quoted
Signed-off-by: Rainer Weikusat <redacted>
Fixes: ec0d215f9420 ("af_unix: fix 'poll for write'/connected DGRAM sockets")
So because of a corner case of epoll handling and sender socket release,
every single datagram sendmsg has to do a double lock now?

I do not dispute the correctness of your fix at this point, but that
added cost in the fast path is really too high.
This leaves only the option of a somewhat incorrect solution and what is
or isn't acceptable in this respect is somewhat difficult to decide. The
basic options would be

	- return EAGAIN even if sending became possible (Jason's most
          recent suggestions)

	- retry sending a limited number of times, eg, once, before
          returning EAGAIN, on the grounds that this is nicer to the
          application and that redoing all the stuff up to the _lock in
          dgram_sendmsg can possibly/ likely be avoided

Which one do you prefer?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help