From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Florian Westphal <fw@strlen.de>,
NetFilter <netfilter-devel@vger.kernel.org>,
syzbot <syzbot+d195fd3b9a364ddd6731@syzkaller.appspotmail.com>
Subject: Re: [Patch nf] netfilter: xt_hashlimit: unregister proc file before releasing mutex
Date: Wed, 26 Feb 2020 20:14:25 +0100 [thread overview]
Message-ID: <20200226191425.3h2i3rn4xdanzfde@salvia> (raw)
In-Reply-To: <20200226181106.ekb2mpmtgbxrpepz@salvia>
On Wed, Feb 26, 2020 at 07:11:06PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Feb 19, 2020 at 07:32:13PM -0800, Cong Wang wrote:
> > On Tue, Feb 18, 2020 at 2:05 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > >
> > > On Tue, Feb 18, 2020 at 01:40:26PM -0800, Cong Wang wrote:
> > > > On Tue, Feb 18, 2020 at 1:35 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > >
> > > > > On Wed, Feb 12, 2020 at 10:53:52PM -0800, Cong Wang wrote:
> > > > > > Before releasing the global mutex, we only unlink the hashtable
> > > > > > from the hash list, its proc file is still not unregistered at
> > > > > > this point. So syzbot could trigger a race condition where a
> > > > > > parallel htable_create() could register the same file immediately
> > > > > > after the mutex is released.
> > > > > >
> > > > > > Move htable_remove_proc_entry() back to mutex protection to
> > > > > > fix this. And, fold htable_destroy() into htable_put() to make
> > > > > > the code slightly easier to understand.
> > > > >
> > > > > Probably revert previous one?
> > > >
> > > > The hung task could appear again if we move the cleanup
> > > > back under mutex.
> > >
> > > How could the hung task appear again by reverting
> > > c4a3922d2d20c710f827? Please elaborate.
> >
> > Because the cfg.max could be as large as 8*HASHLIMIT_MAX_SIZE:
> >
> > 311 if (hinfo->cfg.max == 0)
> > 312 hinfo->cfg.max = 8 * hinfo->cfg.size;
> > 313 else if (hinfo->cfg.max < hinfo->cfg.size)
> > 314 hinfo->cfg.max = hinfo->cfg.size;
> >
> > Not sure whether we can finish cleaning up 8*HASHLIMIT_MAX_SIZE
> > entries within the time a hung task tolerates. This largely depends on
> > how much contention the spinlock has, at least I don't want to bet
> > on it.
>
> Please, resend. Thanks.
Sorry, I meant, applied, thanks.
prev parent reply other threads:[~2020-02-26 19:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 6:53 [Patch nf] netfilter: xt_hashlimit: unregister proc file before releasing mutex Cong Wang
2020-02-18 21:35 ` Pablo Neira Ayuso
2020-02-18 21:40 ` Cong Wang
2020-02-18 22:05 ` Pablo Neira Ayuso
2020-02-20 3:32 ` Cong Wang
2020-02-26 18:11 ` Pablo Neira Ayuso
2020-02-26 19:14 ` Pablo Neira Ayuso [this message]
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=20200226191425.3h2i3rn4xdanzfde@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=syzbot+d195fd3b9a364ddd6731@syzkaller.appspotmail.com \
--cc=xiyou.wangcong@gmail.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