All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Miller <davem@davemloft.net>
Cc: herbert@gondor.apana.org.au, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, bcrl@kvack.org
Subject: Re: [PATCH 1/4] inet: Add skb_copy_datagram_iter
Date: Thu, 6 Nov 2014 03:25:34 +0000	[thread overview]
Message-ID: <20141106032533.GU7996@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20141105.165719.835728206041332333.davem@davemloft.net>

On Wed, Nov 05, 2014 at 04:57:19PM -0500, David Miller wrote:
> From: Al Viro <viro@ZenIV.linux.org.uk>
> Date: Wed, 5 Nov 2014 21:07:45 +0000
> 
> > Ping me when you put it there, OK?  I'll rebase the rest of old stuff on
> > top of it (similar helpers, mostly).
> 
> I just pushed it into net-next, thanks Al.

OK, I've taken the beginning of the old queue on top of net-next; it's
in git://git.kernel.org//pub/scm/linux/kernel/git/viro/vfs.git iov_iter-net.

>From the quick look at the remaining ->msg_iov users:

	* I'll need to add several iov_iter primitives - counterparts of
checksum.h stuff (copy_and_csum_{from,to}_iter(), maybe some more).  Not
a big deal, I'll do that tomorrow.  That will give us a clean iov_iter-based
counterpart of skb_copy_and_csum_datagram_iovec().

	* a new helper: zerocopy_sg_from_iter().  I have it, actually,
but I'd rather not step on Herbert's toes - it's too close to the areas
his series will touch, so that's probably for when his series goes in.
It will be needed for complete macvtap conversion...

	* why doesn't verify_iovec() use rw_copy_check_uvector()?  The only
real differences I see is that (a) you do allocation in callers (same as
rw_copy_check_uvector() would've done), (b) you return EMSGSIZE in case of
too long vector, while rw_copy_check_uvector() returns EINVAL in that case
and (c) you don't do access_ok().  The last one is described as optimization,
but for iov_iter primitives it's a serious PITA - for iovec-backed instances
they are using __copy_from_user()/__copy_to_user(), etc.
	It certainly would be nice to have the same code doing all copying
of iovecs from userland - readv/writev/aio/sendmsg/recvmsg/etc.  Am I
missing something subtle semantical difference in there?  EMSGSIZE vs EINVAL
is trivial (we can lift that check into the callers, if nothing else), but
I could miss something more interesting...

	* various getfrag will need to grow iov_iter-based counterparts,
but ip_append_output() needs no changes, AFAICS.

	* crypto stuff will be easy to convert - iov_iter_get_pages()
would suffice for a primitive

	* there's some really weird stuff in there.  Just what is this
static int raw_probe_proto_opt(struct flowi4 *fl4, struct msghdr *msg)
{
        struct iovec *iov;
        u8 __user *type = NULL;
        u8 __user *code = NULL;
        int probed = 0;
        unsigned int i;

        if (!msg->msg_iov)
                return 0;

        for (i = 0; i < msg->msg_iovlen; i++) {
                iov = &msg->msg_iov[i];
                if (!iov)
                        continue;
trying to do?  "If non-NULL pointer + i somehow happened to be NULL, skip it
and try to use the same pointer + i + 1"?  Huh?  Had been that way since
the function first went in back in 2004 ("[IPV4] XFRM: probe icmp type/code
when sending packets via raw socket.", according to historical tree)...

	* rds, bluetooth and vsock are doing something odd; need to RTFS some
more.

	* not sure I understand what TIPC is doing - does it prohibit too
short first segment of ->msg_iov?  net/tipc/socket.c:dest_name_check() looks
odd _and_ potentially racy - we read the same data twice and hope our checks
still apply.  I asked TIPC folks about that race back in April, but it
looks like that fell through the cracks...

Overall, so far it looks more or less feasible - other than the missing csum
primitives, current mm/iov_iter.c should suffice.  I have _not_ seriously
looked into sendpage yet; that might very well require some more.

  reply	other threads:[~2014-11-06  3:25 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-02 23:05 fs: Use non-const iov in aio_read/aio_write Herbert Xu
2014-11-03  0:16 ` Al Viro
2014-11-03  0:21   ` Al Viro
2014-11-03  0:22   ` Herbert Xu
2014-11-03  0:45     ` Al Viro
2014-11-03  5:37       ` [0/3] net: Kill skb_copy_datagram_const_iovec Herbert Xu
2014-11-03  5:44         ` [PATCH 1/3] tun: Modify const aio_read iovec per do_sock_read Herbert Xu
2014-11-03  5:44         ` [PATCH 3/3] net: Kill skb_copy_datagram_const_iovec Herbert Xu
2014-11-03  5:44         ` [PATCH 2/3] macvtap: Modify const aio_read iovec per do_sock_read Herbert Xu
2014-11-03 20:05         ` [0/3] net: Kill skb_copy_datagram_const_iovec David Miller
2014-11-04  3:38           ` Herbert Xu
2014-11-04  8:31             ` [PATCH 2/4] tun: Use iovec iterators Herbert Xu
2014-11-04  8:37               ` Herbert Xu
2014-11-05  2:49                 ` YOSHIFUJI Hideaki
2014-11-05  3:41                   ` Herbert Xu
2014-11-04  8:31             ` [PATCH 1/4] inet: Add skb_copy_datagram_iter Herbert Xu
2014-11-04 14:32               ` Al Viro
2014-11-04 14:35                 ` Al Viro
2014-11-04 14:44                   ` Herbert Xu
2014-11-04 14:52                     ` Al Viro
2014-11-04 14:55                       ` Herbert Xu
2014-11-04 14:42                 ` Herbert Xu
2014-11-04 15:13                   ` Al Viro
2014-11-05  2:22                     ` Herbert Xu
2014-11-05  3:27                       ` David Miller
2014-11-05  3:55                         ` Al Viro
2014-11-05  4:12                           ` Al Viro
2014-11-05 20:51                             ` David Miller
2014-11-05 20:50                           ` David Miller
2014-11-05 21:07                             ` Al Viro
2014-11-05 21:57                               ` David Miller
2014-11-06  3:25                                 ` Al Viro [this message]
2014-11-06  5:50                                   ` ipv4: Use standard iovec primitive in raw_probe_proto_opt Herbert Xu
2014-11-06  6:43                                     ` Al Viro
2014-11-06  6:46                                       ` Herbert Xu
2014-11-06  7:11                                         ` Al Viro
2014-11-06  9:55                                           ` Jon Maloy
2014-11-06 22:16                                             ` Al Viro
2014-11-28  5:14                                               ` Al Viro
2014-11-06 21:28                                         ` David Miller
2014-11-07  2:00                                           ` Herbert Xu
2014-11-07 13:25                                             ` [PATCH 0/2] ipv4: Simplify raw_probe_proto_opt and avoid reading user iov twice Herbert Xu
2014-11-07 13:27                                               ` [PATCH 1/2] ipv4: Use standard iovec primitive in raw_probe_proto_opt Herbert Xu
2014-11-07 13:27                                               ` [PATCH 2/2] ipv4: Avoid reading user iov twice after raw_probe_proto_opt Herbert Xu
2014-11-10 19:26                                               ` [PATCH 0/2] ipv4: Simplify raw_probe_proto_opt and avoid reading user iov twice David Miller
2014-11-06  9:50                                   ` [PATCH 1/4] inet: Add skb_copy_datagram_iter Jon Maloy
2014-11-07 21:48                                   ` David Miller
2014-11-07 22:11                                     ` Al Viro
2014-11-07 22:31                                       ` Al Viro
2014-11-07 22:35                                         ` Al Viro
2014-11-07 23:42                                       ` Al Viro
2014-11-08  2:21                                         ` Herbert Xu
2014-11-09 21:19                                         ` Al Viro
2014-11-10  5:20                                           ` David Miller
2014-11-10  6:58                                             ` Al Viro
2014-11-10  7:30                                               ` David Miller
2014-11-10  9:09                                                 ` Al Viro
2014-11-10 16:18                                                   ` David Miller
2014-11-10 10:14                                           ` Michael S. Tsirkin
2014-11-07 21:52                                   ` David Miller
2014-11-05 20:24               ` David Miller
2014-11-06  8:23                 ` Herbert Xu
2014-11-06 17:25                   ` David Miller
2014-11-07  1:59                     ` Herbert Xu
2014-11-07  3:13                       ` David Miller
2014-11-07 13:21                         ` [PATCH 0/4] Replace skb_copy_datagram_const_iovec with iterator version Herbert Xu
2014-11-07 13:22                           ` [PATCH 1/4] inet: Add skb_copy_datagram_iter Herbert Xu
2014-11-07 13:22                           ` [PATCH 2/4] tun: Use iovec iterators Herbert Xu
2014-11-07 13:22                           ` [PATCH 3/4] macvtap: " Herbert Xu
2014-11-07 13:22                           ` [PATCH 4/4] net: Kill skb_copy_datagram_const_iovec Herbert Xu
2014-11-06  8:27                 ` [PATCH 0/4] Replace skb_copy_datagram_const_iovec with iterator version Herbert Xu
2014-11-06  8:28                   ` [PATCH 1/4] inet: Add skb_copy_datagram_iter Herbert Xu
2014-11-06 17:30                     ` Al Viro
2014-11-07  1:58                       ` Herbert Xu
2014-11-06  8:28                   ` [PATCH 2/4] tun: Use iovec iterators Herbert Xu
2014-11-06  8:28                   ` [PATCH 3/4] macvtap: " Herbert Xu
2014-11-06 17:33                     ` Al Viro
2014-11-06  8:28                   ` [PATCH 4/4] net: Kill skb_copy_datagram_const_iovec Herbert Xu
2014-11-04  8:31             ` Herbert Xu
2014-11-04  8:31             ` [PATCH 3/4] macvtap: Use iovec iterators Herbert Xu
2014-11-04  5:45           ` [0/3] net: Kill skb_copy_datagram_const_iovec Al Viro
2014-11-05  1:53             ` Al Viro

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=20141106032533.GU7996@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=bcrl@kvack.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.