netfilter: nf_conncount: fix gc and rbtree bugs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest5 patches 1 replyIn review
- v35 patches 0 repliesSuperseded
- v24 patches 0 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 3 patches | 0 replies | Superseded |
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | netfilter: nf_conncount: callers must hold rcu read locknet/ net/ | +4 | 0 replies | |
| 2/5 | netfilter: nf_conncount: use per nf_conncount_data spinlocksnet/ | +34 | 1 reply | |
| 3/5 | netfilter: nf_conncount: split count_tree_node rbtree walk into helpernet/ | +62 | 0 replies | |
| 4/5 | netfilter: nf_conncount: add sequence counter to detect tree modificationsnet/ | +19 | 0 replies | |
| 5/5 | netfilter: nf_conncount: gc and rcu fixesnet/ | +32 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH nf-next v4 0/5] netfilter: nf_conncount: fix gc and rbtree bugs
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(-)
Signature · 1 line
2.53.0