From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, Yi Chen <yiche@redhat.com>
Subject: Re: [PATCH nf] netfilter: nfnetlink_queue: fix rcu splat on program exit
Date: Tue, 14 May 2024 13:34:57 +0200 [thread overview]
Message-ID: <ZkNMYQ1u2zJhlviL@calendula> (raw)
In-Reply-To: <20240514103133.2784-1-fw@strlen.de>
Hi Florian,
On Tue, May 14, 2024 at 12:31:30PM +0200, Florian Westphal wrote:
> If userspace program exits while the queue its subscribed to has packets
> available we get following (harmless) RCU splat:
>
> net/netfilter/nfnetlink_queue.c:261 suspicious rcu_dereference_check() usage!
> other info that might help us debug this:
> rcu_scheduler_active = 2, debug_locks = 1
> 2 locks held by swapper/0/0:
> #0: (rcu_callback){....}-{0:0}, at: rcu_core
> #1: (&inst->lock){+.-.}-{3:3}, at: instance_destroy_rcu
> [..] Call Trace:
> lockdep_rcu_suspicious+0x1ab/0x250
> nfqnl_reinject+0x5d3/0xfb0
> instance_destroy_rcu+0x1b5/0x220
> rcu_core+0xe32 [..]
>
> This is harmless because the incorrectly-obtained pointer will not be
> dereferenced in case nfqnl_reinject is called with NF_DROP verdict.
>
> Fix this by open-coding skb+entry release without going through
> nfqnl_reinject(). kfree_skb+release_ref is exactly what nfql_reinject
> ends up doing when called with NF_DROP, except that it also does a
> truckload of other things that are irrelevant for DROP.
>
> A similar warning can be triggered by flushing the ruleset while
> packets are being reinjected.
>
> This is harmless as well, the WARN_ON_ONCE() should be removed.
>
> Reported-by: Yi Chen <yiche@redhat.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> Due to MR cloed this patch is actually vs nf-next tree.
> It will also conflict with the pending sctp checksum patch
> from Antonio Ojea (nft_queue.sh), I can resend if needed once
> Antonios patch is applied (conflict resulution is simple: use
> both changes).
I can route this through nf.git and deal with conflict resolution if
you prefer it that way.
Thanks.
next prev parent reply other threads:[~2024-05-14 11:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 10:31 [PATCH nf] netfilter: nfnetlink_queue: fix rcu splat on program exit Florian Westphal
2024-05-14 11:34 ` Pablo Neira Ayuso [this message]
2024-05-14 11:43 ` 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=ZkNMYQ1u2zJhlviL@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=yiche@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).