Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The Fixes: tag is incomplete, and the description of the bysrc half is imprecise. -- xfrm: Give GC list nodes their own storage This patch takes gclist out of its union with bydst. It also moves dev_gclist out of its union with bysrc and into a union with byseq. This keeps the bydst and bysrc hash linkage intact for RCU readers that are still walking a state after it has been unlinked. The code change appears to fix both overlays. The questions below are only about the commit message.
> The same issue applies to dev_gclist and bysrc.
[Severity: Low] Is the bysrc case really the same issue as the gclist case? The gclist overwrite only happens when the last reference is dropped in __xfrm_state_destroy(). xfrm_state_gc_task() then runs synchronize_rcu() before freeing. For offloaded states, dev_gclist is written right after bysrc is unlinked. It does not wait for the last reference: __xfrm_state_delete() hlist_del_init_rcu(&x->bysrc); ... spin_unlock(&net->xfrm.xfrm_state_lock); xfrm_dev_state_delete(x) hlist_add_head(&x->dev_gclist, &xfrm_state_dev_gc_list); That overwrites bysrc.next while a reader in __xfrm_state_lookup_byaddr() may still be sitting on x: hlist_for_each_entry_rcu(x, state_ptrs->bysrc + h, bysrc) { After that, xfrm_dev_state_flush() can call xfrm_dev_state_free(). That function does hlist_del(&x->dev_gclist), which sets next to LIST_POISON1 without a grace period. A concurrent bysrc reader could then dereference the poison pointer. Could the commit message describe the bysrc case separately?
> Fixes: d737a5805581 ("xfrm: state: don't use lock anymore unless acquire operation is needed")
Does this tag cover the bysrc half of the fix? d737a5805581 only made xfrm_state_find() walk bydst under rcu_read_lock(), so it matches the gclist/bydst overlay. The dev_gclist/bysrc union came from 07b87f9eea0c ("xfrm: Fix unregister netdevice hang on hardware offload."). When that commit landed, every bysrc reader held xfrm_state_lock, so the overlay was safe. The overlay became unsafe with 2e460eefbd4469 ("xfrm: state: make xfrm_state_lookup_byaddr lockless"). That commit replaced spin_lock_bh(&net->xfrm.xfrm_state_lock) with rcu_read_lock() in xfrm_state_lookup_byaddr(). This turned __xfrm_state_lookup_byaddr() into a lockless reader of bysrc while dev_gclist still shared its storage. Should the patch also carry the following tag, possibly together with 07b87f9eea0c? Fixes: 2e460eefbd4469 ("xfrm: state: make xfrm_state_lookup_byaddr lockless") Backporting to trees without 07b87f9eea0c will hit a conflict in the xfrm.h hunk. The current message doesn't say that only the gclist/bydst split applies to those trees.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40secunet.com