Netdev List
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Eric Dumazet <edumazet@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls
Date: Fri, 6 Nov 2026 16:47:53 -0700	[thread overview]
Message-ID: <236f4ed4-7ee4-47fd-9f3e-f6920035b2e6@kernel.dk> (raw)
In-Reply-To: <CAL4Wiips_uVD45bC2DpG5BqywmueUBB_wiNCnd64hNUe8YsH2w@mail.gmail.com>

On 11/6/26 4:36 PM, Eric Dumazet wrote:
> Le sam. 7 nov. 2026 ? 00:19, Jens Axboe <axboe@kernel.dk> a ?crit :
>>
>> ____sys_sendmsg() and ____sys_recvmsg() turn O_NONBLOCK on the socket
>> into MSG_DONTWAIT. That is right for the system calls, but io_uring uses
>> __sys_sendmsg_sock() and __sys_recvmsg_sock() for a blocking attempt
>> from io-wq as well, after the non-blocking attempts with MSG_DONTWAIT
>> have failed. On an O_NONBLOCK socket that attempt can't block either and
>> the request completes with -EAGAIN, unlike IORING_OP_SEND and RECV,
>> which call sock_sendmsg() and sock_recvmsg() directly and don't look at
>> O_NONBLOCK at all.
> 
> Makes sense. The socket.c side looks fine to me: all syscall paths
> (sendmsg, sendmmsg, recvmsg, recvmmsg, compat) go through ___sys_sendmsg()
> or ___sys_recvmsg(), and the copy_msghdr helpers only care about
> MSG_CMSG_COMPAT, so setting MSG_DONTWAIT earlier is harmless.

Thanks for checking!

> Fixes: tags? And please tag the subject [PATCH net] if this is
> meant as a fix.
> 
> Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
> Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")

Good point, I'll add the fixes tags and the subject.

>> Move the O_NONBLOCK handling to ___sys_sendmsg() and ___sys_recvmsg(),
>> which the sendmsg, sendmmsg, recvmsg and recvmmsg system calls go
>> through. The io_uring helpers then pass the flags the caller asked for.
>>
>> Reported-by: Luk?? Lalinsk? <lukas@lalinsky.com>
> 
> The name lost its accents (Luk?? Lalinsk?). A Closes: or Link: to the
> report would be nice too.

Man, not a lot went right in this posting... But yes, it lost it. I'll
add a link too.

>> diff --git a/net/socket.c b/net/socket.c
>> index 2e3b5737c481..08658a9b8065 100644
>> --- a/net/socket.c
>> +++ b/n
> 
> This header got truncated, so the patch does not apply as posted.

I'll send a v2 :)

-- 
Jens Axboe

      reply	other threads:[~2026-11-06 23:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 23:19 [PATCH] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Jens Axboe
2026-11-06 23:36 ` Eric Dumazet
2026-11-06 23:47   ` Jens Axboe [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=236f4ed4-7ee4-47fd-9f3e-f6920035b2e6@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /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