From: Greg KH <greg@kroah.com>
To: Alakesh Haloi <alakeshh@amazon.com>
Cc: stable@vger.kernel.org, Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
Florian Westphal <fw@strlen.de>,
"David S. Miller" <davem@davemloft.net>,
Dmitry Andrianov <dmitry.andrianov@alertme.com>,
Justin Pettit <jpettit@vmware.com>,
Yi-Hung Wei <yihung.wei@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v3] netfilter: xt_connlimit: fix race in connection counting
Date: Thu, 10 Jan 2019 20:19:09 +0100 [thread overview]
Message-ID: <20190110191909.GG18221@kroah.com> (raw)
In-Reply-To: <20190103002839.GA111435@dev-dsk-alakeshh-2c-f8a3e6e0.us-west-2.amazon.com>
On Thu, Jan 03, 2019 at 12:28:46AM +0000, Alakesh Haloi wrote:
> commit b36e4523d4d5 ("netfilter: nf_conncount: fix garbage collection confirm
> race")
>
> An iptable rule like the following on a multicore systems will result in
> accepting more connections than set in the rule.
>
> iptables -A INPUT -p tcp -m tcp --syn --dport 7777 -m connlimit \
> --connlimit-above 2000 --connlimit-mask 0 -j DROP
>
> In check_hlist function, connections that are found in saved connections
> but not in netfilter conntrack are deleted, assuming that those
> connections do not exist anymore. But for multi core systems, there exists
> a small time window, when a connection has been added to the xt_connlimit
> maintained rb-tree but has not yet made to netfilter conntrack table. This
> causes concurrent connections to return incorrect counts and go over limit
> set in iptable rule.
>
> The fix has been partially backported from the above mentioned upstream
> commit. Introduce timestamp and the owning cpu.
>
> Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: stable@vger.kernel.org # v4.15 and before
But 4.14.92 already b36e4523d4d5 ("netfilter: nf_conncount: fix garbage
collection confirm race") and 4cd273bb91b3 ("netfilter: nf_conncount:
don't skip eviction when age is negative") in it. Are you sure you
still need this patch?
thanks,
greg k-h
next prev parent reply other threads:[~2019-01-10 19:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 0:28 [PATCH v3] netfilter: xt_connlimit: fix race in connection counting Alakesh Haloi
2019-01-10 19:19 ` Greg KH [this message]
2019-01-10 19:19 ` Greg KH
2019-01-10 19:27 ` Alakesh Haloi
2019-01-10 19:27 ` Alakesh Haloi
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=20190110191909.GG18221@kroah.com \
--to=greg@kroah.com \
--cc=alakeshh@amazon.com \
--cc=davem@davemloft.net \
--cc=dmitry.andrianov@alertme.com \
--cc=fw@strlen.de \
--cc=jpettit@vmware.com \
--cc=kadlec@blackhole.kfki.hu \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=stable@vger.kernel.org \
--cc=yihung.wei@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;
as well as URLs for NNTP newsgroup(s).