lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <0666e47e-a675-47b6-9b6a-5d4e33f6bf5e@app.fastmail.com>
Date: Tue, 19 Aug 2025 19:35:20 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Alexander Gordeev" <agordeev@...ux.ibm.com>,
 "Naresh Kamboju" <naresh.kamboju@...aro.org>,
 "Russell King" <rmk+kernel@...linux.org.uk>
Cc: "open list" <linux-kernel@...r.kernel.org>,
 Netdev <netdev@...r.kernel.org>, lkft-triage@...ts.linaro.org,
 "Linux Regressions" <regressions@...ts.linux.dev>,
 linux-s390@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
 "Heiko Carstens" <hca@...ux.ibm.com>, "Vasily Gorbik" <gor@...ux.ibm.com>,
 "Jakub Kicinski" <kuba@...nel.org>,
 "Alexandre Torgue" <alexandre.torgue@...s.st.com>,
 "Jose Abreu" <joabreu@...opsys.com>,
 "Benjamin Copeland" <benjamin.copeland@...aro.org>,
 "Anders Roxell" <anders.roxell@...aro.org>,
 "Dan Carpenter" <dan.carpenter@...aro.org>
Subject: Re: next-20250813 s390 allyesconfig undefined reference to
 `stmmac_simple_pm_ops'

On Tue, Aug 19, 2025, at 18:00, Alexander Gordeev wrote:
> On Tue, Aug 19, 2025 at 03:07:56PM +0530, Naresh Kamboju wrote:
> CONFIG_PM is not defined on s390 and as result stmmac_simple_pm_ops ends up
> in _DISCARD_PM_OPS(). The below patch fixes the linking, but it is by no
> means a correct solution:
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c 
> b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 5769165ee5ba..d475a77e4871 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -668,7 +668,7 @@ static struct pci_driver loongson_dwmac_driver = {
>  	.probe = loongson_dwmac_probe,
>  	.remove = loongson_dwmac_remove,
>  	.driver = {
> -		.pm = &stmmac_simple_pm_ops,
> +		.pm = &__static_stmmac_simple_pm_ops,

The correct solution is to make the PM_SLEEP versions use this

            .pm = pm_sleep_ptr(stmmac_simple_pm_ops),

or the corresponding version for the PM_RUNTIME+PM_SLEEP drivers:

            .pm = pm_ptr(stmmac_pltfrm_pm_ops),
 
By convention, the pm_ptr()/pm_sleep_ptr() macro should be
used for any driver using DEFINE_DEV_PM_OPS() or its variants,
though missing that does not produce a warning for non-exported
options and only wastes a few bytes of .data.

>  #define _DISCARD_PM_OPS(name, license, ns)				\
> -	static __maybe_unused const struct dev_pm_ops __static_##name
> +	__maybe_unused const struct dev_pm_ops __static_##name 

This would cause a lot of link failures elsewhere, since _DISCARD_PM_OPS
needs to ensure the operations are discarded by the compiler, which does
not happen when they are defined as a global symbol.

The idea of making this a 'static __maybe_unused' symbol is that
the actual functions get discarded as well but don't need an individual
__maybe_unused annotation or an #ifdef around them to prevent a
warning for unused symbols.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ