Thread (2 messages) flat view 2 messages, 2 authors, 2016-02-12

Re: [PATCH net] af_unix: Guard against other == sk in unix_dgram_sendmsg

From: Ben Hutchings <hidden>
Date: 2016-02-12 19:54:39
Also in: lkml

On Fri, 2016-02-12 at 13:25 +0000, Rainer Weikusat wrote:
Philipp Hahn [off-list ref] writes:
quoted
Hello Rainer,

Am 11.02.2016 um 20:37 schrieb Rainer Weikusat:
quoted
The unix_dgram_sendmsg routine use the following test

if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
[...]
quoted
quoted
This isn't correct as the> specified address could have been bound to
the sending socket itself
[...]
quoted
After applying that patch at least my machine running the samba test no
longer crashes.
There's a possible gotcha in there: Send-to-self used to be limited by
the queue limit. But the rationale for that (IIRC) was that someone
could keep using newly created sockets to queue ever more data to a
single, unrelated receiver. I don't think this should apply when
receiving and sending sockets are identical. But that's just my
opinion. The other option would be to avoid the unix_state_double_lock
for sk == other.
Given that unix_state_double_lock() already handles sk == other, I'm
not sure why you think it needs to be avoided.
I'd be willing to change this accordingly if someone
thinks the queue limit should apply to send-to-self.
If we don't check the queue limit here, does anything else prevent the
queue growing to the point it's a DoS?

Ben.

-- 
Ben Hutchings
I say we take off; nuke the site from orbit.  It's the only way to be sure.

Attachments

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