From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: David Miller <davem@davemloft.net>
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de,
daniel@iogearbox.net, jakub.kicinski@netronome.com,
ast@kernel.org, brouer@redhat.com, linux@rasmusvillemoes.dk,
john.fastabend@gmail.com, dsahern@gmail.com,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org
Subject: Re: [PATCH net-next 0/3] Close race between {un, }register_netdevice_notifier and pernet_operations
Date: Fri, 30 Mar 2018 18:01:24 +0300 [thread overview]
Message-ID: <8c9717e3-3388-9f88-7de6-ce7b201aff77@virtuozzo.com> (raw)
In-Reply-To: <20180330.110012.2226179718404929635.davem@davemloft.net>
On 30.03.2018 18:00, David Miller wrote:
> From: Kirill Tkhai <ktkhai@virtuozzo.com>
> Date: Thu, 29 Mar 2018 17:03:15 +0300
>
>> the problem is {,un}register_netdevice_notifier() do not take
>> pernet_ops_rwsem, and they don't see network namespaces, being
>> initialized in setup_net() and cleanup_net(), since at this
>> time net is not hashed to net_namespace_list.
>>
>> This may lead to imbalance, when a notifier is called at time of
>> setup_net()/net is alive, but it's not called at time of cleanup_net(),
>> for the devices, hashed to the net, and vise versa. See (3/3) for
>> the scheme of imbalance.
>>
>> This patchset fixes the problem by acquiring pernet_ops_rwsem
>> at the time of {,un}register_netdevice_notifier() (3/3).
>> (1-2/3) are preparations in xfrm and netfilter subsystems.
>>
>> The problem was introduced a long ago, but backporting won't be easy,
>> since every previous kernel version may have changes in netdevice
>> notifiers, and they all need review and testing. Otherwise, there
>> may be more pernet_operations, which register or unregister
>> netdevice notifiers, and that leads to deadlock (which is was fixed
>> in 1-2/3). This patchset is for net-next.
>
> I am applying this series and skipping the rwsem revert.
>
> Thanks Kirill.
Thanks, David.
I'll send the fixing patch soon today.
Kirill
prev parent reply other threads:[~2018-03-30 15:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 14:03 [PATCH net-next 0/3] Close race between {un, }register_netdevice_notifier and pernet_operations Kirill Tkhai
2018-03-29 14:03 ` [PATCH net-next 1/3] xfrm: Register xfrm_dev_notifier in appropriate place Kirill Tkhai
2018-03-29 14:03 ` [PATCH net-next 2/3] netfilter: Rework xt_TEE netdevice notifier Kirill Tkhai
2018-03-30 9:47 ` Pablo Neira Ayuso
2018-03-29 14:03 ` [PATCH net-next 3/3] net: Close race between {un, }register_netdevice_notifier() and setup_net()/cleanup_net() Kirill Tkhai
2018-03-30 15:00 ` [PATCH net-next 0/3] Close race between {un, }register_netdevice_notifier and pernet_operations David Miller
2018-03-30 15:01 ` Kirill Tkhai [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=8c9717e3-3388-9f88-7de6-ce7b201aff77@virtuozzo.com \
--to=ktkhai@virtuozzo.com \
--cc=ast@kernel.org \
--cc=brouer@redhat.com \
--cc=coreteam@netfilter.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=kadlec@blackhole.kfki.hu \
--cc=linux@rasmusvillemoes.dk \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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