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: <670ab5278077a_2737bf294ad@willemb.c.googlers.com.notmuch>
Date: Sat, 12 Oct 2024 13:43:03 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Akihiko Odaki <akihiko.odaki@...nix.com>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
 Jonathan Corbet <corbet@....net>, 
 Jason Wang <jasowang@...hat.com>, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 "Michael S. Tsirkin" <mst@...hat.com>, 
 Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, 
 Shuah Khan <shuah@...nel.org>, 
 linux-doc@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 netdev@...r.kernel.org, 
 kvm@...r.kernel.org, 
 virtualization@...ts.linux-foundation.org, 
 linux-kselftest@...r.kernel.org, 
 Yuri Benditovich <yuri.benditovich@...nix.com>, 
 Andrew Melnychenko <andrew@...nix.com>, 
 Stephen Hemminger <stephen@...workplumber.org>, 
 gur.stavi@...wei.com
Subject: Re: [PATCH RFC v5 04/10] tun: Unify vnet implementation

Akihiko Odaki wrote:
> On 2024/10/09 22:55, Willem de Bruijn wrote:
> > Akihiko Odaki wrote:
> >> Both tun and tap exposes the same set of virtio-net-related features.
> >> Unify their implementations to ease future changes.
> >>
> >> Signed-off-by: Akihiko Odaki <akihiko.odaki@...nix.com>
> >> ---
> >>   MAINTAINERS            |   1 +
> >>   drivers/net/tap.c      | 172 ++++++----------------------------------
> >>   drivers/net/tun.c      | 208 ++++++++-----------------------------------------
> >>   drivers/net/tun_vnet.h | 181 ++++++++++++++++++++++++++++++++++++++++++
> > 
> > Same point: should not be in a header.
> > 
> > Also: I've looked into deduplicating code between the various tun, tap
> > and packet socket code as well.
> > 
> > In general it's a good idea. The main counter arguments is that such a
> > break in continuity also breaks backporting fixes to stable. So the
> > benefit must outweight that cost.
> > 
> > In this case, the benefits in terms of LoC are rather modest. Not sure
> > it's worth it.
> > 
> > Even more importantly: are the two code paths that you deduplicate
> > exactly identical? Often in the past the two subtly diverged over
> > time, e.g., due to new features added only to one of the two.
> 
> I find extracting the virtio_net-related code into functions is 
> beneficial.

I understand the benefits. But as I pointed out, it is a trade-off,
not an unconditional good.

> For example, tun_get_user() is a big function and extracting 
> the virtio_net-related code into tun_vnet_hdr_get() will ease 
> understanding tun_get_user() when you are not interested in virtio_net. 
> If virtio_net is your interest, you can look at this group of functions 
> to figure out how they interact with each other.
> 
> Currently, the extracted code is almost identical for tun and tap so 

Almost here is the scary part. Any code that is not exactly identical
must be called out in the commit message.

What often happened is that one of the two got an improvement, whether
fix or feature extension. Then it is likely acceptable to extend this
to the other, too. But we have to review each case.

> they can share it. We can copy the code back (but keep functions as 
> semantic units) if they diverge in the future.

There hopefully is no need to diverge in the future. I suspect that
all previous divergences are accidental.

> > 
> > If so, call out any behavioral changes to either as a result of
> > deduplicating explicitly.
> 
> This adds an error message for GSO failure, which was missing for tap. I 
> will note that in the next version.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ