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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izOEQHwFcQ6L7bPeonWNVgjuZ4yKWwi+3LBhnQnCG+VC-w@mail.gmail.com>
Date: Wed, 21 May 2025 11:44:16 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Stanislav Fomichev <stfomichev@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com, 
	kuba@...nel.org, pabeni@...hat.com, viro@...iv.linux.org.uk, horms@...nel.org, 
	andrew+netdev@...n.ch, shuah@...nel.org, sagi@...mberg.me, willemb@...gle.com, 
	asml.silence@...il.com, jdamato@...tly.com, kaiyuanz@...gle.com, 
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next 1/3] net: devmem: support single IOV with sendmsg

On Wed, May 21, 2025 at 10:33 AM Stanislav Fomichev
<stfomichev@...il.com> wrote:
>
> On 05/21, Mina Almasry wrote:
> > On Tue, May 20, 2025 at 1:30 PM Stanislav Fomichev <stfomichev@...il.com> wrote:
> > >
> > > sendmsg() with a single iov becomes ITER_UBUF, sendmsg() with multiple
> > > iovs becomes ITER_IOVEC. iter_iov_len does not return correct
> > > value for UBUF, so teach to treat UBUF differently.
> > >
> > > Cc: Al Viro <viro@...iv.linux.org.uk>
> > > Cc: Pavel Begunkov <asml.silence@...il.com>
> > > Cc: Mina Almasry <almasrymina@...gle.com>
> > > Fixes: bd61848900bf ("net: devmem: Implement TX path")
> > > Signed-off-by: Stanislav Fomichev <stfomichev@...il.com>
> > > ---
> > >  include/linux/uio.h | 8 +++++++-
> > >  net/core/datagram.c | 3 ++-
> > >  2 files changed, 9 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/uio.h b/include/linux/uio.h
> > > index 49ece9e1888f..393d0622cc28 100644
> > > --- a/include/linux/uio.h
> > > +++ b/include/linux/uio.h
> > > @@ -99,7 +99,13 @@ static inline const struct iovec *iter_iov(const struct iov_iter *iter)
> > >  }
> > >
> > >  #define iter_iov_addr(iter)    (iter_iov(iter)->iov_base + (iter)->iov_offset)
> > > -#define iter_iov_len(iter)     (iter_iov(iter)->iov_len - (iter)->iov_offset)
> > > +
> > > +static inline size_t iter_iov_len(const struct iov_iter *i)
> > > +{
> > > +       if (i->iter_type == ITER_UBUF)
> > > +               return i->count;
> > > +       return iter_iov(i)->iov_len - i->iov_offset;
> > > +}
> > >
> >
> > This change looks good to me from devmem perspective, but aren't you
> > potentially breaking all these existing callers to iter_iov_len?
> >
> > ackc -i iter_iov_len
> > fs/read_write.c
> > 846:                                            iter_iov_len(iter), ppos);
> > 849:                                            iter_iov_len(iter), ppos);
> > 858:            if (nr != iter_iov_len(iter))
> >
> > mm/madvise.c
> > 1808:           size_t len_in = iter_iov_len(iter);
> > 1838:           iov_iter_advance(iter, iter_iov_len(iter));
> >
> > io_uring/rw.c
> > 710:                    len = iter_iov_len(iter);
> >
> > Or are you confident this change is compatible with these callers for
> > some reason?
>
> Pavel did go over all callers, see:
> https://lore.kernel.org/netdev/7f06216e-1e66-433e-a247-2445dac22498@gmail.com/
>

Thanks, I'm not confident enough in my understanding of the other call
sites of iter_iov_len to provide a reviewed-by, but this looks fine to
me for devmem TCP, so I think acked-by is appropriate.

Acked-by: Mina Almasry <almasrymina@...gle.com>

Thanks!

-- 
Thanks,
Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ