Skip to content

netfilter: handle race w. module removal and nfqueue

Florian Westphal netfilter-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4netfilter: expect: add and use nf_ct_expect_iterate helpersinclude/net/netfilter/nf_conntrack_expect.h net/netfilter/nf_conntrack_expect.c net/netfilter/nf_conntrack_helper.c +1 more+95 -610 replies
2/4netfilter: add and use nf_ct_unconfirmed_destroyinclude/net/netfilter/nf_conntrack.h net/netfilter/nf_conntrack_core.c net/netfilter/nfnetlink_cttimeout.c+15 -40 replies
3/4netfilter: conntrack: destroy functions need to free queued packetsnet/netfilter/nf_conntrack_core.c net/netfilter/nf_queue.c+5 -00 replies
4/4netfilter: nfnetlink_queue: don't queue dying conntracks to userspacenet/netfilter/nfnetlink_queue.c+19 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH nf-next v2 0/4] netfilter: handle race w. module removal and nfqueue

There is a long-standing race that occurs with module removal (such as helpers) nfqueue, and unconfirmed (not in hash table) conntracks.

The main issue is that
a). unconfirmed conntracks can't safely be mangled from other cpu (we assume
exclusive access to grow/alter the extension area) and
b). nfqueued skbs leave RCU protection

This series address this by making the queue event similar to a confirm event:

Just as we do not commit 'dying' conntracks to the main table, refuse to queue dying and unconfirmed conntracks to userspace.

Combined with a 'drop queued skbs' when a module exit path calls the ct_iterate_destroy function this closes the hole, see patch #4 for details.

The only change since v1 is a build error that occured in patch 4 when nfqueue is enabled but conntrack is not, as reported by kbuild test robot.