s390/boot: add the KMSAN runtime stub
It should be possible to have inline functions in the s390 header files, which call kmsan_unpoison_memory(). The problem is that these header files might be included by the decompressor, which does not contain KMSAN runtime, causing linker errors. Not compiling these calls if __SANITIZE_MEMORY__ is not defined - either by changing kmsan-checks.h or at the call sites - may cause unintended side effects, since calling these functions from an uninstrumented code that is linked into the kernel is valid use case. One might want to explicitly distinguish between the kernel and the decompressor. Checking for a decompressor-specific #define is quite heavy-handed, and will have to be done at all call sites. A more generic approach is to provide a dummy kmsan_unpoison_memory() definition. This produces some runtime overhead, but only when building with CONFIG_KMSAN. The benefit is that it does not disturb the existing KMSAN build logic and call sites don't need to be changed. Link: https://lkml.kernel.org/r/20240621113706.315500-25-iii@linux.ibm.com Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Alexander Potapenko <glider@google.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: <kasan-dev@googlegroups.com> Cc: Marco Elver <elver@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Steven Rostedt (Google) <rostedt@goodmis.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
435dc41efd
commit
008dead43d
@ -44,6 +44,7 @@ obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) +=
|
|||||||
obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
|
obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
|
||||||
obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o
|
obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o
|
||||||
obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o
|
obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o
|
||||||
|
obj-$(CONFIG_KMSAN) += kmsan.o
|
||||||
obj-all := $(obj-y) piggy.o syms.o
|
obj-all := $(obj-y) piggy.o syms.o
|
||||||
|
|
||||||
targets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
|
targets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
|
||||||
|
6
arch/s390/boot/kmsan.c
Normal file
6
arch/s390/boot/kmsan.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include <linux/kmsan-checks.h>
|
||||||
|
|
||||||
|
void kmsan_unpoison_memory(const void *address, size_t size)
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user