netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Kirill Tkhai <ktkhai@virtuozzo.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, daniel@iogearbox.net,
	jakub.kicinski@netronome.com, ast@kernel.org,
	linux@rasmusvillemoes.dk, john.fastabend@gmail.com,
	brouer@redhat.com
Subject: Re: [PATCH] net: Fix device name resolving crash in default_device_exit()
Date: Wed, 20 Jun 2018 11:15:31 -0600	[thread overview]
Message-ID: <6d4ded39-d85d-7497-f0fb-af3df160b18b@gmail.com> (raw)
In-Reply-To: <88c1a635-4404-253b-6144-d7f3f9779531@virtuozzo.com>

On 6/20/18 2:57 AM, Kirill Tkhai wrote:
> From: Kirill Tkhai <ktkhai@virtuozzo.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@virtuozzo.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.

  reply	other threads:[~2018-06-20 17:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 12:38 [PATCH] net: Fix device name resolving crash in default_device_exit() Kirill Tkhai
2018-06-14 17:11 ` David Ahern
2018-06-15  9:44   ` Kirill Tkhai
2018-06-17 18:58     ` David Ahern
2018-06-18 11:21       ` Kirill Tkhai
2018-06-18 11:26         ` Kirill Tkhai
2018-06-20  8:57           ` Kirill Tkhai
2018-06-20 17:15             ` David Ahern [this message]
2018-06-21 10:03               ` Kirill Tkhai
2018-06-21 15:28                 ` David Ahern
2018-06-22  8:36                   ` Kirill Tkhai

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=6d4ded39-d85d-7497-f0fb-af3df160b18b@gmail.com \
    --to=dsahern@gmail.com \
    --cc=ast@kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux@rasmusvillemoes.dk \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).