All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next v4 0/5] netfilter: nf_conncount: fix gc and rbtree bugs
@ 2026-06-05 13:11 Florian Westphal
  2026-06-05 13:11 ` [PATCH nf-next v4 1/5] netfilter: nf_conncount: callers must hold rcu read lock Florian Westphal
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Florian Westphal @ 2026-06-05 13:11 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

v4: address even more drive by findings:
    - must switch to kzalloc, atm initial bitmap is random at start
      (which is harmless but wrong)
    - PREEMPT_RT needs seqcnt <-> spinlock association so preemption
      is disabled

1) Extend RCU read lock scope in ovs, conncount API requires this.
   rcu_dereference_raw should not have been used here.
   Note this adds new sparse warnings, but those are the lesser
   evil; lockdep support is more desirable wrt. rcu access correctness
   than sparse.

2) Replace rb_root with a new container structure in nf_conncount. Assign
   dedicated locks to each tree instead of a shared lock array. Use kvzalloc
   to ensure zero-initialized memory.

3) Split the count_tree_node rbtree walk into a helper. Add find_tree_node()
   to fetch matching rbtree nodes.

4) Add sequence counter to nf_conncount to detect tree modifications. Re-do
   lookups under lock if the counter changes. Prevent unsafe lockless
   iteration.

5) Fix tree_gc_worker wrap-around and protect rbtree iteration with a
   spinlock. Use disable_work_sync() and add rcu_barrier() to module exit.

Florian Westphal (5):
  netfilter: nf_conncount: callers must hold rcu read lock
  netfilter: nf_conncount: use per nf_conncount_data spinlocks
  netfilter: nf_conncount: split count_tree_node rbtree walk into helper
  netfilter: nf_conncount: add sequence counter to detect tree modifications
  netfilter: nf_conncount: gc and rcu fixes

 net/netfilter/nf_conncount.c | 230 ++++++++++++++++++++++-------------
 net/openvswitch/conntrack.c  |   2 +-
 2 files changed, 144 insertions(+), 88 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-06-05 14:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 13:11 [PATCH nf-next v4 0/5] netfilter: nf_conncount: fix gc and rbtree bugs Florian Westphal
2026-06-05 13:11 ` [PATCH nf-next v4 1/5] netfilter: nf_conncount: callers must hold rcu read lock Florian Westphal
2026-06-05 13:11 ` [PATCH nf-next v4 2/5] netfilter: nf_conncount: use per nf_conncount_data spinlocks Florian Westphal
2026-06-05 14:40   ` Florian Westphal
2026-06-05 13:11 ` [PATCH nf-next v4 3/5] netfilter: nf_conncount: split count_tree_node rbtree walk into helper Florian Westphal
2026-06-05 13:11 ` [PATCH nf-next v4 4/5] netfilter: nf_conncount: add sequence counter to detect tree modifications Florian Westphal
2026-06-05 13:11 ` [PATCH nf-next v4 5/5] netfilter: nf_conncount: gc and rcu fixes Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.