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: <20260129150457.ob6le4lb2v6j7mqf@skbuf>
Date: Thu, 29 Jan 2026 17:04:57 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Andrew Lunn <andrew@...n.ch>, netdev <netdev@...r.kernel.org>,
	Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [BUG dsa] lack of barriers in netdev_uses_dsa()

Hi Eric,

On Thu, Jan 29, 2026 at 02:16:56PM +0100, Eric Dumazet wrote:
> Hi dsa experts
> 
> It seems netdev_uses_dsa() does not have any barrier.
> 
> A compiler could read dev->dsa_ptr and get a NULL the second time.
> 
> include/net/dsa.h:1336:static inline bool netdev_uses_dsa(const struct
> net_device *dev)
> include/net/dsa.h-1337-{
> include/net/dsa.h-1338-#if IS_ENABLED(CONFIG_NET_DSA)
> include/net/dsa.h-1339- return dev->dsa_ptr && dev->dsa_ptr->rcv;
> include/net/dsa.h-1340-#endif
> include/net/dsa.h-1341- return false;
> include/net/dsa.h-1342-}
> 
> I was looking at this because I wanted to inline eth_type_trans().
> 
> Note the wmb() in dsa_conduit_teardown(), which is not good enough.
> 
> Any suggestions?
> 
> Ideally, it would be nice if netdev_uses_dsa() could test a single bit
> in "struct net_device",
> without a dereference of dsa_ptr.
> 
> Thanks.

It's been like this for a really long time.

Alexander Sverdlin had a patch to convert dev->dsa_ptr to RCU/RTNL
protection, but his problem ended up being solved in a simpler way:
https://lore.kernel.org/netdev/20240910130321.337154-1-alexander.sverdlin@siemens.com/

I also started working a while ago on some patches to gradually replace
netdev_uses_dsa() with one of
netdev_uses_dsa_rcu()
netdev_uses_dsa_rcu_bh()
netdev_uses_dsa_rtnl()
https://github.com/vladimiroltean/linux/blob/dsa-rcu-rtnl-my-try-v1/include/net/dsa.h#L1360

but I didn't submit anything and I almost forgot about that patch set.

How urgent is this?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ