I don't understand.

v1 was submitted at 5:02 UTC. I replied at 11:36 UTC asking:

"Please read [2] and run [3] and [4] on v2 and future submissions"

Where the fourth line in [2] is "don’t repost your patches within one
24h period".

31 minutes after my reply you posted v2. So, did you ignore everything I
wrote and just took the diff?

[2] https://docs.kernel.org/next/process/maintainer-netdev.html

On Tue, Sep 01, 2026 at 09:07:40PM +0900, qotmddnjs wrote:
> From: Seungwon Bae <[email protected]>
> 
> An fdb entry that references a nexthop id cannot roam and therefore has no
> reason to be aged out, even though vxlan_snoop() keeps refreshing its
> timestamp.  Nevertheless, such an entry can currently be created (or an
> existing nexthop entry updated) with a dynamic state, which places it on
> the aging list.
> 
> struct nexthop.fdb_list is a per-nexthop global list of the vxlan fdb
> entries that reference an fdb-nexthop.  It is manipulated by vxlan under
> the per-device vxlan->hash_lock only.  When two vxlan devices reference the
> same fdb-nexthop, their entries share one nh->fdb_list, but each device
> takes only its own hash_lock.  vxlan_cleanup() - the aging timer - then
> runs in softirq with only its device's hash_lock and calls
> vxlan_fdb_destroy() -> list_del_rcu(&f->nh_list), racing a concurrent
> list_add_tail_rcu()/list_del_rcu() driven from the other device.  The
> shared list is corrupted and a freed struct vxlan_fdb is left linked on
> nh->fdb_list, a use-after-free later consumed by vxlan_fdb_nh_flush().
> 
> On CONFIG_DEBUG_LIST/KASAN this reproduces as:
> 
>   list_del corruption. next->prev should be ..., but was dead000000000122.
>   __list_del_entry_valid_or_report <- vxlan_fdb_destroy <- vxlan_cleanup
>   <- run_timer_softirq
>   BUG: KASAN: slab-use-after-free in vxlan_fdb_destroy
> 
> Since a nexthop fdb entry must not be aged out in the first place, reject
> making it dynamic, both when it is created and when an existing entry is
> updated.  vxlan_cleanup() skips NUD_PERMANENT/NUD_NOARP entries, so this
> guarantees nexthop fdb entries are never touched by the softirq aging
> path, and nh->fdb_list ends up manipulated under RTNL only, removing the
> race entirely.
> 
> Extend the vxlan fdb-nexthop selftests to cover the rejection on add,
> replace and append.
> 
> Verified with a KASAN + CONFIG_DEBUG_LIST kernel and an unprivileged
> (userns+netns) reproducer that previously ran two vxlan devices churning
> dynamic add + aging-delete on a shared fdb-nexthop: before the change the
> dynamic nexthop adds succeed and produce hundreds of list_del corruptions
> plus a slab-use-after-free; after the change the adds are rejected with
> -EINVAL and the run is clean (0 corruptions, 0 KASAN reports).

The commit message needs to better explain why it's safe to prevent
dynamic FDB entries from pointing to FDB nexthops. Something like:

"Cited commit in the Fixes tag allowed VXLAN FDB entries to point to FDB
nexthops so that overlay traffic could be load balanced across multiple
VTEPs. Such entries can only be configured from user space, cannot be
learned and cannot roam. They only make sense with a user space control
plane such as E-VPN where data plane learning is disabled.

Despite that, the VXLAN driver does not currently prevent such entries
from being configured with the "dynamic" flag. The per-nexthop FDB list
is only protected by the per-device hash lock, which is not sufficient
when two VXLAN devices point to the same FDB nexthop and therefore share
the list. Aging runs in softirq context without RTNL, so an entry
deleted by one device can race with an addition or deletion from the
other, leading to list corruption:

<put the trace here>

Fix this by rejecting the bogus configuration of dynamic FDB entries
that point to FDB nexthops. As such, the per-nexthop FDB list is only
ever mutated under the RTNL lock. Add test cases to make sure that this
does not regress in the future."

Reply via email to