Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2034138pxb; Fri, 29 Jan 2021 11:11:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJym+5SGUiVbc5YutYXsXeCjSj3mCF5UZJXbm4lkxpE/qA2fN/0GMk1Quf/PBz/KDc/P2++5 X-Received: by 2002:a05:6402:c92:: with SMTP id cm18mr7068091edb.367.1611947509652; Fri, 29 Jan 2021 11:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611947509; cv=none; d=google.com; s=arc-20160816; b=x0O7boLXo9JJqPSgaSm9iC9cyBZ3qtdThy3OB2ybQNxB24J4LVDp3MwCIavtDFTwhw yuWABVBqx//jOZHKtX2rL4fBl0ekmG1v988eKOZfTChHZSjVrOKAEenzQaYprLIJupZU srVxAF2Q2DyR1gLhqfKnH74xxKT4v3U67LYU8OdEOexjLuH0EFdJCQs7qSYsy8fw2/62 WKIOQ3r8S0mN7h1qzLy5M21CNzsFZWzB4RZ81rFo/J60Crm6vdIPmo48BQBPiRMPyq4h NJgVcBSgD8Ua6rQibaY1GeplqA6p82VK7Ic/GHwHtSX/sQvugNQQ18jI8kSeg+NNJaQb g7IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=paQ6EXpiFTjGBgJEvX9b7eu8k/4N0OcClz0RAyg9zfc=; b=AMHREnAYmVq9gVPwRmJMKao0zTp0iLf9FUyjUvRXrWLBt8Hn0v4JyK5eVL1YJAbD6O AvWfHSF5v+hO8DOZHd7CSMlTWT+/TvoLoGwrSxNqbAJ4fr+6i4/c0Hv5UI5JAMRUexUo przm1UKL3Xq+WGGjK5P+T9/U2opSfnXFqBmnYe0nzGkYaXz8qDMmW4vni4WmFn4n1vW4 CETlYvaamPMwPySwPoGFfo+xX3+XAr9syTl+oB4FPIXisDVEKBOh3j73r1nZq2nTmO9x DkBqeqTtO2U4f0QmemBvlHQ3xkazZS1f9bcst9kyiWAldkDmGFKykO5R/Zi4Hgo/3Hpt s3Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jFysm8KK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn4si6062756ejb.197.2021.01.29.11.11.25; Fri, 29 Jan 2021 11:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jFysm8KK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbhA2THv (ORCPT + 99 others); Fri, 29 Jan 2021 14:07:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:51012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232973AbhA2TGr (ORCPT ); Fri, 29 Jan 2021 14:06:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1726664DFB; Fri, 29 Jan 2021 19:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611947166; bh=jTqi+jdOU05OqAmzEdlj9q9kyuMeRaWQDDxAGUJIAYA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jFysm8KKZ3948cZWZJ2i269CZyeMyaH4hfh3gaYawmwKT4CxjTTtoXwtyiBU7fKe3 +oxDjfs5+kTQUjG06w7Y1Fp7LUmgZVVma8wIoyOk7pZHqcVfVv2Dyr6CchmmHVheIT O45ZWNWJw5/8J/aPRmB8mpCNyRhzWRKEssaAWrJCawj4QcfC9YX7z+8/McvpepULnf oJcGC1RHKTkaQ2VDMQgwdOOkCGcjQ+bST+L3Crd2p5RIrjUYbiDGZ+egmSMHlezaEk bmsVWx4gGiuiqIRB3m2kARJx4c1Nuibhr1UZHBpY5QhFZ9QMyJmw4KcsEybKHMlvki 7gpBBn5JwuocA== Date: Fri, 29 Jan 2021 11:06:05 -0800 From: Jakub Kicinski To: Shoaib Rao Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , andy.rudoff@intel.com Subject: Re: [PATCH] af_unix: Allow Unix sockets to raise SIGURG Message-ID: <20210129110605.54df8409@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <23fc3de2-7541-04c9-a56f-4006a7dc773f@oracle.com> References: <20210122150638.210444-1-willy@infradead.org> <20210125153650.18c84b1a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <23fc3de2-7541-04c9-a56f-4006a7dc773f@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jan 2021 09:56:48 -0800 Shoaib Rao wrote: > On 1/25/21 3:36 PM, Jakub Kicinski wrote: > > On Fri, 22 Jan 2021 15:06:37 +0000 Matthew Wilcox (Oracle) wrote: > >> From: Rao Shoaib > >> > >> TCP sockets allow SIGURG to be sent to the process holding the other > >> end of the socket. Extend Unix sockets to have the same ability. > >> > >> The API is the same in that the sender uses sendmsg() with MSG_OOB to > >> raise SIGURG. Unix sockets behave in the same way as TCP sockets with > >> SO_OOBINLINE set. > > Noob question, if we only want to support the inline mode, why don't we > > require SO_OOBINLINE to have been called on @other? Wouldn't that > > provide more consistent behavior across address families? > > > > With the current implementation the receiver will also not see MSG_OOB > > set in msg->msg_flags, right? > > SO_OOBINLINE does not control the delivery of signal, It controls how > OOB Byte is delivered. It may not be obvious but this change does not > deliver any Byte, just a signal. So, as long as sendmsg flag contains > MSG_OOB, signal will be delivered just like it happens for TCP. Not as far as I can read this code. If MSG_OOB is set the data from the message used to be discarded, and EOPNOTSUPP returned. Now the data gets queued to the socket, and will be read inline. Sure, you also add firing of the signal, which is fine. The removal of the error check is the code I'm pointing at, so to speak. > >> SIGURG is ignored by default, so applications which do not know about this > >> feature will be unaffected. In addition to installing a SIGURG handler, > >> the receiving application must call F_SETOWN or F_SETOWN_EX to indicate > >> which process or thread should receive the signal. > >> > >> Signed-off-by: Rao Shoaib > >> Signed-off-by: Matthew Wilcox (Oracle) > >> --- > >> net/unix/af_unix.c | 5 +++-- > >> 1 file changed, 3 insertions(+), 2 deletions(-) > >> > >> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c > >> index 41c3303c3357..849dff688c2c 100644 > >> --- a/net/unix/af_unix.c > >> +++ b/net/unix/af_unix.c > >> @@ -1837,8 +1837,6 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, > >> return err; > >> > >> err = -EOPNOTSUPP; > >> - if (msg->msg_flags&MSG_OOB) > >> - goto out_err; > >> > >> if (msg->msg_namelen) { > >> err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; > >> @@ -1903,6 +1901,9 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, > >> sent += size; > >> } > >> > >> + if (msg->msg_flags & MSG_OOB) > >> + sk_send_sigurg(other); > >> + > >> scm_destroy(&scm); > >> > >> return sent;