Closed majek closed 3 weeks ago
That is definitely a bug. I took a look at it, and came up with:
https://git.kernel.dk/cgit/linux/commit/?h=io_uring-6.4&id=f7e2fa2b65127e162f6509bb73debf44e6ccc10b
Can you try and pull that patch (or branch) into your 6.4-rc kernel?
Also, in terms of attribution, I like to add a Reported-by tag to the commit so it gives credit to the person that found it. For that, I'd need your real name and email. Let me know if you want that added and provide those details. Totally up to you, I've linked this issue as well.
Reported-by: Marek Majkowski <marek@cloudflare.com>
Tested-by: Marek Majkowski <marek@cloudflare.com>
I've run the patch and I can see no -EFAULT anymore. I'll attempt to get a deeper understanding if it works soon. However, one thing that is immediately visible, is that in past, before the patch the ss -au
showed sending socket (transmitting) with varying Snd buffer, sometimes small, sometimes large. The issue was triggered AFAIU when the snd buffer was reached (in hindsight, maybe testing TCP would be better, however, does TCP do cmsg?).
With the patch the SND buffer of the connected socket is always zero.
Just saying. I'm not fully understanding it yet.
Hi!
I'm playing with doing UDP networking and IOSQE_ASYNC. Here's a repro:
Run:
What we do is set 32 sendmsg SQE's that fly towards a connected socket all the time - the socket is overfilled and packets dropped, and cap the iowq_max_workers at 7.
I think we should hear EAGAIN. This seem to be confirmed with
-11 = -EAGAIN
However, the
cqe->res
contains -14 which is EFAULT.I don't expect EFAULT here. AFAICT the sendmsg arguments are valid.
The problem only occurs when:
You might need to massage the two parameters of the test program (inflight and iowq settings), depending on your machine. I suspect that the EAGAIN from udp_sendmsg happens on full send buffer, so we need to fill the buffer faster than it's drained/dropped by network subsystem.
Kernel 6.4-rc5 liburing master branch commit d39530a3f4b52ff2fab653eb3b2314e0aedc2d92