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: <CANn89i+CvOVkaiXuO5vgggHdzVP17Yzw1WaiH93-fjf2cqnN_A@mail.gmail.com>
Date: Wed, 21 Feb 2024 18:15:11 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next 12/13] rtnetlink: make rtnl_fill_link_ifmap() RCU ready

On Wed, Feb 21, 2024 at 5:03 PM Jiri Pirko <jiri@...nulli.us> wrote:
>
> Wed, Feb 21, 2024 at 11:59:14AM CET, edumazet@...gle.com wrote:
> >Use READ_ONCE() to read the following device fields:
> >
> >       dev->mem_start
> >       dev->mem_end
> >       dev->base_addr
> >       dev->irq
> >       dev->dma
> >       dev->if_port
> >
> >Provide IFLA_MAP attribute only if at least one of these fields
> >is not zero. This saves some space in the output skb for most devices.
> >
> >Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> >---
> > net/core/rtnetlink.c | 26 ++++++++++++++------------
> > 1 file changed, 14 insertions(+), 12 deletions(-)
> >
> >diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >index 1b26dfa5668d22fb2e30ceefbf143e98df13ae29..b91ec216c593aaebf97ea69aa0d2d265ab61c098 100644
> >--- a/net/core/rtnetlink.c
> >+++ b/net/core/rtnetlink.c
> >@@ -1455,19 +1455,21 @@ static noinline_for_stack int rtnl_fill_vf(struct sk_buff *skb,
> >       return 0;
> > }
> >
> >-static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)
> >+static int rtnl_fill_link_ifmap(struct sk_buff *skb,
> >+                              const struct net_device *dev)
> > {
> >       struct rtnl_link_ifmap map;
> >
> >       memset(&map, 0, sizeof(map));
> >-      map.mem_start   = dev->mem_start;
> >-      map.mem_end     = dev->mem_end;
> >-      map.base_addr   = dev->base_addr;
> >-      map.irq         = dev->irq;
> >-      map.dma         = dev->dma;
> >-      map.port        = dev->if_port;
> >-
> >-      if (nla_put_64bit(skb, IFLA_MAP, sizeof(map), &map, IFLA_PAD))
> >+      map.mem_start = READ_ONCE(dev->mem_start);
> >+      map.mem_end   = READ_ONCE(dev->mem_end);
> >+      map.base_addr = READ_ONCE(dev->base_addr);
> >+      map.irq       = READ_ONCE(dev->irq);
> >+      map.dma       = READ_ONCE(dev->dma);
> >+      map.port      = READ_ONCE(dev->if_port);
> >+      /* Only report non zero information. */
> >+      if (memchr_inv(&map, 0, sizeof(map)) &&
>
> This check(optimization) is unrelated to the rest of the patch, correct?
> If yes, could it be a separate patch?

Sure thing. BTW, do you know which tool is using this ?

I could not find IFLA_MAP being used in iproute2 or ethtool.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ