Re: [PATCH] s390/irqflags: add out-of-line definitions of arch_local_irq_*() for KMSAN
| Newsgroups | org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Missing KMSAN attributes on the `extern` declarations of `arch_local_save_flags` and `arch_local_irq_save` will cause spurious use-of-uninitialized-value reports. -- --- Patch [1]: [PATCH] s390/irqflags: add out-of-line definitions of arch_local_irq_*() for KMSAN --- commit 75ac5ab83800e65155075aeee91b3fd23aa6274d Author: Ilya Leoshkevich <[email protected]> s390/irqflags: add out-of-line definitions of arch_local_irq_*() for KMSAN This commit moves KMSAN arch_local_irq_*() definitions out-of-line to avoid warnings about static functions in inline functions. Uninstrumented decompressor code keeps the inline definitions, while non-GPL modules see the out-of-line versions. Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ > diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h > index bcab456dfb803..44d158f7831e6 100644 > --- a/arch/s390/include/asm/irqflags.h > +++ b/arch/s390/include/asm/irqflags.h > @@ -37,18 +37,24 @@ static __always_inline void __arch_local_irq_ssm(unsigned long flags) > asm volatile("ssm %0" : : "Q" (flags) : "memory"); > } > > -#ifdef CONFIG_KMSAN > -#define arch_local_irq_attributes noinline notrace __no_sanitize_memory __maybe_unused > +#if defined(CONFIG_KMSAN) && !defined(__DECOMPRESSOR) > +extern unsigned long arch_local_save_flags(void); > +extern unsigned long arch_local_irq_save(void); [Severity: High] Since these extern declarations lack KMSAN attributes, will instrumented callers expect a populated return value shadow in __msan_retval_tls? When arch_local_save_flags() and arch_local_irq_save() are called from instrumented code, the caller reads __msan_retval_tls. However, because the corresponding definitions are marked noinstr: arch/s390/kernel/irqflags.c: noinstr unsigned long arch_local_save_flags(void) { return __arch_local_save_flags(); } instrumentation is skipped, and __msan_retval_tls is never populated before returning to the caller. Could this result in spurious use-of-uninitialized-value reports on every IRQ state check or lock operation (like spin_lock_irqsave) when the kernel is built with CONFIG_KMSAN? > +extern void arch_local_irq_enable_external(void); > +extern void arch_local_irq_enable(void); > #else > -#define arch_local_irq_attributes __always_inline > +#define arch_local_save_flags __arch_local_save_flags > +#define arch_local_irq_save __arch_local_irq_save [ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1