From: Florian Westphal <fw@strlen.de>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Josh Hunt <johunt@akamai.com>,
herbert@gondor.apana.org.au, David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>, Florian Westphal <fw@strlen.de>
Subject: Re: crash in __xfrm_state_lookup on 4.19 LTS
Date: Fri, 13 Dec 2019 11:25:12 +0100 [thread overview]
Message-ID: <20191213102512.GP795@breakpoint.cc> (raw)
In-Reply-To: <20191213072144.GC26283@gauss3.secunet.de>
Steffen Klassert <steffen.klassert@secunet.com> wrote:
> > index f3423562d933..c3d7df1387c8 100644
> > --- a/net/xfrm/xfrm_state.c
> > +++ b/net/xfrm/xfrm_state.c
> > @@ -1730,9 +1730,9 @@ xfrm_state_lookup(struct net *net, u32 mark, const
> > xfrm_address_t *daddr, __be32
> > {
> > struct xfrm_state *x;
> >
> > - rcu_read_lock();
> > + spin_lock_bh(&net->xfrm.xfrm_state_lock);
> > x = __xfrm_state_lookup(net, mark, daddr, spi, proto, family);
> > - rcu_read_unlock();
> > + spin_unlock_bh(&net->xfrm.xfrm_state_lock);
> > return x;
> > }
>
> While that could fix it, it adds a global list lock
> to the packet path and reverts:
>
> commit c2f672fc94642bae96821a393f342edcfa9794a6
> xfrm: state lookup can be lockless
>
> I've Cced Florian who did that change.
>
> I thought to do a rcu_read_lock_bh(), but in between I think
> it would make the problem just less likely to occur.
>
> We destroy the states with a workqueue by doing schedule_work().
> I think we should better use call_rcu to make sure that a
> rcu grace period has elapsed before the states are destroyed.
xfrm_state_gc_task calls synchronize_rcu after stealing the gc list and
before destroying those states, so I don't think this is a problem.
next prev parent reply other threads:[~2019-12-13 10:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 22:52 crash in __xfrm_state_lookup on 4.19 LTS Josh Hunt
2019-12-12 13:21 ` Steffen Klassert
2019-12-12 20:44 ` Josh Hunt
2019-12-13 7:21 ` Steffen Klassert
2019-12-13 10:25 ` Florian Westphal [this message]
2019-12-13 11:13 ` Steffen Klassert
2019-12-16 20:34 ` Josh Hunt
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=20191213102512.GP795@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=johunt@akamai.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.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