From: Paolo Abeni <pabeni@redhat.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Eric Dumazet <edumazet@google.com>,
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>,
linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] net: xfrm: unexport __init-annotated xfrm4_protocol_init()
Date: Tue, 07 Jun 2022 13:18:32 +0200 [thread overview]
Message-ID: <52e02030f7b2c0052472f127dae91fb9f5312b85.camel@redhat.com> (raw)
In-Reply-To: <20220606045355.4160711-3-masahiroy@kernel.org>
On Mon, 2022-06-06 at 13:53 +0900, Masahiro Yamada wrote:
> 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>
@Steffen: are you ok if we take this one in the -net tree directly?
Otherwise a repost would probably be the better option, with this patch
stand-alone targeting the ipsec tree and the other 2 targeting -net.
Thanks!
Paolo
next prev parent reply other threads:[~2022-06-07 11:21 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 ` [PATCH 2/3] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Masahiro Yamada
2022-06-07 11:18 ` Paolo Abeni [this message]
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=52e02030f7b2c0052472f127dae91fb9f5312b85.camel@redhat.com \
--to=pabeni@redhat.com \
--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=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).