[PATCH] net: correcting section tags for .init and .exit data/functions

xur at google.com xur at google.com
Fri Jun 12 09:22:57 PDT 2026


From: Rong Xu <xur at google.com>

Fix modpost warnings that have surfaced during Clang's distributed ThinLTO
builds.

  WARNING: modpost: vmlinux: section mismatch in reference: tcp4_net_ops.llvm.4527429266264891517+0x8 (section: .data) -> tcp4_proc_init_net (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: udp4_net_ops.llvm.17425824324074326067+0x8 (section: .data) -> udp4_proc_init_net (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: ping_v4_net_ops.llvm.5641696707737373282+0x8 (section: .data) -> ping_v4_proc_init_net (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: if6_proc_net_ops.llvm.7870945277386035298+0x8 (section: .data) -> if6_proc_net_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: ipv6_addr_label_ops.llvm.5745897517271459135+0x8 (section: .data) -> ip6addrlbl_net_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: ndisc_net_ops.llvm.8806210167060761094+0x8 (section: .data) -> ndisc_net_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: raw6_net_ops.llvm.3743523335772203324+0x8 (section: .data) -> raw6_init_net (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: igmp6_net_ops.llvm.7071106350580158050+0x8 (section: .data) -> igmp6_net_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: tcpv6_net_ops.llvm.17505177970592326146+0x8 (section: .data) -> tcpv6_net_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: ip6_flowlabel_net_ops.llvm.6051723423336054316+0x8 (section: .data) -> ip6_flowlabel_proc_init (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: ipv6_proc_ops.llvm.7829948594772821810+0x8 (section: .data) -> ipv6_proc_init_net (section: .init.text)

Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606111233.kM8oo8Df-lkp@intel.com/
Signed-off-by: Rong Xu <xur at google.com>
---
 net/ipv4/ping.c          |  6 +++---
 net/ipv4/tcp_ipv4.c      |  6 +++---
 net/ipv4/udp.c           |  6 +++---
 net/ipv6/addrconf.c      |  6 +++---
 net/ipv6/addrlabel.c     |  6 +++---
 net/ipv6/ip6_flowlabel.c |  6 +++---
 net/ipv6/mcast.c         | 10 +++++-----
 net/ipv6/ndisc.c         | 10 +++++-----
 net/ipv6/proc.c          |  6 +++---
 net/ipv6/raw.c           |  6 +++---
 net/ipv6/tcp_ipv6.c      |  6 +++---
 11 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index d36f1e273fde..1dda6d661ad8 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1144,17 +1144,17 @@ static void __net_exit ping_v4_proc_exit_net(struct net *net)
 	remove_proc_entry("icmp", net->proc_net);
 }
 
-static struct pernet_operations ping_v4_net_ops = {
+static struct pernet_operations ping_v4_net_ops __net_initdata = {
 	.init = ping_v4_proc_init_net,
 	.exit = ping_v4_proc_exit_net,
 };
 
-int __init ping_proc_init(void)
+int __net_init ping_proc_init(void)
 {
 	return register_pernet_subsys(&ping_v4_net_ops);
 }
 
-void ping_proc_exit(void)
+void __net_exit ping_proc_exit(void)
 {
 	unregister_pernet_subsys(&ping_v4_net_ops);
 }
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fdc81150ff6c..9caca5879466 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -3317,17 +3317,17 @@ static void __net_exit tcp4_proc_exit_net(struct net *net)
 	remove_proc_entry("tcp", net->proc_net);
 }
 
-static struct pernet_operations tcp4_net_ops = {
+static struct pernet_operations tcp4_net_ops __net_initdata = {
 	.init = tcp4_proc_init_net,
 	.exit = tcp4_proc_exit_net,
 };
 
-int __init tcp4_proc_init(void)
+int __net_init tcp4_proc_init(void)
 {
 	return register_pernet_subsys(&tcp4_net_ops);
 }
 
-void tcp4_proc_exit(void)
+void __net_exit tcp4_proc_exit(void)
 {
 	unregister_pernet_subsys(&tcp4_net_ops);
 }
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 70f6cbd4ef73..87f4cced2114 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -3600,17 +3600,17 @@ static void __net_exit udp4_proc_exit_net(struct net *net)
 	remove_proc_entry("udp", net->proc_net);
 }
 
-static struct pernet_operations udp4_net_ops = {
+static struct pernet_operations udp4_net_ops __net_initdata = {
 	.init = udp4_proc_init_net,
 	.exit = udp4_proc_exit_net,
 };
 
-int __init udp4_proc_init(void)
+int __net_init udp4_proc_init(void)
 {
 	return register_pernet_subsys(&udp4_net_ops);
 }
 
-void udp4_proc_exit(void)
+void __net_exit udp4_proc_exit(void)
 {
 	unregister_pernet_subsys(&udp4_net_ops);
 }
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c9e5d3e48ab9..73d9439bd408 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4527,17 +4527,17 @@ static void __net_exit if6_proc_net_exit(struct net *net)
 	remove_proc_entry("if_inet6", net->proc_net);
 }
 
-static struct pernet_operations if6_proc_net_ops = {
+static struct pernet_operations if6_proc_net_ops __net_initdata = {
 	.init = if6_proc_net_init,
 	.exit = if6_proc_net_exit,
 };
 
-int __init if6_proc_init(void)
+int __net_init if6_proc_init(void)
 {
 	return register_pernet_subsys(&if6_proc_net_ops);
 }
 
-void if6_proc_exit(void)
+void __net_exit if6_proc_exit(void)
 {
 	unregister_pernet_subsys(&if6_proc_net_ops);
 }
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index f4b2618446bd..50f6c1b1edaa 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -340,17 +340,17 @@ static void __net_exit ip6addrlbl_net_exit(struct net *net)
 	spin_unlock(&net->ipv6.ip6addrlbl_table.lock);
 }
 
-static struct pernet_operations ipv6_addr_label_ops = {
+static struct pernet_operations ipv6_addr_label_ops __net_initdata = {
 	.init = ip6addrlbl_net_init,
 	.exit = ip6addrlbl_net_exit,
 };
 
-int __init ipv6_addr_label_init(void)
+int __net_init ipv6_addr_label_init(void)
 {
 	return register_pernet_subsys(&ipv6_addr_label_ops);
 }
 
-void ipv6_addr_label_cleanup(void)
+void __net_exit ipv6_addr_label_cleanup(void)
 {
 	unregister_pernet_subsys(&ipv6_addr_label_ops);
 }
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index b1ccdf0dc646..f6980c403c68 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -903,17 +903,17 @@ static void __net_exit ip6_flowlabel_net_exit(struct net *net)
 	ip6_flowlabel_proc_fini(net);
 }
 
-static struct pernet_operations ip6_flowlabel_net_ops = {
+static struct pernet_operations ip6_flowlabel_net_ops __net_initdata = {
 	.init = ip6_flowlabel_proc_init,
 	.exit = ip6_flowlabel_net_exit,
 };
 
-int ip6_flowlabel_init(void)
+int __net_init ip6_flowlabel_init(void)
 {
 	return register_pernet_subsys(&ip6_flowlabel_net_ops);
 }
 
-void ip6_flowlabel_cleanup(void)
+void __net_exit ip6_flowlabel_cleanup(void)
 {
 	static_key_deferred_flush(&ipv6_flowlabel_exclusive);
 	timer_delete(&ip6_fl_gc_timer);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index d9b855d5191b..eef5bab1ee13 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -3209,12 +3209,12 @@ static void __net_exit igmp6_net_exit(struct net *net)
 	igmp6_proc_exit(net);
 }
 
-static struct pernet_operations igmp6_net_ops = {
+static struct pernet_operations igmp6_net_ops __net_initdata = {
 	.init = igmp6_net_init,
 	.exit = igmp6_net_exit,
 };
 
-int __init igmp6_init(void)
+int __net_init igmp6_init(void)
 {
 	int err;
 
@@ -3231,18 +3231,18 @@ int __init igmp6_init(void)
 	return err;
 }
 
-int __init igmp6_late_init(void)
+int __net_init igmp6_late_init(void)
 {
 	return register_netdevice_notifier(&igmp6_netdev_notifier);
 }
 
-void igmp6_cleanup(void)
+void __net_exit igmp6_cleanup(void)
 {
 	unregister_pernet_subsys(&igmp6_net_ops);
 	destroy_workqueue(mld_wq);
 }
 
-void igmp6_late_cleanup(void)
+void __net_exit igmp6_late_cleanup(void)
 {
 	unregister_netdevice_notifier(&igmp6_netdev_notifier);
 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index e7ad13c5bd26..3a83280db29d 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1994,12 +1994,12 @@ static void __net_exit ndisc_net_exit(struct net *net)
 	inet_ctl_sock_destroy(net->ipv6.ndisc_sk);
 }
 
-static struct pernet_operations ndisc_net_ops = {
+static struct pernet_operations ndisc_net_ops __net_initdata = {
 	.init = ndisc_net_init,
 	.exit = ndisc_net_exit,
 };
 
-int __init ndisc_init(void)
+int __net_init ndisc_init(void)
 {
 	int err;
 
@@ -2027,17 +2027,17 @@ int __init ndisc_init(void)
 #endif
 }
 
-int __init ndisc_late_init(void)
+int __net_init ndisc_late_init(void)
 {
 	return register_netdevice_notifier(&ndisc_netdev_notifier);
 }
 
-void ndisc_late_cleanup(void)
+void __net_exit ndisc_late_cleanup(void)
 {
 	unregister_netdevice_notifier(&ndisc_netdev_notifier);
 }
 
-void ndisc_cleanup(void)
+void __net_exit ndisc_cleanup(void)
 {
 #ifdef CONFIG_SYSCTL
 	neigh_sysctl_unregister(&nd_tbl.parms);
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 813013ca4e75..c59bade608cd 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -298,17 +298,17 @@ static void __net_exit ipv6_proc_exit_net(struct net *net)
 	remove_proc_entry("snmp6", net->proc_net);
 }
 
-static struct pernet_operations ipv6_proc_ops = {
+static struct pernet_operations ipv6_proc_ops __net_initdata = {
 	.init = ipv6_proc_init_net,
 	.exit = ipv6_proc_exit_net,
 };
 
-int __init ipv6_misc_proc_init(void)
+int __net_init ipv6_misc_proc_init(void)
 {
 	return register_pernet_subsys(&ipv6_proc_ops);
 }
 
-void ipv6_misc_proc_exit(void)
+void __net_exit ipv6_misc_proc_exit(void)
 {
 	unregister_pernet_subsys(&ipv6_proc_ops);
 }
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 3cc58698cbbd..fe399675b8fc 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1256,17 +1256,17 @@ static void __net_exit raw6_exit_net(struct net *net)
 	remove_proc_entry("raw6", net->proc_net);
 }
 
-static struct pernet_operations raw6_net_ops = {
+static struct pernet_operations raw6_net_ops __net_initdata = {
 	.init = raw6_init_net,
 	.exit = raw6_exit_net,
 };
 
-int __init raw6_proc_init(void)
+int __net_init raw6_proc_init(void)
 {
 	return register_pernet_subsys(&raw6_net_ops);
 }
 
-void raw6_proc_exit(void)
+void __net_exit raw6_proc_exit(void)
 {
 	unregister_pernet_subsys(&raw6_net_ops);
 }
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 36d75fb50a70..d0737f16076b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2335,12 +2335,12 @@ static void __net_exit tcpv6_net_exit(struct net *net)
 	inet_ctl_sock_destroy(net->ipv6.tcp_sk);
 }
 
-static struct pernet_operations tcpv6_net_ops = {
+static struct pernet_operations tcpv6_net_ops __net_initdata = {
 	.init	    = tcpv6_net_init,
 	.exit	    = tcpv6_net_exit,
 };
 
-int __init tcpv6_init(void)
+int __net_init tcpv6_init(void)
 {
 	int ret;
 
@@ -2378,7 +2378,7 @@ int __init tcpv6_init(void)
 	goto out;
 }
 
-void tcpv6_exit(void)
+void __net_exit tcpv6_exit(void)
 {
 	unregister_pernet_subsys(&tcpv6_net_ops);
 	inet6_unregister_protosw(&tcpv6_protosw);

base-commit: 2b414a95b8f7307d42173ba9e580d6d3e2bcbfce
-- 
2.54.0.1136.gdb2ca164c4-goog




More information about the linux-arm-kernel mailing list