On Mon, Jun 28, 2021 at 10:28:00PM -0000, Dan Streetman wrote:
> systemd doesn't use iproute2 tooling to set the altnames, it sets them
> directly with netlink.

You're right. The problem is that it does so w/ possibly uninitialized
memory. I added the following patch to demonstrate:

--- systemd-245.4.orig/src/udev/net/link-config.c
+++ systemd-245.4/src/udev/net/link-config.c
@@ -530,6 +530,7 @@ int link_config_apply(link_config_ctx *c
                                 assert_not_reached("invalid policy");
                         }
                         if (!isempty(n)) {
+                                log_debug("DANNF: adding altname %s", n);
                                 r = strv_extend(&altnames, n);
                                 if (r < 0)
                                         return log_oom();

Which logs the following:
DANNF: adding altname ��
DANNF: adding altname ��'���
DANNF: adding altname ��'���
DANNF: adding altname enp7s0v0

Which is because we never enter the preceding switch statement.

> what's the output from udevadm info for one of the affected interfaces?
> e.g.
> 
> $ udevadm info /sys/class/net/eno1v0

Here's the output from the interface with which I'm reproducing:

$ sudo udevadm info /sys/class/net/enp7s0v0 
P: 
/devices/pci0000:00/0000:00:0c.0/0000:04:00.0/0000:05:01.0/0000:07:00.1/net/enp7s0v0
L: 0
E: 
DEVPATH=/devices/pci0000:00/0000:00:0c.0/0000:04:00.0/0000:05:01.0/0000:07:00.1/net/enp7s0v0
E: INTERFACE=enp7s0v0
E: IFINDEX=19
E: SUBSYSTEM=net
E: USEC_INITIALIZED=59449992522
E: ID_MM_CANDIDATE=1
E: ID_NET_NAMING_SCHEME=v245
E: ID_NET_NAME_PATH=enp7s0v0
E: ID_BUS=pci
E: ID_VENDOR_ID=0x19e5
E: ID_MODEL_ID=0x375e
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Huawei Technologies Co., Ltd.
E: ID_MODEL_FROM_DATABASE=Hi1822 Family Virtual Function
E: ID_PATH=pci-0000:07:00.1
E: ID_PATH_TAG=pci-0000_07_00_1
E: ID_NET_DRIVER=hinic
E: ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
E: ID_NET_NAME=enp7s0v0
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp7s0v0 
/sys/subsystem/net/devices/enp7s0v0
E: TAGS=:systemd:

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1933402

Title:
  net card set VF  and altname display blurred  character

Status in kunpeng920:
  New
Status in kunpeng920 ubuntu-20.04-hwe series:
  New
Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Focal:
  Fix Committed
Status in systemd source package in Groovy:
  Fix Released
Status in systemd source package in Hirsute:
  Fix Released
Status in systemd source package in Impish:
  Fix Released

Bug description:
  [Impact]
  When running with the HWE kernel (5.4 didn't support altnames), altnames 
containing garbage (uninitialized memory) may get assigned to a NIC. This is 
100% reproducible on arm64. The upstream commit message suggests that this has 
been seen to cause segfaults.

  [Test Case]
  1) echo 1 > /sys/class/net/enp189s0f0/device/sriov_numvfs
  2) ip a
  3)
  10: eno1v0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group 
default qlen 1000
      link/ether 1e:d8:e1:e9:ae:25 brd ff:ff:ff:ff:ff:ff
      altname @▒ު▒
      altname enp125s0f0v0
  11: enp189s0f0v0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group 
default qlen 1000
      link/ether 76:ea:f4:65:dd:33 brd ff:ff:ff:ff:ff:ff
      altname ▒b▒ު▒
      altname ▒▒▒▒▒▒

  [Fix]
  There's a one liner upstream fix that simply initializes a variable:
  
https://github.com/systemd/systemd/commit/61fd7d6720c562c88ab79062ff8d131e5e3c7b1b

  [What Could Go Wrong]
  The fix itself is innocuous - just initializing a variable to NULL. So the 
real risk here would seem to be limited to the common risks in updating a core 
package in the Ubuntu distribution.

To manage notifications about this bug go to:
https://bugs.launchpad.net/kunpeng920/+bug/1933402/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to