Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-14964

IFLA_INFO_KIND is not NULL terminated

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • iproute
    • None
    • None
    • Moderate
    • rhel-sst-networking-core
    • ssg_networking
    • 3
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      Everything works. Just cosmetic.

      In kernel, the `IFLA_INFO_KIND` is NULL terminated string.

      But when running `ip link add veth1 type veth peer veth1-ep`, the netlink message iproute generated is using NULL terminating the `IFLA_INFO_KIND`.

      This is the hexdump of `nlmon`:

      0000   00 04 03 38 00 00 00 00 00 00 00 00 00 00 00 00
      0010   60 00 00 00 10 00 05 06 f5 41 3e 65 00 00 00 00
      0020   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0030   0a 00 03 00 76 65 74 68 31 00 00 00 34 00 12 00
      0040   08 00 01 00 76 65 74 68 28 00 02 00 24 00 01 00 
      0050   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0060   0d 00 03 00 76 65 74 68 31 2d 65 70 00 00 00 00
      
      

      The `08 00 01 00 76 75 74 68` means length 8, IFLA_INFO_KIND, `veth`, no NULL terminator.

      Please provide the package NVR for which bug is seen:

      iproute-6.2.0-5.el9.x86_64

      How reproducible:

      100%

      Steps to reproduce

      1. sudo strace -s 1000 -f ip link add veth1 type veth peer veth1-ep

      Expected results

      [{nla_len=9, nla_type=IFLA_INFO_KIND}, "veth"...]
      

      Actual results

      [{nla_len=8, nla_type=IFLA_INFO_KIND}, "veth"...]
      

      Extra info:

      The `ip/iplink.c` function `iplink_modify()` is the place to fix.

      This works because kernel is storing it into a bigger buffer with all zero:

      char kind[MODULE_NAME_LEN];
      nla_strscpy(kind, linfo[IFLA_INFO_KIND], sizeof(kind));
      

      This is cosmetic bug with very simple fix, create bug instead of patch just because I don't know how to contribute to iproute upstream.

              rh-ee-aclaudi Andrea Claudi
              fge@redhat.com Gris Ge
              Andrea Claudi Andrea Claudi
              Mingyu Shi Mingyu Shi
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: