netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de, dvyukov@google.com
Subject: Re: [PATCH nf,v2] netfilter: nftables: accept all dummy chain when table is dormant
Date: Wed, 19 May 2021 14:15:33 +0200	[thread overview]
Message-ID: <20210519121533.GC8317@breakpoint.cc> (raw)
In-Reply-To: <20210519101402.45141-1-pablo@netfilter.org>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> The dormant flag need to be updated from the preparation phase,
> otherwise, two consecutive requests to dorm a table in the same batch
> might try to remove the same hooks twice, resulting in the following
> warning:
> 
>  hook not found, pf 3 num 0
>  WARNING: CPU: 0 PID: 334 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
>  Modules linked in:
>  CPU: 0 PID: 334 Comm: kworker/u4:5 Not tainted 5.12.0-syzkaller #0
>  Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
>  Workqueue: netns cleanup_net
>  RIP: 0010:__nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
> 
> This patch is a partial revert of 0ce7cf4127f1 ("netfilter: nftables:
> update table flags from the commit phase") to restore the previous
> behaviour, which updates the dormant flag from the preparation phase
> to address this issue.
> 
> However, there is still another problem: A batch containing a series of
> dorm-wakeup-dorm table and vice-versa also trigger the warning above
> since hook unregistration happens from the preparation phase, while hook
> registration occurs from the commit phase.

You could add nf_unregister_net_hook_try() or somesuch that elides
the WARN().

AFAIU this would not be needed at all if the WARN would not exist.
We could also just remove the WARN but it did catch the earlier
NFPROTO_ARP bug, so I would refer to keep it.

  reply	other threads:[~2021-05-19 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 10:14 [PATCH nf,v2] netfilter: nftables: accept all dummy chain when table is dormant Pablo Neira Ayuso
2021-05-19 12:15 ` Florian Westphal [this message]
2021-05-19 15:56   ` Pablo Neira Ayuso
2021-05-19 18:34     ` Florian Westphal
2021-05-20 22:50       ` Pablo Neira Ayuso
2021-05-21  9:28         ` 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=20210519121533.GC8317@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=dvyukov@google.com \
    --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 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 NNTP newsgroup(s).