All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nf PATCH v3] netfilter: nfnetlink: Fix for interrupted hook dumps
Date: Tue, 8 Sep 2026 11:23:03 +0200	[thread overview]
Message-ID: <ap_T9yc-1IP0SPXs@orbyte.nwl.cc> (raw)
In-Reply-To: <ap8AQ1DCUET8Ggkd@chamomile>

Hi Pablo,

On Mon, Sep 07, 2026 at 08:19:47PM +0200, Pablo Neira Ayuso wrote:
> On Fri, Sep 04, 2026 at 02:52:15PM +0200, Phil Sutter wrote:
> > @@ -338,27 +337,47 @@ nfnl_hook_entries_head(u8 pf, unsigned int hook, struct net *net, const char *de
> >  }
> >  
> >  static int nfnl_hook_dump_nat(struct sk_buff *nlskb,
> > -			      const struct nfnl_dump_hook_data *ctx,
> > -			      const struct nf_hook_ops *ops,
> > -			      int family, unsigned int seq)
> > +			      struct netlink_callback *cb,
> > +			      const struct nf_hook_ops *ops, int family)
> >  {
> >  	struct nf_nat_lookup_hook_priv *priv = ops->priv;
> > -	struct nf_hook_entries *e = rcu_dereference(priv->entries);
> > +	struct nfnl_dump_hook_data *ctx = cb->data;
> > +	struct net *net = sock_net(nlskb->sk);
> >  	struct nf_hook_ops **nat_ops;
> > -	int i, err;
> > +	unsigned int i = cb->args[1];
> > +	struct nf_hook_entries *e;
> > +	unsigned int base_seq;
> > +	int err = 0;
> >  
> > +	base_seq = smp_load_acquire(&net->nf.nat_hook_base_seq);
> 
> Maybe annnotate this base sequence in the .start via:
> 
> struct netlink_dump_control c = {
>         .start = ...;
> 
> We should probably start doing this in other nfnetlink subsystems too.
> 
> This will help catch an interference between two netlink recv() calls
> which results in calling netlink_dump() which calls this function.

I do not comprehend, sorry. The concurrent hook dumps have distinct cb
buffers and net->nf.{nat_,}hook_base_seq is shared but read-only. How
does the problematic interference happen?

Cheers, Phil

  reply	other threads:[~2026-09-08  9:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 12:52 [nf PATCH v3] netfilter: nfnetlink: Fix for interrupted hook dumps Phil Sutter
2026-09-07 18:19 ` Pablo Neira Ayuso
2026-09-08  9:23   ` Phil Sutter [this message]
2026-09-08 12:41     ` Pablo Neira Ayuso
2026-09-08 13:57       ` Phil Sutter
2026-09-09  0:34         ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ap_T9yc-1IP0SPXs@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.