Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3607313imd; Mon, 29 Oct 2018 09:34:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5eiPhoRzLFAjP1HsPfVBL8eyrqjW9rU+KHNIcb+3DprLHWJEJWZEc+K3uQR0h4PY2/mTXN+ X-Received: by 2002:aa7:80cd:: with SMTP id a13-v6mr15703165pfn.86.1540830873354; Mon, 29 Oct 2018 09:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540830873; cv=none; d=google.com; s=arc-20160816; b=uh/r14GZtv0K65b+bFB+Ru7i+5OeSiPA2flQMT8I/3Ex9uU87pcYvUpa+swg/b5HLH sEMRYLjfUz2RBnRGUcm9aH0vyyv8CqUOEhGLjuOMrEusg/4s4W5/WHChS1EIkS16Epmh kB8p+zrq0k84FDMnSTX33SQ1KYs4c6c2Xq0o4n84Z0LAWPGXaH93bseMBBAzb6rdMMLh MtG14NtYWGptmCLb2RqyGsu2Z342qs/i4xtIrGdasPS1ZvzM2GfBtRLg2qRVAWeWT7ji od69cyI7LvmZEwf+xmQfX5Syi8Q3kzXw+iiI7qDVmVF0NlPFYqgH3Sj2Z7A1ne+VWV+R wB5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=Q40SwvSuAbWfkqlFrjeav2I1ZGVPXYhnasRQxE+M/h4=; b=P0B75NXOwc3+kNVyc4Z225P5G6E4gPLDheeBDVGCCDxA1RD4EBckBpP0VPlmQHbos8 eFPpW/iWT/+T785CUD63AhlQBSWhcO48rw4cSfMYSBtl6VQw564UIu0nciVCaCiqRtzB R7tFpRm6siafV1xXjqfTKX0SsoioXDBoafd0CGrxukLy1LraIzvSeSaIH+XcVtzVkuux RK8+Vu06vR+aVwPwCTLVkbq9JbPo1onAloQ4tMaWSxf5sHcNFxqRiRKQAjJOym4oEE+W 5/lkACBQUYU+BOBhSkW7XP4X/NLZpKTFVn5DruisZkAb74nWAwdTj62MQ1Piiy2MK9Ei jjww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74-v6si22416432pga.231.2018.10.29.09.34.08; Mon, 29 Oct 2018 09:34:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727808AbeJ3BWz (ORCPT + 99 others); Mon, 29 Oct 2018 21:22:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:39406 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727461AbeJ3BWz (ORCPT ); Mon, 29 Oct 2018 21:22:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3EE9EB07E; Mon, 29 Oct 2018 16:33:34 +0000 (UTC) Date: Mon, 29 Oct 2018 17:33:31 +0100 From: Petr Vorel To: Arnd Bergmann Cc: mkubecek@suse.cz, David Miller , Networking , Cong Wang , rweikusat@mobileactivedefense.com, Linux Kernel Mailing List , ltp@lists.linux.it, Cyril Hrubis , junchi.chen@intel.com, Dmitry Vyukov , Greg Kroah-Hartman , Naresh Kamboju Subject: Re: RFC: changed error code when binding unix socket twice Message-ID: <20181029163331.GA31059@dell5510> Reply-To: Petr Vorel References: <20170630073448.GA9546@unicorn.suse.cz> <20180831111436.GA23780@dell5510> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, > On Fri, Aug 31, 2018 at 1:17 PM Petr Vorel wrote: > > > commit 0fb44559ffd6 ("af_unix: move unix_mknod() out of bindlock") moves > > > the special file creation in unix_bind() before u->bindlock is taken in > > > order to avoid an ABBA deadlock with do_splice(). As a side effect, it > > > also moves the check for existence of the special file (which would > > > result in -EADDRINUSE) before the check of u->addr (which would result > > > in -EINVAL if socket is already bound). This means that the error > > > returned for an attempt to bind a unix socket to the same path twice > > > changed from -EINVAL to -EADDRINUSE with this commit. > > > One way to restore the old error code is indicated below but before > > > submitting it, I would like to ask if we need/want it. > > > Pro: > > > - in general, we do not want to change return code for given testcase > > > - old error (-EINVAL) is consistent with AF_INET(6) > > > Con: > > > - both POSIX and Linux man page only list error conditions without > > > stating which should take precedence if more of them apply so > > > neither of them seems wrong, strictly speaking > > I'd be for restoring the original behavior (be conservative + looks like as not intended). > > Any comment from netdev maintainers? > Naresh noticed that LTP now has a version check to detect linux-4.10+ and > expect a different return code from previous versions, but the 0fb44559ffd6 > commit that changed the behavior got backported to stable linux-4.4 and 4.9, > so now LTP complains about those: > https://bugs.linaro.org/show_bug.cgi?id=4042 Thanks for report. > I don't care much which error code gets returned here, but I think we > should either handle this consistently in all kernel versions and check for > the one that is deemed the correct one on all versions, or change LTP > again to accept either return code. Do you mean to apply this patch to 3.16.y? (The only still maintained LTS branch which miss this fix). Although the patch don't apply and it's very old branch, it'd be easy to adjust it and it looks to me deadlock can happen there as well. I guess we need to adjust LTP test to accept either return code as EOL longterm branches probably will not take this patch. > Arnd Kind regards, Petr