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: <d5e9f50a-c3bd-4071-9de8-cc22cd0f5cfc@huawei.com>
Date: Thu, 1 Aug 2024 20:33:38 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Andrew Lunn <andrew@...n.ch>
CC: <shaojijie@...wei.com>, <yisen.zhuang@...wei.com>,
	<salil.mehta@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <horms@...nel.org>,
	<shenjian15@...wei.com>, <wangpeiyang1@...wei.com>, <liuyonglong@...wei.com>,
	<sudongming1@...wei.com>, <xujunsheng@...wei.com>, <shiyongbang@...wei.com>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH net-next 05/10] net: hibmcge: Implement some .ndo
 functions


on 2024/8/1 20:18, Andrew Lunn wrote:
> On Thu, Aug 01, 2024 at 05:13:33PM +0800, Jijie Shao wrote:
>> on 2024/8/1 8:51, Andrew Lunn wrote:
>>>> +static int hbg_net_set_mac_address(struct net_device *dev, void *addr)
>>>> +{
>>>> +	struct hbg_priv *priv = netdev_priv(dev);
>>>> +	u8 *mac_addr;
>>>> +
>>>> +	mac_addr = ((struct sockaddr *)addr)->sa_data;
>>>> +	if (ether_addr_equal(dev->dev_addr, mac_addr))
>>>> +		return 0;
>>>> +
>>>> +	if (!is_valid_ether_addr(mac_addr))
>>>> +		return -EADDRNOTAVAIL;
>>> How does the core pass you an invalid MAC address?
>> According to my test,
>> in the 6.4 rc4 kernel version, invalid mac address is allowed to be configured.
>> An error is reported only when ifconfig ethx up.
> Ah, interesting.
>
> I see a test in __dev_open(), which is what you are saying here. But i
> would also expect a test in rtnetlink, or maybe dev_set_mac_address().
> We don't want every driver having to repeat this test in their
> .ndo_set_mac_address, when it could be done once in the core.
>
> 	Andrew

Hi:
I did the following test on my device:

insmod hibmcge.ko
hibmcge: no symbol version for module_layout
hibmcge: loading out-of-tree module taints kernel.
hibmcge: module verification failed: signature and/or required key missing - tainting kernel
hibmcge 0000:83:00.1: enabling device (0140 -> 0142)
Generic PHY mii-0000:83:00.1:02: attached PHY driver (mii_bus:phy_addr=mii-0000:83:00.1:02, irq=POLL)
hibmcge 0000:83:00.1 enp131s0f1: renamed from eth0
IPv6: ADDRCONF(NETDEV_CHANGE): enp131s0f1: link becomes ready
hibmcge 0000:83:00.1: link up!

ifconfig enp131s0f1 hw ether FF:FF:FF:FF:FF:FF

ip a
6: enp131s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
     link/ether ff:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff permaddr 08:02:00:00:08:08
     
ifconfig enp131s0f1 up
ifconfig enp131s0f1 down up
SIOCSIFFLAGS: Cannot assign requested address
hibmcge 0000:83:00.1: link down!

uname -a
Linux localhost.localdomain 6.4.0+ #1 SMP Fri Mar 15 14:44:20 CST 2024 aarch64 aarch64 aarch64 GNU/Linux



So I'm not sure what's wrong. I also implemented ndo_validate_addr by eth_validate_addr.

Thanks

Jijie Shao


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ