All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 3/9] netfilter: nft_set_pipapo: prepare destroy function for on-demand clone
Date: Tue, 9 Apr 2024 15:04:02 +0200	[thread overview]
Message-ID: <20240409130402.GA20876@breakpoint.cc> (raw)
In-Reply-To: <20240409145440.5b72df13@elisabeth>

Stefano Brivio <sbrivio@redhat.com> wrote:
> > I do not follow.  nft_pipapo_destroy() is not invoked asynchronously via
> > call_rcu, its invoked from either abort path or the gc work queue at at
> > time where there must be no references to nft_set anymore.
> 
> Hmm, sorry, I was all focused on nft_set_pipapo_match_destroy()
> accessing nft_set, but that has nothing to do with
> pipapo_reclaim_match(). However:
> 
> > What do we wait for, i.e., which outstanding rcu callback could
> > reference a data structure that nft_pipapo_destroy() will free?
> 
> ...we still have pipapo_free_match(), called by pipapo_reclaim_match(),
> referencing the per-CPU scratch areas, and nft_pipapo_destroy() freeing
> them (using pipapo_free_match() since this patch).

But those scratchmaps are anchored in struct nft_pipapo_match.

So, if we have a call_rcu() for struct nft_pipapo_match $m, and then
get into nft_pipapo_destroy() where priv->match == $m or
priv->clone == $m we are already in trouble ($m is free'd twice).

If not, then I don't see why ordering would matter.

Can you sketch a race where pipapo_reclaim_match, running from a
(severely delayed) call_rcu, will access something that has been
released already?

I can't spot anything.

  reply	other threads:[~2024-04-09 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  8:41 [PATCH nf-next 0/9] nft_set_pipapo: remove cannot-fail allocations on commit and abort Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 1/9] netfilter: nft_set_pipapo: move prove_locking helper around Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 2/9] netfilter: nft_set_pipapo: make pipapo_clone helper return NULL Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 3/9] netfilter: nft_set_pipapo: prepare destroy function for on-demand clone Florian Westphal
2024-04-08 15:45   ` Stefano Brivio
2024-04-09 11:07     ` Florian Westphal
2024-04-09 12:54       ` Stefano Brivio
2024-04-09 13:04         ` Florian Westphal [this message]
2024-04-09 13:10           ` Stefano Brivio
2024-04-03  8:41 ` [PATCH nf-next 4/9] netfilter: nft_set_pipapo: prepare walk " Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 5/9] netfilter: nf_tables: pass new nft_iter_type hint to walker Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 6/9] netfilter: nft_set_pipapo: merge deactivate helper into caller Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 7/9] netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone Florian Westphal
2024-04-03  8:41 ` [PATCH nf-next 8/9] netfilter: nft_set_pipapo: move cloning of match info to insert/removal path Florian Westphal
2024-04-08 15:45   ` Stefano Brivio
2024-04-03  8:41 ` [PATCH nf-next 9/9] netfilter: nft_set_pipapo: remove dirty flag Florian Westphal

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=20240409130402.GA20876@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sbrivio@redhat.com \
    /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.