lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c3b36363-a0a8-44e0-9e0e-3c05c059190a@gmail.com>
Date: Wed, 26 Mar 2025 09:52:06 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: Caleb Sander Mateos <csander@...estorage.com>
Cc: Jens Axboe <axboe@...nel.dk>, io-uring@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring/net: use REQ_F_IMPORT_BUFFER for send_zc

On 3/25/25 14:39, Caleb Sander Mateos wrote:
> On Tue, Mar 25, 2025 at 6:30 AM Pavel Begunkov <asml.silence@...il.com> wrote:
>>
>> On 3/24/25 15:11, Caleb Sander Mateos wrote:
>>> Instead of a bool field in struct io_sr_msg, use REQ_F_IMPORT_BUFFER to
>>> track whether io_send_zc() has already imported the buffer. This flag
>>> already serves a similar purpose for sendmsg_zc and {read,write}v_fixed.
>>>
>>> Signed-off-by: Caleb Sander Mateos <csander@...estorage.com>
>>> Suggested-by: Pavel Begunkov <asml.silence@...il.com>
>>> ---
>>>    include/linux/io_uring_types.h | 5 ++++-
>>>    io_uring/net.c                 | 8 +++-----
>>>    2 files changed, 7 insertions(+), 6 deletions(-)
...
>>> @@ -1305,12 +1304,11 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>>>        struct io_ring_ctx *ctx = req->ctx;
>>>        struct io_kiocb *notif;
>>>
>>>        zc->done_io = 0;
>>>        zc->retry = false;
>>> -     zc->imported = false;
>>> -     req->flags |= REQ_F_POLL_NO_LAZY;
>>> +     req->flags |= REQ_F_POLL_NO_LAZY | REQ_F_IMPORT_BUFFER;
>>
>> This function is shared with sendmsg_zc, so if we set it here,
>> it'll trigger io_import_reg_vec() in io_sendmsg_zc() even for
>> non register buffer request.
> 
> Good catch. I keep forgetting which prep and issue functions are
> shared between which opcodes.

No worries, can happen. I'd recommend to run liburing tests,
they're very useful for catching such things. I run it out
of curiosity, it crashes on send-zerocopy.c pretty fast.

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ