linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shoaib Rao <rao.shoaib@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	andy.rudoff@intel.com
Subject: Re: [PATCH] af_unix: Allow Unix sockets to raise SIGURG
Date: Fri, 29 Jan 2021 12:01:54 -0800	[thread overview]
Message-ID: <00a01000-92ea-f5d9-3275-c4cc730f9f24@oracle.com> (raw)
In-Reply-To: <6cef3799-088c-b017-94cb-18971ac74727@oracle.com>


On 1/29/21 11:54 AM, Shoaib Rao wrote:
>
> On 1/29/21 11:19 AM, Matthew Wilcox wrote:
>> On Fri, Jan 29, 2021 at 09:56:48AM -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 <rao.shoaib@oracle.com>
>>>>>
>>>>> 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.
>> I don't think that's the question Jakub is asking.  As I understand it,
>> if you send a MSG_OOB on a TCP socket and the receiver calls recvmsg(),
>> it will see MSG_OOB set, even if SO_OOBINLINE is set.
> No it wont. Application just gets a signal.
>>    That wouldn't
>> happen with Unix sockets.  I'm OK with that difference in behaviour,
>> because MSG_OOB on Unix sockets _is not_ for sending out of band data.
>> It's just for sending an urgent signal.
> That is what I just explained in my email
>>
>> As you say, MSG_OOB does not require data to be sent for unix sockets
>> (unlike TCP which always requires at least one byte), but one can
>> choose to send data as part of a message which has MSG_OOB set. It
>> won't be tagged in any special way.
>>
>> To Jakub's other question, we could require SO_OOBINLINE to be set.
>> That'd provide another layer of insurance against applications being
>> surprised by a SIGURG they weren't expecting.  I don't know that it's
>> really worth it though.
>
> SO_OOBINLINE has a meaning, that the urgent byte is part of the stream 
> and using SO_OOBLINE to allow signalling would be wrong/confusing. We 
> could add a socket option on the receiver to indicate if it supports 
> or wants the signal.
>
>>
>> One thing I wasn't clear about, and maybe you know, if we send a 
>> MSG_OOB,
>> does this patch cause this part of the tcp(7) manpage to be true for
>> unix sockets too?
>>
>>         When out-of-band data is present, select(2) indicates the 
>> file descrip‐
>>         tor as having an exceptional condition and poll (2) indicates 
>> a POLLPRI
>>         event.
>
> No because there is no data involved. Poll is associated with data not 
> signals.
>
> Shoaib

SO_OOBINLINE implies there is urgent data inline -- This patch will send 
a signal even if there is no data.

Shoaib

>
>>

      reply	other threads:[~2021-01-29 20:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 15:06 [PATCH] af_unix: Allow Unix sockets to raise SIGURG Matthew Wilcox (Oracle)
2021-01-25 23:36 ` Jakub Kicinski
2021-01-29 17:56   ` Shoaib Rao
2021-01-29 19:06     ` Jakub Kicinski
2021-01-29 19:48       ` Shoaib Rao
2021-01-29 20:02         ` Jakub Kicinski
2021-01-29 20:10           ` Shoaib Rao
2021-01-29 20:18             ` Jakub Kicinski
2021-01-29 20:44               ` Shoaib Rao
2021-01-29 20:49                 ` Shoaib Rao
2021-01-29 21:18                 ` Jakub Kicinski
2021-01-29 21:32                   ` Matthew Wilcox
2021-01-29 23:47                     ` David Laight
2021-01-29 21:54                   ` Shoaib Rao
2021-01-29 19:19     ` Matthew Wilcox
2021-01-29 19:54       ` Shoaib Rao
2021-01-29 20:01         ` Shoaib Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00a01000-92ea-f5d9-3275-c4cc730f9f24@oracle.com \
    --to=rao.shoaib@oracle.com \
    --cc=andy.rudoff@intel.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).