linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 09/14] mips: Handle KCOV __init vs inline mismatches
       [not found] <20250523043251.it.550-kees@kernel.org>
@ 2025-05-23  4:39 ` Kees Cook
  2025-06-19  8:55   ` Huacai Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2025-05-23  4:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Kees Cook, Thomas Bogendoerfer, linux-mips, Gustavo A. R. Silva,
	Christoph Hellwig, Marco Elver, Andrey Konovalov, Andrey Ryabinin,
	Ard Biesheuvel, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kernel, x86, kasan-dev, linux-doc, linux-arm-kernel, kvmarm,
	linux-riscv, linux-s390, linux-efi, linux-hardening, linux-kbuild,
	linux-security-module, linux-kselftest, sparclinux, llvm

When KCOV is enabled all functions get instrumented, unless
the __no_sanitize_coverage attribute is used. To prepare for
__no_sanitize_coverage being applied to __init functions, we have to
handle differences in how GCC's inline optimizations get resolved. For
mips this requires forcing a function to be inline with __always_inline.

Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: <linux-mips@vger.kernel.org>
---
 arch/mips/include/asm/time.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index e855a3611d92..044cff0e0764 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -55,7 +55,7 @@ static inline int mips_clockevent_init(void)
  */
 extern int init_r4k_clocksource(void);
 
-static inline int init_mips_clocksource(void)
+static __always_inline int init_mips_clocksource(void)
 {
 #ifdef CONFIG_CSRC_R4K
 	return init_r4k_clocksource();
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 09/14] mips: Handle KCOV __init vs inline mismatches
  2025-05-23  4:39 ` [PATCH v2 09/14] mips: Handle KCOV __init vs inline mismatches Kees Cook
@ 2025-06-19  8:55   ` Huacai Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Huacai Chen @ 2025-06-19  8:55 UTC (permalink / raw)
  To: Kees Cook
  Cc: Arnd Bergmann, Thomas Bogendoerfer, linux-mips,
	Gustavo A. R. Silva, Christoph Hellwig, Marco Elver,
	Andrey Konovalov, Andrey Ryabinin, Ard Biesheuvel,
	Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel, x86,
	kasan-dev, linux-doc, linux-arm-kernel, kvmarm, linux-riscv,
	linux-s390, linux-efi, linux-hardening, linux-kbuild,
	linux-security-module, linux-kselftest, sparclinux, llvm

Hi, Kees,

On Fri, May 23, 2025 at 12:41 PM Kees Cook <kees@kernel.org> wrote:
>
> When KCOV is enabled all functions get instrumented, unless
> the __no_sanitize_coverage attribute is used. To prepare for
> __no_sanitize_coverage being applied to __init functions, we have to
> handle differences in how GCC's inline optimizations get resolved. For
> mips this requires forcing a function to be inline with __always_inline.
>
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: <linux-mips@vger.kernel.org>
> ---
>  arch/mips/include/asm/time.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
> index e855a3611d92..044cff0e0764 100644
> --- a/arch/mips/include/asm/time.h
> +++ b/arch/mips/include/asm/time.h
> @@ -55,7 +55,7 @@ static inline int mips_clockevent_init(void)
>   */
>  extern int init_r4k_clocksource(void);
>
> -static inline int init_mips_clocksource(void)
> +static __always_inline int init_mips_clocksource(void)
Similar to x86 and arm, I prefer to mark it as __init rather than
__always_inline.

Huacai

>  {
>  #ifdef CONFIG_CSRC_R4K
>         return init_r4k_clocksource();
> --
> 2.34.1
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-19  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250523043251.it.550-kees@kernel.org>
2025-05-23  4:39 ` [PATCH v2 09/14] mips: Handle KCOV __init vs inline mismatches Kees Cook
2025-06-19  8:55   ` Huacai Chen

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).