• Ilya Leoshkevich's avatar
    s390/boot: add the KMSAN runtime stub · 008dead4
    Ilya Leoshkevich authored
    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.comSigned-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
    Reviewed-by: default avatarAlexander 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    008dead4
Makefile 5.21 KB