From: Al Viro <viro@zeniv.linux.org.uk>
To: Joe Damato <jdamato@fastly.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC,iov_iter v2 3/8] iov_iter: add copyin_iovec helper
Date: Mon, 13 Jun 2022 04:25:39 +0000 [thread overview]
Message-ID: <Yqa8Q7O0Fmnex8Ev@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <1655024280-23827-4-git-send-email-jdamato@fastly.com>
On Sun, Jun 12, 2022 at 01:57:52AM -0700, Joe Damato wrote:
> copyin_iovec is a helper which wraps copyin and selects the right copy
> method based on the iter_copy_type.
>
> Signed-off-by: Joe Damato <jdamato@fastly.com>
> ---
> lib/iov_iter.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index d32d7e5..6720cb2 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -168,6 +168,15 @@ static int copyin(void *to, const void __user *from, size_t n)
> return n;
> }
>
> +static int copyin_iovec(void *to, const void __user *from, size_t n,
> + struct iov_iter *i)
> +{
> + if (unlikely(iov_iter_copy_is_nt(i)))
> + return __copy_from_user_nocache(to, from, n);
> + else
> + return copyin(to, from, n);
> +}
Just a sanity check - your testing is *not* with KASAN/KCSAN, right?
And BTW, why is that only on the userland side? If you are doing
that at all, it would make sense to cover the memcpy() side as
well...
next prev parent reply other threads:[~2022-06-13 4:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 8:57 [RFC,net-next,x86 v2 0/8] Nontemporal copies in sendmsg path Joe Damato
2022-06-12 8:57 ` [RFC,x86 v2 1/8] arch, x86, uaccess: Add nontemporal copy functions Joe Damato
2022-06-12 8:57 ` [RFC,iov_iter v2 2/8] iov_iter: Introduce iter_copy_type Joe Damato
2022-06-12 8:57 ` [RFC,iov_iter v2 3/8] iov_iter: add copyin_iovec helper Joe Damato
2022-06-13 4:25 ` Al Viro [this message]
2022-06-13 6:32 ` Joe Damato
2022-06-13 7:53 ` David Laight
2022-06-13 14:42 ` Joe Damato
2022-06-13 15:31 ` David Laight
2022-06-12 8:57 ` [RFC,net-next v2 4/8] net: Add MSG_NTCOPY sendmsg flag Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 5/8] net: unix: Support MSG_NTCOPY Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 6/8] net: ip: " Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 7/8] net: udplite: " Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 8/8] net: tcp: " Joe Damato
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=Yqa8Q7O0Fmnex8Ev@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=jdamato@fastly.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome