From: Jens Axboe <axboe@kernel.dk>
To: Dylan Yudaken <dylany@fb.com>,
Pavel Begunkov <asml.silence@gmail.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, io-uring@vger.kernel.org
Cc: netdev@vger.kernel.org, Kernel-team@fb.com
Subject: Re: [PATCH v3 for-next 3/3] io_uring: support multishot in recvmsg
Date: Thu, 14 Jul 2022 07:36:43 -0600 [thread overview]
Message-ID: <c04892ba-61ca-2cb7-d390-3c3f5b4ff04a@kernel.dk> (raw)
In-Reply-To: <20220714110258.1336200-4-dylany@fb.com>
On 7/14/22 5:02 AM, Dylan Yudaken wrote:
> Similar to multishot recv, this will require provided buffers to be
> used. However recvmsg is much more complex than recv as it has multiple
> outputs. Specifically flags, name, and control messages.
>
> Support this by introducing a new struct io_uring_recvmsg_out with 4
> fields. namelen, controllen and flags match the similar out fields in
> msghdr from standard recvmsg(2), payloadlen is the length of the payload
> following the header.
> This struct is placed at the start of the returned buffer. Based on what
> the user specifies in struct msghdr, the next bytes of the buffer will be
> name (the next msg_namelen bytes), and then control (the next
> msg_controllen bytes). The payload will come at the end. The return value
> in the CQE is the total used size of the provided buffer.
Just a few minor nits (some repeat ones too), otherwise looks fine to
me. I can either fold these in while applying, or you can spin a v4. Let
me know!
> +static int io_recvmsg_multishot_overflow(struct io_async_msghdr *iomsg)
> +{
> + unsigned long hdr;
> +
> + if (check_add_overflow(sizeof(struct io_uring_recvmsg_out),
> + (unsigned long)iomsg->namelen, &hdr))
> + return -EOVERFLOW;
> + if (check_add_overflow(hdr, iomsg->controllen, &hdr))
> + return -EOVERFLOW;
> + if (hdr > INT_MAX)
> + return -EOVERFLOW;
> +
> + return 0;
> +}
Nobody checks the specific value of this helper, so we should either
actually do that, or just make this one return a true/false instead. The
latter makes the most sense to me.
> +static int io_recvmsg_prep_multishot(struct io_async_msghdr *kmsg, struct io_sr_msg *sr,
> + void __user **buf, size_t *len)
> +{
The line breaks here are odd, should be at 80 unless there's a good
reason for it to exceed it.
Function reads better now though with the cast.
> +static int io_recvmsg_multishot(
> + struct socket *sock,
> + struct io_sr_msg *io,
> + struct io_async_msghdr *kmsg,
> + unsigned int flags,
> + bool *finished)
> +{
This is still formatted badly.
> + if (req->flags & REQ_F_APOLL_MULTISHOT) {
> + ret = io_recvmsg_prep_multishot(kmsg, sr,
> + &buf, &len);
ret = io_recvmsg_prep_multishot(kmsg, sr, &buf, &len);
this still would fit nicely on an unbroken line.
--
Jens Axboe
next prev parent reply other threads:[~2022-07-14 13:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 11:02 [PATCH v3 for-next 0/3] io_uring: multishot recvmsg Dylan Yudaken
2022-07-14 11:02 ` [PATCH v3 for-next 1/3] net: copy from user before calling __copy_msghdr Dylan Yudaken
2022-07-14 11:02 ` [PATCH v3 for-next 2/3] net: copy from user before calling __get_compat_msghdr Dylan Yudaken
2022-07-15 20:28 ` Marek Szyprowski
2022-07-15 20:37 ` Jens Axboe
2022-07-15 20:58 ` Marek Szyprowski
2022-07-15 21:25 ` Jens Axboe
2022-07-14 11:02 ` [PATCH v3 for-next 3/3] io_uring: support multishot in recvmsg Dylan Yudaken
2022-07-14 13:36 ` Jens Axboe [this message]
2022-07-14 16:28 ` [PATCH v3 for-next 0/3] io_uring: multishot recvmsg Jens Axboe
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=c04892ba-61ca-2cb7-d390-3c3f5b4ff04a@kernel.dk \
--to=axboe@kernel.dk \
--cc=Kernel-team@fb.com \
--cc=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=dylany@fb.com \
--cc=edumazet@google.com \
--cc=io-uring@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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