s390/irqflags: Add out-of-line definitions of arch_local_irq_*() for KMSAN
PATCH v2 1/1 s390/irqflags: Add out-of-line definitions of arch_local_irq_*() for KMSAN
Inline KMSAN arch_local_irq_*() definitions run afoul of -Wstatic-in-inline. Move them out-of-line. Make sure decompressor and non-GPL modules see the out-of-line definitions.
---
v1: https://lore.kernel.org/lkml/[email protected]/
v1 -> v2: Fix style issues (Heiko).
arch/s390/include/asm/irqflags.h | 20 +++++++++++++------- arch/s390/kernel/Makefile | 1 + arch/s390/kernel/irqflags.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 arch/s390/kernel/irqflags.c
arch/s390/include/asm/irqflags.h +13 -7
@@ -37,18 +37,24 @@ static __always_inline void __arch_local_irq_ssm(unsigned long flags) asmvolatile ("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) +unsigned long arch_local_save_flags (void ); +unsigned long arch_local_irq_save (void ); +void arch_local_irq_enable_external (void ); +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 +#define arch_local_irq_enable_external __arch_local_irq_enable_external +#define arch_local_irq_enable __arch_local_irq_enable#endif -static arch_local_irq_attributes unsigned long arch_local_save_flags (void ) +static __always_inline unsigned long __arch_local_save_flags (void ) {return __arch_local_irq_stnsm (0xff ); } -static arch_local_irq_attributes unsigned long arch_local_irq_save (void ) +static __always_inline unsigned long __arch_local_irq_save (void ) {return __arch_local_irq_stnsm (0xfc ); }
@@ -58,12 +64,12 @@ static __always_inline void arch_local_irq_disable(void)arch_local_irq_save (); } -static arch_local_irq_attributes void arch_local_irq_enable_external(void) +static __always_inline void __arch_local_irq_enable_external(void) {__arch_local_irq_stosm (0x01 ); } -static arch_local_irq_attributes void arch_local_irq_enable(void) +static __always_inline void __arch_local_irq_enable(void) {__arch_local_irq_stosm (0x03 ); }
arch/s390/kernel/Makefile +1 -0
@@ -72,6 +72,7 @@ obj-$(CONFIG_STACKPROTECTOR) += stackprotector.o obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o obj-$(CONFIG_KEXEC_FILE) += kexec_elf.o obj-$(CONFIG_CERT_STORE) += cert_store.o +obj-$(CONFIG_KMSAN) += irqflags.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_cpum_cf.o perf_cpum_sf.o
arch/s390/kernel/irqflags.c new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/export.h> +#include <asm/irqflags.h> + +noinstr unsigned long arch_local_save_flags (void ) +{ +return __arch_local_save_flags (); +} +EXPORT_SYMBOL (arch_local_save_flags); + +noinstr unsigned long arch_local_irq_save (void ) +{ +return __arch_local_irq_save (); +} +EXPORT_SYMBOL (arch_local_irq_save); + +noinstr void arch_local_irq_enable_external(void) +{ +__arch_local_irq_enable_external (); +} +EXPORT_SYMBOL (arch_local_irq_enable_external); + +noinstr void arch_local_irq_enable(void) +{ +__arch_local_irq_enable (); +} +EXPORT_SYMBOL (arch_local_irq_enable);
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
Inline KMSAN arch_local_irq_*() definitions run afoul of -Wstatic-in-inline. Move them out-of-line. Make sure decompressor and non-GPL modules see the out-of-line definitions.
Cc Boqun Feng <[email protected]>Reported-by kernel test robot <[email protected]>Suggested-by Heiko Carstens <[email protected]>Fixes 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN")Signed-off-by Ilya Leoshkevich <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 12 lines · Ilya Leoshkevich
Inline KMSAN arch_local_irq_*() definitions run afoul of -Wstatic-in-inline. Move them out-of-line. Make sure decompressor and non-GPL modules see the out-of-line definitions.
Cc Boqun Feng <[email protected]>Reported-by kernel test robot <[email protected]>Suggested-by Heiko Carstens <[email protected]>Fixes 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN")Signed-off-by Ilya Leoshkevich <[email protected]>---
Quoted 8 lines
v1: https://lore.kernel.org/lkml/[email protected]/
v1 -> v2: Fix style issues (Heiko).arch/s390/include/asm/irqflags.h | 20 +++++++++++++------- arch/s390/kernel/Makefile | 1 + arch/s390/kernel/irqflags.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 arch/s390/kernel/irqflags.c
Applied, thanks!