Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Nikolay Aleksandrov
Tue, 24 Nov 2026 09:21
Re: [PATCH net-next v2 0/2] net: bridge: switchdev state of fdb entries made dynamic or roamed
Author: Nikolay Aleksandrov
Date: Tue, 24 Nov 2026 09:21
Date: Tue, 24 Nov 2026 09:21
89 lines
15345 bytes
15345 bytes
On 22/11/2026 21:21, Julius Bairaktaris wrote: > When the user turns an fdb entry that switchdev was told about into one > added as "master dynamic", the bridge reports neither that change nor > the entry's later deletion, so drivers keep the entry after the bridge > dropped it. When the bridge withdraws an entry from a port's driver and > keeps it, which that change and a learned entry moving to another port > both do, the entry keeps the offloaded flag, so "bridge fdb show" and > "bridge fdb flush ... offloaded" treat it as offloaded while nothing > holds it. > > Patch 1 reports the deletion of such an entry to switchdev before the > entry becomes one that is not reported, and clears the offloaded flag > with it. Patch 2 clears the offloaded flag when a learned entry roams, > right after the deletion is reported to the old port. > > Both were found by an LLM review: patch 1 in a review of the > series "net: dsa: fix host fdb refcount when an entry roams", patch 2 in > one of __fdb_update() while patch 1 was reworked after its v1 review. > > Trigger: patch 1, a local user with CAP_NET_ADMIN runs "bridge fdb > replace <addr> dev <port> master dynamic" (or "... master use") on an > entry that a switchdev driver offloaded; patch 2, an address learned on > one bridge port is seen on another, as when a host moves, and the old > port's driver had offloaded the entry while the new port's does not > (DSA with assisted learning on the CPU port, entries learned by a > switch). Shown in QEMU with dsa_loop. Impact: patch 1, the switch keeps > the entry for the old port after the bridge dropped it; patch 2, a > wrong "offload" flag in the bridge's view. No crash or memory > corruption. CVSS 3.1: patch 1 2.3 (AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N), > patch 2 0.0. Until the fix: delete the entry and add it again instead > of replacing it; the wrong flag of patch 2 goes when the entry ages out. > > In QEMU with KASAN, with dsa_loop given FDB operations and assisted > learning on the CPU port, and a tc mirred redirect that delivers frames > to a dsa_loop user port (test-only setup): a static entry on a user > port replaced by "master dynamic", and an address learned on a veth > port, which is a host address on the CPU port, replaced by "master > dynamic" or "master use", are not deleted from the switch and are still > shown as offloaded without the series, in 3 of 3 boots each. With it, > each is deleted from the switch and no longer shown as offloaded, in 3 > of 3 boots each. An address learned on the veth port and then on the > user port is still shown as offloaded with patch 1 alone and not with > both, in 3 of 3 boots each. > > I used Claude (Anthropic) to help write these patches. > > v2: > - net-next instead of net, so without the Fixes: tag; the commit that > introduced the filter is named in the first paragraph of patch 1 > (Nikolay). > - Patch 1 clears the offloaded flag with the withdrawal: a "master > static" entry the driver had offloaded kept it after "replace ... > master dynamic" deleted the entry from the hardware (Nikolay). > br_fdb_offloaded_set() assigns the flag instead of toggling it, so the > clear cannot be inverted by a concurrent report. > - Call br_switchdev_fdb_notify() directly, no helper (Nikolay). > - Drop the comments in __fdb_update() (Nikolay). > - New patch 2. > > v1: https://lore.kernel.org/netdev/20261121191638.1724620-1-julius@bairaktaris.de/ > > > > Julius Bairaktaris (2): > net: bridge: withdraw the switchdev entry of an fdb entry made dynamic > net: bridge: clear the offloaded flag of an fdb entry that roams > > net/bridge/br_fdb.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > > base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d Hi, I've been thinking about this and I don't think it really improves the current situation. The problem is that it introduces new race conditions with the bits. It fixes one problem and introduces new ones that might be worse. I'm sorry but I think the fdb flag management (and potentially fdb itself) has to be designed in a different way to avoid these problems then it will be possible to fix these issues reliably. I don't think it is worth going after these corner cases that never worked and risk introducing new race conditions in current fdb state. Let's see what others think, too. Thanks, Nik
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads