From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] net: mdio: unexport __init-annotated mdio_bus_init()
Date: Mon, 6 Jun 2022 09:25:51 +0100 [thread overview]
Message-ID: <Yp26Dw3f8+XlSx2+@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220606045355.4160711-2-masahiroy@kernel.org>
On Mon, Jun 06, 2022 at 01:53:53PM +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,
> drivers/net/phy/phy_device.c is never compiled as modular.
> (CONFIG_PHYLIB is boolean)
>
> Fixes: 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2022-06-06 8:26 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) [this message]
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
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=Yp26Dw3f8+XlSx2+@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sfr@canb.auug.org.au \
/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).