From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH] net: Fix device name resolving crash in default_device_exit() Date: Thu, 21 Jun 2018 09:28:21 -0600 Message-ID: <5e4b9ecd-e7f5-87e4-2b45-2aaaca125442@gmail.com> References: <152897987484.3952.9263337756183251797.stgit@localhost.localdomain> <3c024347-a60e-69aa-42c9-fcb6244642cb@gmail.com> <25e1a375-051c-54f4-d5cb-677e281107fb@virtuozzo.com> <70df65eb-3ef6-20ca-be07-8d73e4e63bea@virtuozzo.com> <88c1a635-4404-253b-6144-d7f3f9779531@virtuozzo.com> <6d4ded39-d85d-7497-f0fb-af3df160b18b@gmail.com> <84f7019b-c1cb-9851-2ece-aa2e16d8d297@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, daniel@iogearbox.net, jakub.kicinski@netronome.com, ast@kernel.org, linux@rasmusvillemoes.dk, john.fastabend@gmail.com, brouer@redhat.com To: Kirill Tkhai , netdev@vger.kernel.org Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:40706 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933287AbeFUP2Y (ORCPT ); Thu, 21 Jun 2018 11:28:24 -0400 Received: by mail-pf0-f193.google.com with SMTP id z24-v6so1712248pfe.7 for ; Thu, 21 Jun 2018 08:28:24 -0700 (PDT) In-Reply-To: <84f7019b-c1cb-9851-2ece-aa2e16d8d297@virtuozzo.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 6/21/18 4:03 AM, Kirill Tkhai wrote: >> This patch does not remove the BUG, so does not really solve the >> problem. ie., it is fairly trivial to write a script (32k dev%d named >> devices in init_net) that triggers it again, so your commit subject and >> commit log are not correct with the references to 'fixing the problem'. > > 1)I'm not agree with you and I don't think removing the BUG() is a good idea. > This function is called from the place, where it must not fail. But it can > fail, and the problem with name is not the only reason of this happens. > We can't continue further pernet_operations in case of a problem happened > in default_device_exit(), and we can't remove the BUG() before this function > becomes of void type. But we are not going to make it of void type. So > we can't remove the BUG(). You missed my point: that the function can still fail means you are not "fixing" the problem, only delaying it. > > 2)In case of the script is trivial, can't you just post it here to show > what type of devices you mean? Is there real problem or this is > a theoretical thinking? Current code: # ip li sh dev eth2 4: eth2: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 02:e0:f9:46:64:80 brd ff:ff:ff:ff:ff:ff # ip netns add fubar # ip li set eth2 netns fubar # ip li add eth2 type dummy # ip li add dev4 type dummy # ip netns del fubar --> BUG kernel:[78079.127748] default_device_exit: failed to move eth2 to init_net: -17 With your patch: # ip li sh dev eth2 4: eth2: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 02:e0:f9:46:64:80 brd ff:ff:ff:ff:ff:ff # ip netns add fubar # ip li set eth2 netns fubar # ip li add eth2 type dummy # for n in $(seq 0 $((32*1024))); do echo "li add dev${n} type dummy" done > ip.batch # ip -batch ip.batch # ip netns del fubar --> BUG kernel:[ 25.800024] default_device_exit: failed to move eth2 to init_net: -17 > > All virtual devices I see have rtnl_link_ops, so that they just destroyed > in default_device_exit_batch(). According to physical devices, it's difficult > to imagine a node with 32k physical devices, and if someone tried to deploy > them it may meet problems not only in this place. Nothing says it has to be a physical device. It is only checking for a name. > >> The change does provide more variability in naming and reduces the >> likelihood of not being able to push a device back to init_net. > > No, it provides. With the patch one may move real device to a container, > and allow to do with the device anything including changing of device > index. Then, the destruction of the container does not resilt a kernel > panic just because of two devices have the same index. > > Kirill >