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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231214135016.85cfc8580a26677ab13c9e2c@linux-foundation.org>
Date: Thu, 14 Dec 2023 13:50:16 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>, "kernelci . org bot" <bot@...nelci.org>,
 Thomas Bogendoerfer <tsbogend@...ha.franken.de>, Zi Yan <ziy@...dia.com>,
 Jiaxun Yang <jiaxun.yang@...goat.com>, linux-mips@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mips: fix r3k_cache_init build regression

On Thu, 14 Dec 2023 20:54:47 +0000 Arnd Bergmann <arnd@...nel.org> wrote:

> From: Arnd Bergmann <arnd@...db.de>
> 
> My earlier patch removed __weak function declarations that used to
> be turned into wild branches by the linker, instead causing
> a link failure when the called functions are unavailable:
> 
> mips-linux-ld: arch/mips/mm/cache.o: in function `cpu_cache_init':
> cache.c:(.text+0x670): undefined reference to `r3k_cache_init'
> 
> The __weak method seems suboptimal, so rather than putting that
> back, make the function calls conditional on the Kconfig symbol
> that controls the compilation.

Cool, thanks.

> Reported-by: kernelci.org bot <bot@...nelci.org>

Please don't forget the Closes: - they're sometimes handy.

> Fixes: 66445677f01e ("mips: move cache declarations into header")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> My broken patch is currently in linux-mm, so the fix should
> be applied on top.

The mm-nonmm-stable branch of mm.git.  So I'll queue this separately
and we'll have a minor bisection hole.  <git rant elided>

> --- a/arch/mips/mm/cache.c
> +++ b/arch/mips/mm/cache.c
> @@ -205,14 +205,14 @@ static inline void setup_protection_map(void)
>  
>  void cpu_cache_init(void)
>  {
> -	if (cpu_has_3k_cache) {
> +	if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) {
>  		r3k_cache_init();
>  	}
> -	if (cpu_has_4k_cache) {
> +	if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) {
>  		r4k_cache_init();
>  	}
>  
> -	if (cpu_has_octeon_cache) {
> +	if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) {
>  		octeon_cache_init();
>  	}

I just can't help myself.

--- a/arch/mips/mm/cache.c~mips-fix-r3k_cache_init-build-regression-fix
+++ a/arch/mips/mm/cache.c
@@ -205,16 +205,13 @@ static inline void setup_protection_map(
 
 void cpu_cache_init(void)
 {
-	if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) {
+	if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache)
 		r3k_cache_init();
-	}
-	if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) {
+	if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache)
 		r4k_cache_init();
-	}
 
-	if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) {
+	if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache)
 		octeon_cache_init();
-	}
 
 	setup_protection_map();
 }

The rest of the file doesn't do the over-bracing, so there.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ