lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210303211657.gyampnzyhqjaim5i@pengutronix.de>
Date:   Wed, 3 Mar 2021 22:16:57 +0100
From:   Marc Kleine-Budde <mkl@...gutronix.de>
To:     Martin Willi <martin@...ongswan.org>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Wolfgang Grandegger <wg@...ndegger.com>,
        netdev@...r.kernel.org, linux-can@...r.kernel.org
Subject: Re: [PATCH net] can: dev: Move device back to init netns on owning
 netns delete

On 02.03.2021 13:24:23, Martin Willi wrote:
> When a non-initial netns is destroyed, the usual policy is to delete
> all virtual network interfaces contained, but move physical interfaces
> back to the initial netns. This keeps the physical interface visible
> on the system.
> 
> CAN devices are somewhat special, as they define rtnl_link_ops even
> if they are physical devices. If a CAN interface is moved into a
> non-initial netns, destroying that netns lets the interface vanish
> instead of moving it back to the initial netns. default_device_exit()
> skips CAN interfaces due to having rtnl_link_ops set. Reproducer:
> 
>   ip netns add foo
>   ip link set can0 netns foo
>   ip netns delete foo
> 
> WARNING: CPU: 1 PID: 84 at net/core/dev.c:11030 ops_exit_list+0x38/0x60
> CPU: 1 PID: 84 Comm: kworker/u4:2 Not tainted 5.10.19 #1
> Workqueue: netns cleanup_net
> [<c010e700>] (unwind_backtrace) from [<c010a1d8>] (show_stack+0x10/0x14)
> [<c010a1d8>] (show_stack) from [<c086dc10>] (dump_stack+0x94/0xa8)
> [<c086dc10>] (dump_stack) from [<c086b938>] (__warn+0xb8/0x114)
> [<c086b938>] (__warn) from [<c086ba10>] (warn_slowpath_fmt+0x7c/0xac)
> [<c086ba10>] (warn_slowpath_fmt) from [<c0629f20>] (ops_exit_list+0x38/0x60)
> [<c0629f20>] (ops_exit_list) from [<c062a5c4>] (cleanup_net+0x230/0x380)
> [<c062a5c4>] (cleanup_net) from [<c0142c20>] (process_one_work+0x1d8/0x438)
> [<c0142c20>] (process_one_work) from [<c0142ee4>] (worker_thread+0x64/0x5a8)
> [<c0142ee4>] (worker_thread) from [<c0148a98>] (kthread+0x148/0x14c)
> [<c0148a98>] (kthread) from [<c0100148>] (ret_from_fork+0x14/0x2c)
> 
> To properly restore physical CAN devices to the initial netns on owning
> netns exit, introduce a flag on rtnl_link_ops that can be set by drivers.
> For CAN devices setting this flag, default_device_exit() considers them
> non-virtual, applying the usual namespace move.
> 
> The issue was introduced in the commit mentioned below, as at that time
> CAN devices did not have a dellink() operation.
> 
> Fixes: e008b5fc8dc7 ("net: Simplfy default_device_exit and improve batching.")
> Signed-off-by: Martin Willi <martin@...ongswan.org>

applied to linux-can/testing

Thanks,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ