From: Steffen Klassert <steffen.klassert@secunet.com>
To: Dan Streetman <dan.streetman@canonical.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Dan Streetman <ddstreet@ieee.org>
Subject: Re: [PATCHv3] xfrm: dst_entries_init() per-net dst_ops
Date: Tue, 3 Nov 2015 14:22:32 +0100 [thread overview]
Message-ID: <20151103132232.GQ7701@secunet.com> (raw)
In-Reply-To: <1446126676-7242-1-git-send-email-dan.streetman@canonical.com>
On Thu, Oct 29, 2015 at 09:51:16AM -0400, Dan Streetman wrote:
> Remove the dst_entries_init/destroy calls for xfrm4 and xfrm6 dst_ops
> templates; their dst_entries counters will never be used. Move the
> xfrm dst_ops initialization from the common xfrm/xfrm_policy.c to
> xfrm4/xfrm4_policy.c and xfrm6/xfrm6_policy.c, and call dst_entries_init
> and dst_entries_destroy for each net namespace.
>
> The ipv4 and ipv6 xfrms each create dst_ops template, and perform
> dst_entries_init on the templates. The template values are copied to each
> net namespace's xfrm.xfrm*_dst_ops. The problem there is the dst_ops
> pcpuc_entries field is a percpu counter and cannot be used correctly by
> simply copying it to another object.
>
> The result of this is a very subtle bug; changes to the dst entries
> counter from one net namespace may sometimes get applied to a different
> net namespace dst entries counter. This is because of how the percpu
> counter works; it has a main count field as well as a pointer to the
> percpu variables. Each net namespace maintains its own main count
> variable, but all point to one set of percpu variables. When any net
> namespace happens to change one of the percpu variables to outside its
> small batch range, its count is moved to the net namespace's main count
> variable. So with multiple net namespaces operating concurrently, the
> dst_ops entries counter can stray from the actual value that it should
> be; if counts are consistently moved from one net namespace to another
> (which my testing showed is likely), then one net namespace winds up
> with a negative dst_ops count while another winds up with a continually
> increasing count, eventually reaching its gc_thresh limit, which causes
> all new traffic on the net namespace to fail with -ENOBUFS.
>
> Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
> Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Applied to the ipsec tree, thanks Dan!
prev parent reply other threads:[~2015-11-03 13:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 16:15 [PATCH] xfrm: dst_entries_init() per-net dst_ops dan.streetman
2015-10-28 13:32 ` Dan Streetman
2015-10-28 13:42 ` Hannes Frederic Sowa
2015-10-28 15:09 ` Dan Streetman
2015-10-28 14:07 ` David Miller
2015-10-29 11:29 ` [PATCHv2] " Dan Streetman
2015-10-29 11:57 ` kbuild test robot
2015-10-29 13:46 ` Dan Streetman
2015-10-29 13:51 ` [PATCHv3] " Dan Streetman
2015-11-03 13:22 ` Steffen Klassert [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=20151103132232.GQ7701@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=dan.streetman@canonical.com \
--cc=davem@davemloft.net \
--cc=ddstreet@ieee.org \
--cc=hannes@stressinduktion.org \
--cc=herbert@gondor.apana.org.au \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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