All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: netfilter-devel@vger.kernel.org,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	coreteam@netfilter.org
Subject: Re: Netfilter: suspicious RCU usage in __nft_rule_lookup
Date: Thu, 24 Oct 2024 20:20:57 +0200	[thread overview]
Message-ID: <ZxqQAIlQx8C1E6FK@calendula> (raw)
In-Reply-To: <ZxqKkVCnyOqHjFq-@calendula>

On Thu, Oct 24, 2024 at 07:57:40PM +0200, Pablo Neira Ayuso wrote:
> Hi,
> 
> On Thu, Oct 24, 2024 at 06:56:43PM +0200, Matthieu Baerts wrote:
> > Hello,
> > 
> > First, thank you for all the work you did and are still doing around
> > Netfilter!
> > 
> > I'm writing you this email, because when I run the MPTCP test suite with
> > a VM running a kernel built with a debug config including
> > CONFIG_PROVE_RCU_LIST=y (and CONFIG_RCU_EXPERT=y), I get the following
> > warning:
> > 
> > 
> > > =============================
> > > WARNING: suspicious RCU usage
> > > 6.12.0-rc3+ #7 Not tainted
> > > -----------------------------
> > > net/netfilter/nf_tables_api.c:3420 RCU-list traversed in non-reader section!!
> > > 
> > > other info that might help us debug this:
> > > 
> > > 
> > > rcu_scheduler_active = 2, debug_locks = 1
> > > 1 lock held by iptables/134:
> > >   #0: ffff888008c4fcc8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid (include/linux/jiffies.h:101) nf_tables
> > > 
> > > stack backtrace:
> > > CPU: 1 UID: 0 PID: 134 Comm: iptables Not tainted 6.12.0-rc3+ #7
> > > Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> > > Call Trace:
> > >  <TASK>
> > >  dump_stack_lvl (lib/dump_stack.c:123)
> > >  lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
> > >  __nft_rule_lookup (net/netfilter/nf_tables_api.c:3420 (discriminator 7)) nf_tables
> 
> This is a _rcu notation which is not correct, while mutex is held, it
> was introduced here:
> 
> d9adf22a2918 ("netfilter: nf_tables: use call_rcu in netlink dumps")

Hm. There is also:

3cb03edb4de3 ("netfilter: nf_tables: Add locking for NFT_MSG_GETRULE_RESET requests")

this comment below is also not valid anymore:

/* called with rcu_read_lock held */
static struct sk_buff *
nf_tables_getrule_single(u32 portid, const struct nfnl_info *info,
                         const struct nlattr * const nla[], bool reset)

This is not the only spot that can trigger rcu splats.

  reply	other threads:[~2024-10-24 18:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 16:56 Netfilter: suspicious RCU usage in __nft_rule_lookup Matthieu Baerts
2024-10-24 17:35 ` Florian Westphal
2024-10-24 18:00   ` Pablo Neira Ayuso
2024-10-24 17:57 ` Pablo Neira Ayuso
2024-10-24 18:20   ` Pablo Neira Ayuso [this message]
2024-10-24 23:22     ` Florian Westphal
2024-10-25  8:14       ` Matthieu Baerts
2024-10-25  9:23         ` Florian Westphal
2024-10-25  9:42           ` Pablo Neira Ayuso
2024-10-25  9:46           ` Phil Sutter
2024-10-25 10:26             ` Pablo Neira Ayuso
2024-10-25 10:56               ` Phil Sutter
2024-10-25 11:43                 ` Pablo Neira Ayuso
2024-10-25 13:16                   ` Pablo Neira Ayuso
2024-10-25 10:35       ` 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=ZxqQAIlQx8C1E6FK@calendula \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --cc=matttbe@kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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.