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] [day] [month] [year] [list]
Message-ID: <aXAuyPwez4ZfuFT7@devvm11784.nha0.facebook.com>
Date: Tue, 20 Jan 2026 17:41:28 -0800
From: Bobby Eshleman <bobbyeshleman@...il.com>
To: Aleksei Oladko <aleksey.oladko@...tuozzo.com>
Cc: "David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>, Shuah Khan <shuah@...nel.org>,
	Petr Machata <petrm@...dia.com>, netdev@...r.kernel.org,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests: net: forwarding: cleanup veth peers created
 via NUM_NETIFS

On Tue, Jan 20, 2026 at 05:31:27PM -0800, Bobby Eshleman wrote:
> On Tue, Jan 20, 2026 at 11:09:05PM +0000, Aleksei Oladko wrote:
> > Some net/forwarding kselftests set NUM_NETIFS, causing lib.sh to create
> > the requested number of veth peer interfaces.
> > 
> > These interfaces are not removed when the tests finish, leaving stale
> > veth devices in the system. This can cause subsequent tests to fail,
> > for example min_max_mtu.sh.
> > 
> > Ensure that veth peers created via NUM_NETIFS are properly removed at
> > the end of the tests to avoid interference between test runs.
> > 
> > Signed-off-by: Aleksei Oladko <aleksey.oladko@...tuozzo.com>
> > ---
> >  tools/testing/selftests/net/forwarding/lib.sh | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
> > index a9034f0bb58b..ae7699c0c7e5 100644
> > --- a/tools/testing/selftests/net/forwarding/lib.sh
> > +++ b/tools/testing/selftests/net/forwarding/lib.sh
> > @@ -597,6 +597,10 @@ vrf_cleanup()
> >  	ip -6 rule del pref 32765
> >  	ip -4 rule add pref 0 table local
> >  	ip -4 rule del pref 32765
> > +
> > +	for ((i = 1; i <= NUM_NETIFS; i=$i+2)); do
> 
> I'd suggest 'i = i + 2' here instead of "i=$i+2", as it seems closer to the rest of lib.sh
> style.
> 
> > +		ip link delete dev ${NETIFS[p$i]} 2>/dev/null || true
> > +	done
> >  }
> >  
> >  adf_vrf_prepare()
> > -- 
> > 2.43.0
> > 
> 
> I see that some tests that set NUM_NETIFS do not seem to call
> vrf_cleanup() (e.g. bridge_activity_notify.sh), so I think those tests
> will still leak?

My mistake here, I now see there is a more indirect call to vrf_cleanup
via defer there.

Best,
Bobby

> 
> Maybe lib.sh needs a remove_netif() to go along with create_netif(), and
> then tests can call it from their 'cleanup()' EXIT handlers? This avoids
> the mismatch between vrf_prepare() not creating devices but
> vrf_cleanup() removing them.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ