From: Masahiro Yamada <masahiroy@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
David Ahern <dsahern@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Steffen Klassert <steffen.klassert@secunet.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] net: xfrm: unexport __init-annotated xfrm4_protocol_init()
Date: Mon, 6 Jun 2022 13:53:54 +0900 [thread overview]
Message-ID: <20220606045355.4160711-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20220606045355.4160711-1-masahiroy@kernel.org>
EXPORT_SYMBOL and __init is a bad combination because the .init.text
section is freed up after the initialization. Hence, modules cannot
use symbols annotated __init. The access to a freed symbol may end up
with kernel panic.
modpost used to detect it, but it has been broken for a decade.
Recently, I fixed modpost so it started to warn it again, then this
showed up in linux-next builds.
There are two ways to fix it:
- Remove __init
- Remove EXPORT_SYMBOL
I chose the latter for this case because the only in-tree call-site,
net/ipv4/xfrm4_policy.c is never compiled as modular.
(CONFIG_XFRM is boolean)
Fixes: 2f32b51b609f ("xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
net/ipv4/xfrm4_protocol.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
index 2fe5860c21d6..b146ce88c5d0 100644
--- a/net/ipv4/xfrm4_protocol.c
+++ b/net/ipv4/xfrm4_protocol.c
@@ -304,4 +304,3 @@ void __init xfrm4_protocol_init(void)
{
xfrm_input_register_afinfo(&xfrm4_input_afinfo);
}
-EXPORT_SYMBOL(xfrm4_protocol_init);
--
2.32.0
next prev parent reply other threads:[~2022-06-06 5:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 4:53 [PATCH 0/3] net: unexport some symbols that are annotated __init Masahiro Yamada
2022-06-06 4:53 ` [PATCH 1/3] net: mdio: unexport __init-annotated mdio_bus_init() Masahiro Yamada
2022-06-06 8:09 ` Florian Fainelli
2022-06-06 8:25 ` Russell King (Oracle)
2022-06-06 4:53 ` Masahiro Yamada [this message]
2022-06-07 11:18 ` [PATCH 2/3] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Paolo Abeni
2022-06-08 5:39 ` Steffen Klassert
2022-06-06 4:53 ` [PATCH 3/3] net: ipv6: unexport __init-annotated seg6_hmac_init() Masahiro Yamada
2022-06-08 17:20 ` [PATCH 0/3] net: unexport some symbols that are annotated __init patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220606045355.4160711-3-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sfr@canb.auug.org.au \
--cc=steffen.klassert@secunet.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.