lkml.org 
[lkml]   [2021]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 03/14] ARM: remove duplicate memcpy() definition
    On Tue, Sep 28, 2021 at 5:42 PM Arnd Bergmann <arnd@kernel.org> wrote:

    > From: Arnd Bergmann <arnd@arndb.de>
    >
    > Both the decompressor code and the kasan logic try to override
    > the memcpy() and memmove() definitions, which leading to a clash
    > in a KASAN-enabled kernel with XZ decompression:
    >
    > arch/arm/boot/compressed/decompress.c:50:9: error: 'memmove' macro redefined [-Werror,-Wmacro-redefined]
    > #define memmove memmove
    > ^
    > arch/arm/include/asm/string.h:59:9: note: previous definition is here
    > #define memmove(dst, src, len) __memmove(dst, src, len)
    > ^
    > arch/arm/boot/compressed/decompress.c:51:9: error: 'memcpy' macro redefined [-Werror,-Wmacro-redefined]
    > #define memcpy memcpy
    > ^
    > arch/arm/include/asm/string.h:58:9: note: previous definition is here
    > #define memcpy(dst, src, len) __memcpy(dst, src, len)
    > ^
    >
    > Here we want the set of functions from the decompressor, so undefine
    > the other macros before the override.
    >
    > Fixes: d6d51a96c7d6 ("ARM: 9014/2: Replace string mem* functions for KASan")
    > Fixes: a7f464f3db93 ("ARM: 7001/2: Wire up support for the XZ decompressor")
    > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Solves this, right?
    https://lore.kernel.org/lkml/202105091112.F5rmd4By-lkp@intel.com/

    Can you put in a reported-by and Link: to this so we got it tracked?

    > #ifdef CONFIG_KERNEL_XZ
    > +#undef memmove
    > #define memmove memmove
    > +#undef memcpy
    > #define memcpy memcpy
    > #include "../../../../lib/decompress_unxz.c"
    > #endif

    That's clever, maybe drop a small comment in the code why we do this
    pretty unintuitive looking thing and how this works?

    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

    Yours,
    Linus Walleij

    \
     
     \ /
      Last update: 2021-09-28 23:40    [W:4.299 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site