[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d1v85mtx.fsf@doppelsaurus.mobileactivedefense.com>
Date: Tue, 17 Nov 2015 21:37:46 +0000
From: Rainer Weikusat <rweikusat@...ileactivedefense.com>
To: David Miller <davem@...emloft.net>
Cc: rweikusat@...ileactivedefense.com, jbaron@...mai.com,
dvyukov@...gle.com, syzkaller@...glegroups.com, mkubecek@...e.cz,
viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, hannes@...essinduktion.org,
dhowells@...hat.com, paul@...l-moore.com, salyzyn@...roid.com,
sds@...ho.nsa.gov, ying.xue@...driver.com, netdev@...r.kernel.org,
kcc@...gle.com, glider@...gle.com, andreyknvl@...gle.com,
sasha.levin@...cle.com, jln@...gle.com, keescook@...gle.com,
minipli@...glemail.com
Subject: Re: [PATCH] unix: avoid use-after-free in ep_remove_wait_queue (w/ Fixes:)
David Miller <davem@...emloft.net> writes:
> From: Rainer Weikusat <rweikusat@...ileactivedefense.com>
> Date: Mon, 16 Nov 2015 22:28:40 +0000
>
>> 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.
[...]
>> Signed-off-by: Rainer Weikusat <rweikusat@...ileactivedefense.com>
>> 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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists