Skip to contentSkip to conversation

ipmr: Don't mark ip6mr_rtnl_msg_handlers as __initconst

PATCH In review Arnd Bergmann 3 participants 4 messages Oct 18, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmr: Don't mark ip6mr_rtnl_msg_handlers as __initconst

From: Arnd Bergmann <[email protected]>

This gets referenced by the ip6_mr_cleanup function, so it must not be discarded early:

WARNING: modpost: vmlinux: section mismatch in reference: ip6_mr_cleanup+0x14 (section: .exit.text) -> ip6mr_rtnl_msg_handlers (section: .init.rodata)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Fixes 3ac84e31b33e ("ipmr: Use rtnl_register_many().")
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6mr.c +1 -1
index 437a9fdb67f5..f7892afba980 100644
@@ -1367,7 +1367,7 @@ static struct pernet_operations ip6mr_net_ops = {
 	.exit_batch = ip6mr_net_exit_batch,
 };
 
-static const struct rtnl_msg_handler ip6mr_rtnl_msg_handlers[] __initconst_or_module = {
+static const struct rtnl_msg_handler ip6mr_rtnl_msg_handlers[] = {
 	{.owner = THIS_MODULE, .protocol = RTNL_FAMILY_IP6MR,
 	 .msgtype = RTM_GETROUTE,
 	 .doit = ip6mr_rtm_getroute, .dumpit = ip6mr_rtm_dumproute},
Signature · 1 line
2.39.5
#1 lore raw

From: Arnd Bergmann <[email protected]>
Date: Fri, 18 Oct 2024 15:12:14 +0000

Quoted 11 lines

From: Arnd Bergmann <[email protected]>

This gets referenced by the ip6_mr_cleanup function, so it must not be discarded early:

WARNING: modpost: vmlinux: section mismatch in reference: ip6_mr_cleanup+0x14 (section: .exit.text) -> ip6mr_rtnl_msg_handlers (section: .init.rodata)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Fixes 3ac84e31b33e ("ipmr: Use rtnl_register_many().")

Hi,

I posted this yesterday.
https://lore.kernel.org/netdev/[email protected]/

Thanks

Quoted 19 lines
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6mr.c +1 -1
index 437a9fdb67f5..f7892afba980 100644
@@ -1367,7 +1367,7 @@ static struct pernet_operations ip6mr_net_ops = {
 	.exit_batch = ip6mr_net_exit_batch,
 };
 
-static const struct rtnl_msg_handler ip6mr_rtnl_msg_handlers[] __initconst_or_module = {
+static const struct rtnl_msg_handler ip6mr_rtnl_msg_handlers[] = {
 	{.owner = THIS_MODULE, .protocol = RTNL_FAMILY_IP6MR,
 	 .msgtype = RTM_GETROUTE,
 	 .doit = ip6mr_rtm_getroute, .dumpit = ip6mr_rtm_dumproute},
Signature · 1 line
2.39.5
#2 lore raw
Quoted 11 lines · Kuniyuki Iwashima

From: Arnd Bergmann <[email protected]>
Date: Fri, 18 Oct 2024 15:12:14 +0000

Quoted 9 lines

From: Arnd Bergmann <[email protected]>

This gets referenced by the ip6_mr_cleanup function, so it must not be discarded early:

WARNING: modpost: vmlinux: section mismatch in reference: ip6_mr_cleanup+0x14 (section: .exit.text) -> ip6mr_rtnl_msg_handlers (section: .init.rodata)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Quoted 7 lines
Quoted 2 lines
Fixes 3ac84e31b33e ("ipmr: Use rtnl_register_many().")

Hi,

I posted this yesterday.
https://lore.kernel.org/netdev/[email protected]/

Right, your may be better then. I was confused by the function name suggesting that this would be called in the module_exit path, but I now see that it is only called at init time, so that works.

Arnd

#3 lore raw

From: "Arnd Bergmann" <[email protected]>
Date: Fri, 18 Oct 2024 19:09:10 +0000

Quoted 17 lines · Kuniyuki Iwashima
Quoted 16 lines

From: Arnd Bergmann <[email protected]>
Date: Fri, 18 Oct 2024 15:12:14 +0000

Quoted 11 lines

From: Arnd Bergmann <[email protected]>

This gets referenced by the ip6_mr_cleanup function, so it must not be discarded early:

WARNING: modpost: vmlinux: section mismatch in reference: ip6_mr_cleanup+0x14 (section: .exit.text) -> ip6mr_rtnl_msg_handlers (section: .init.rodata)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Fixes 3ac84e31b33e ("ipmr: Use rtnl_register_many().")

Hi,

Quoted 7 lines
Quoted 2 lines

I posted this yesterday.
https://lore.kernel.org/netdev/[email protected]/

Right, your may be better then. I was confused by the function name suggesting that this would be called in the module_exit path, but I now see that it is only called at init time, so that works.

Since the commit below, IPv6 has lost unloadability, and such cleanup functions are only called from init path now.

commit 8ce440610357b77587433d0df647cea69a6890a8

Author: Cong Wang <[email protected]>
Date:   Sat Sep 21 11:12:21 2013 +0800

ipv6: do not allow ipv6 module to be removed