Re: [PATCH] af_unix: Allow Unix sockets to raise SIGURG

From: Shoaib Rao
Date: Fri Jan 29 2021 - 15:13:33 EST



On 1/29/21 12:02 PM, Jakub Kicinski wrote:
On Fri, 29 Jan 2021 11:48:15 -0800 Shoaib Rao wrote:
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.
Data was discarded because the flag was not supported, this patch
changes that but does not support any urgent data.
When you say it does not support any urgent data do you mean the
message len must be == 0 because something is checking it, or that
the code does not support its handling?

I'm perfectly fine with the former, just point me at the check, please.

The code does not care about the size of data -- All it does is that if MSG_OOB is set it will deliver the signal to the peer process irrespective of the length of the data (which can be zero length). Let's look at the code of unix_stream_sendmsg() It does the following (sent is initialized to zero)

while (sent < len) {
                size = len - sent;
<..>

}

        if (msg->msg_flags & MSG_OOB)
                sk_send_sigurg(other);

Before the patch there was a check above the while loop that checked the flag and returned and error, that has been removed.

Shoaib


OOB data has some semantics that would have to be followed and if we
support SO_OOBINLINE we would have to support NOT SO_OOBINLINE.

One can argue that we add a socket option to allow this OR just do what
TCP does.