From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: kasan-dev <kasan-dev@googlegroups.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Dmitry Vyukov <dvyukov@google.com>,
Ard Biesheuvel <ardb@kernel.org>,
Abbott Liu <liuwenliang@huawei.com>,
Florian Fainelli <f.fainelli@gmail.com>,
kernel test robot <lkp@intel.com>,
kbuild-all@lists.01.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: arch/arm/boot/compressed/decompress.c:50: warning: "memmove" redefined
Date: Sun, 9 May 2021 17:25:01 +0100 [thread overview]
Message-ID: <20210509162501.GJ1336@shell.armlinux.org.uk> (raw)
In-Reply-To: <CACRpkdaNVg9zgaDN0JG+Z8dMMk+0fdpYHwGMHS-FKUG9MZAb4w@mail.gmail.com>
On Sun, May 09, 2021 at 05:17:49PM +0200, Linus Walleij wrote:
> OK, paging in the KSan mailing list and key people.
>
> Certainly this problem must be the same on all platforms
> using an XZ-compressed kernel and not just Arm?
>
> What I wonder is why the other platforms that use
> XZ compression don't redefine memmove and
> memcpy in their decompress.c clause for XZ?
>
> Can we just delete these two lines?
> #define memmove memmove
> #define memcpy memcpy
We can't. XZ has:
#ifndef memmove
/* Not static to avoid a conflict with the prototype in the Linux
* headers. */
void *memmove(void *dest, const void *src, size_t size)
{
...
}
#endif
So, if memmove is not defined in the preprocessor, the code will create
its own implementation. memmove() is also defined in
arch/arm/boot/compressed/string.c for use with other decompressors, so
the local version in lib/decompress_unxz.c will conflict and cause a
link time error.
The addition of KASan added this to arch/arm/include/asm/string.h:
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
#define memcpy(dst, src, len) __memcpy(dst, src, len)
#define memmove(dst, src, len) __memmove(dst, src, len)
#define memset(s, c, n) __memset(s, c, n)
#ifndef __NO_FORTIFY
#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
#endif
#endif
created a conditional definition of memmove in the preprocessor, which
ultimately caused this problem. lib/decompress_unxz.c wants it defined
in the preprocessor _if_ one has a local implementation (we do.)
Given that KASan should be disabled in the decompressor, maybe the
conditional added by KASan to asm/string.h is insufficient? The
makefile has:
KASAN_SANITIZE := n
So really we should not be playing _any_ KASan games in the
decompressor code.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
prev parent reply other threads:[~2021-05-09 16:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-09 3:32 arch/arm/boot/compressed/decompress.c:50: warning: "memmove" redefined kernel test robot
2021-05-09 12:22 ` Russell King - ARM Linux admin
2021-05-09 15:17 ` Linus Walleij
2021-05-09 16:25 ` Russell King - ARM Linux admin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210509162501.GJ1336@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=ardb@kernel.org \
--cc=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=f.fainelli@gmail.com \
--cc=kasan-dev@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuwenliang@huawei.com \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox