Re: [PATCH] x86: Fix build of UML with KASAN

From: Vincent Whitchurch
Date: Mon Sep 11 2023 - 03:26:10 EST


On Sat, 2023-06-10 at 16:34 +0800, David Gow wrote:
> On Fri, 9 Jun 2023 at 19:19, Vincent Whitchurch
> <vincent.whitchurch@xxxxxxxx> wrote:
> >
> > Building UML with KASAN fails since commit 69d4c0d32186 ("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
> >
> > If I'm reading that commit right, the !GENERIC_ENTRY case is still
> > supposed to be allowed to override the mem*() functions, so use weak
> > aliases in that case.
> >
> > Fixes: 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*() functions")
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@xxxxxxxx>
> > ---
>
> Thanks: I stumbled into this the other day and ran out of time to debug it.
>
> I've tested that it works here.
>
> Tested-by: David Gow <davidgow@xxxxxxxxxx>

Thanks. Perhaps someone could pick this up? It's been a few months,
and the build problem is still present on v6.6-rc1.