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] [thread-next>] [day] [month] [year] [list]
Message-ID: <25a2266c-8ae4-41f5-9b80-beaf174043d1@intel.com>
Date: Thu, 28 Mar 2024 15:57:29 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Breno Leitao <leitao@...ian.org>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	<quic_jjohnson@...cinc.com>, <kvalo@...nel.org>, <leon@...nel.org>,
	<dennis.dalessandro@...nelisnetworks.com>, Jiri Pirko <jiri@...nulli.us>,
	Simon Horman <horms@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
	Lorenzo Bianconi <lorenzo@...nel.org>, Coco Li <lixiaoyan@...gle.com>, "open
 list:NETWORKING DRIVERS" <netdev@...r.kernel.org>, open list
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: create a dummy net_device allocator

From: Jakub Kicinski <kuba@...nel.org>
Date: Wed, 27 Mar 2024 16:17:31 -0700

> On Wed, 27 Mar 2024 13:08:04 -0700 Breno Leitao wrote:
>> It is impossible to use init_dummy_netdev together with alloc_netdev()
>> as the 'setup' argument.
>>
>> This is because alloc_netdev() initializes some fields in the net_device
>> structure, and later init_dummy_netdev() memzero them all. This causes
>> some problems as reported here:
>>
>> 	https://lore.kernel.org/all/20240322082336.49f110cc@kernel.org/
>>
>> Split the init_dummy_netdev() function in two. Create a new function called
>> init_dummy_netdev_core() that does not memzero the net_device structure.
>> Then have init_dummy_netdev() memzero-ing and calling
>> init_dummy_netdev_core(), keeping the old behaviour.
>>
>> init_dummy_netdev_core() is the new function that could be called as an
>> argument for alloc_netdev().
>>
>> Also, create a helper to allocate and initialize dummy net devices,
>> leveraging init_dummy_netdev_core() as the setup argument. This function
>> basically simplify the allocation of dummy devices, by allocating and
>> initializing it. Freeing the device continue to be done through
>> free_netdev()
> 
> Ah, but you need to make it part of the series with some caller.
> Maybe convert all the ethernet ones?
> 
> $ git grep 'struct net_device [^*]*;' -- drivers/net/ethernet/
> drivers/net/ethernet/cavium/thunder/thunder_bgx.c:      struct net_device       netdev;
> drivers/net/ethernet/marvell/prestera/prestera_rxtx.c:  struct net_device napi_dev;
> drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c:static struct net_device test_netdev = {};
> drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c:static struct net_device test_netdev = {};

There are much more of them unfortunately. Pretty much every user of
init_dummy_netdev()[0].

I would prefer *replacing* init_dummy_netdev() with
alloc_dummy_netdev(), so that we'll be sure there are no embedded
&net_devices and we can use a proper flex array there.

[0] https://elixir.bootlin.com/linux/v6.9-rc1/A/ident/init_dummy_netdev

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ