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-next>] [day] [month] [year] [list]
Message-ID: <20240409160720.154470-2-diogo.ivo@siemens.com>
Date: Tue,  9 Apr 2024 17:07:18 +0100
From: Diogo Ivo <diogo.ivo@...mens.com>
To: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	aleksander.lobakin@...el.com,
	netdev@...r.kernel.org
Cc: Diogo Ivo <diogo.ivo@...mens.com>,
	jan.kiszka@...mens.com
Subject: [PATCH net-next] net: ethernet: Move eth_*_addr_base to global symbols

Promote IPv4/6 and Ethernet reserved base addresses to global symbols
to avoid local copies being created when these addresses are referenced.

Signed-off-by: Diogo Ivo <diogo.ivo@...mens.com>
---
 include/linux/etherdevice.h | 10 +++-------
 net/ethernet/eth.c          | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 8d6daf828427..6002dabca0f8 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -67,15 +67,11 @@ struct sk_buff *eth_gro_receive(struct list_head *head, struct sk_buff *skb);
 int eth_gro_complete(struct sk_buff *skb, int nhoff);
 
 /* Reserved Ethernet Addresses per IEEE 802.1Q */
-static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =
-{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
+extern const u8 eth_reserved_addr_base[ETH_ALEN];
 #define eth_stp_addr eth_reserved_addr_base
 
-static const u8 eth_ipv4_mcast_addr_base[ETH_ALEN] __aligned(2) =
-{ 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 };
-
-static const u8 eth_ipv6_mcast_addr_base[ETH_ALEN] __aligned(2) =
-{ 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 };
+extern const u8 eth_ipv4_mcast_addr_base[ETH_ALEN];
+extern const u8 eth_ipv6_mcast_addr_base[ETH_ALEN];
 
 /**
  * is_link_local_ether_addr - Determine if given Ethernet address is link-local
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 2edc8b796a4e..8141e5c7e4f3 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -63,6 +63,21 @@
 #include <linux/uaccess.h>
 #include <net/pkt_sched.h>
 
+const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) = {
+	0x01, 0x80, 0xc2, 0x00, 0x00, 0x00
+};
+EXPORT_SYMBOL(eth_reserved_addr_base);
+
+const u8 eth_ipv4_mcast_addr_base[ETH_ALEN] __aligned(2) = {
+	0x01, 0x00, 0x5e, 0x00, 0x00, 0x00
+};
+EXPORT_SYMBOL(eth_ipv4_mcast_addr_base);
+
+const u8 eth_ipv6_mcast_addr_base[ETH_ALEN] __aligned(2) = {
+	0x33, 0x33, 0x00, 0x00, 0x00, 0x00
+};
+EXPORT_SYMBOL(eth_ipv6_mcast_addr_base);
+
 /**
  * eth_header - create the Ethernet header
  * @skb:	buffer to alter
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ