• Vincent Whitchurch's avatar
    x86/asm: Fix build of UML with KASAN · 10f4c9b9
    Vincent Whitchurch authored
    Building UML with KASAN fails since commit 69d4c0d3 ("entry, kasan,
    x86: Disallow overriding mem*() functions") with the following errors:
    
     $ tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y
     ...
     ld: mm/kasan/shadow.o: in function `memset':
     shadow.c:(.text+0x40): multiple definition of `memset';
     arch/x86/lib/memset_64.o:(.noinstr.text+0x0): first defined here
     ld: mm/kasan/shadow.o: in function `memmove':
     shadow.c:(.text+0x90): multiple definition of `memmove';
     arch/x86/lib/memmove_64.o:(.noinstr.text+0x0): first defined here
     ld: mm/kasan/shadow.o: in function `memcpy':
     shadow.c:(.text+0x110): multiple definition of `memcpy';
     arch/x86/lib/memcpy_64.o:(.noinstr.text+0x0): first defined here
    
    UML does not use GENERIC_ENTRY and is still supposed to be allowed to
    override the mem*() functions, so use weak aliases in that case.
    
    Fixes: 69d4c0d3 ("entry, kasan, x86: Disallow overriding mem*() functions")
    Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/r/20230918-uml-kasan-v3-1-7ad6db477df6@axis.com
    10f4c9b9
memset_64.S 2.4 KB