Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1560333 > unrolled thread
| Started by | ebiederm@xmission.com (Eric W. Biederman) |
|---|---|
| First post | 2017-01-17 09:20 +0100 |
| Last post | 2017-01-17 09:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: fs, net: deadlock between bind/splice on af_unix ebiederm@xmission.com (Eric W. Biederman) - 2017-01-17 09:20 +0100
| From | ebiederm@xmission.com (Eric W. Biederman) |
|---|---|
| Date | 2017-01-17 09:20 +0100 |
| Subject | Re: fs, net: deadlock between bind/splice on af_unix |
| Message-ID | <t0x9M-4At-17@gated-at.bofh.it> |
Al Viro <viro@ZenIV.linux.org.uk> writes: > On Thu, Dec 08, 2016 at 10:32:00PM -0800, Cong Wang wrote: > >> > Why do we do autobind there, anyway, and why is it conditional on >> > SOCK_PASSCRED? Note that e.g. for SOCK_STREAM we can bloody well get >> > to sending stuff without autobind ever done - just use socketpair() >> > to create that sucker and we won't be going through the connect() >> > at all. >> >> In the case Dmitry reported, unix_dgram_sendmsg() calls unix_autobind(), >> not SOCK_STREAM. > > Yes, I've noticed. What I'm asking is what in there needs autobind triggered > on sendmsg and why doesn't the same need affect the SOCK_STREAM case? With respect to the conditionality on SOCK_PASSCRED those are the linux semantics. Semantically that is the way the code has behaved since 2.1.15 when support for passing credentials was added to the code. So I presume someone thought it was a good idea to have a name for a socket that is sending credentials to another socket. It certainly seems reasonable at first glance. With socketpair the only path that doesn't enforce this with SOCK_STREAM and SOCK_PASSCRED that is either an oversight or a don't care because we already know who is at the other end. I can imagine two possible fixes: 1) Declare that splice is non-sense in the presence of SOCK_PASSCRED. 2) Someone adds a preparation operation that can be called on af_unix sockets that will ensure the autobind happens before any problematic locks are taken. Eric
Back to top | Article view | linux.kernel
csiph-web