From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932434AbcLIGlt (ORCPT ); Fri, 9 Dec 2016 01:41:49 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38612 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752376AbcLIGlr (ORCPT ); Fri, 9 Dec 2016 01:41:47 -0500 Date: Fri, 9 Dec 2016 06:41:44 +0000 From: Al Viro To: Cong Wang Cc: Dmitry Vyukov , "linux-fsdevel@vger.kernel.org" , LKML , David Miller , Rainer Weikusat , Hannes Frederic Sowa , netdev , Eric Dumazet , syzkaller Subject: Re: fs, net: deadlock between bind/splice on af_unix Message-ID: <20161209064144.GZ1555@ZenIV.linux.org.uk> References: <20161209013208.GW1555@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > I guess some lock, perhaps the u->bindlock could be dropped before > acquiring the next one (sb_writer), but I need to double check. Bad idea, IMO - do you *want* autobind being able to come through while bind(2) is busy with mknod?