[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d4ded39-d85d-7497-f0fb-af3df160b18b@gmail.com>
Date: Wed, 20 Jun 2018 11:15:31 -0600
From: David Ahern <dsahern@...il.com>
To: Kirill Tkhai <ktkhai@...tuozzo.com>, netdev@...r.kernel.org
Cc: davem@...emloft.net, daniel@...earbox.net,
jakub.kicinski@...ronome.com, ast@...nel.org,
linux@...musvillemoes.dk, john.fastabend@...il.com,
brouer@...hat.com
Subject: Re: [PATCH] net: Fix device name resolving crash in
default_device_exit()
On 6/20/18 2:57 AM, Kirill Tkhai wrote:
> From: Kirill Tkhai <ktkhai@...tuozzo.com>
>
> The following script makes kernel to crash since it can't obtain
> a name for a device, when the name is occupied by another device:
>
> #!/bin/bash
> ifconfig eth0 down
> ifconfig eth1 down
> index=`cat /sys/class/net/eth1/ifindex`
> ip link set eth1 name dev$index
> unshare -n sleep 1h &
> pid=$!
> while [[ "`readlink /proc/self/ns/net`" == "`readlink /proc/$pid/ns/net`" ]]; do continue; done
> ip link set dev$index netns $pid
> ip link set eth0 name dev$index
> kill -9 $pid
>
> Kernel messages:
>
> virtio_net virtio1 dev3: renamed from eth1
> virtio_net virtio0 dev3: renamed from eth0
> default_device_exit: failed to move dev3 to init_net: -17
> ------------[ cut here ]------------
> kernel BUG at net/core/dev.c:8978!
> invalid opcode: 0000 [#1] PREEMPT SMP
> CPU: 1 PID: 276 Comm: kworker/u8:3 Not tainted 4.17.0+ #292
> Workqueue: netns cleanup_net
> RIP: 0010:default_device_exit+0x9c/0xb0
> [stack trace snipped]
>
> This patch gives more variability during choosing new name
> of device and fixes the problem.
>
> Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
> ---
>
> Since there is no suggestions how to fix this in another way, I'm resending the patch.
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'.
The change does provide more variability in naming and reduces the
likelihood of not being able to push a device back to init_net.
Powered by blists - more mailing lists