Replace memory function for kasan
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Tue, 5 Jun 2018 06:14:13 +0000 (14:14 +0800)
committerDmitry Osipenko <digetx@gmail.com>
Sun, 10 Feb 2019 01:27:20 +0000 (04:27 +0300)
commit2b99a16d49fedbf98b98888d05e8f8c7d1e0764e
treefe97e7ae6c3af90a6654474376fd4a1fc14da46a
parentf7383077bde7f88c69538059b4373ee8a5533567
Replace memory function for kasan

Functions like memset/memmove/memcpy do a lot of memory accesses.
If bad pointer passed to one of these function it is important
to catch this. Compiler's instrumentation cannot do this since
these functions are written in assembly.

KASan replaces memory functions with manually instrumented variants.
Original functions declared as weak symbols so strong definitions
in mm/kasan/kasan.c could replace them. Original functions have aliases
with '__' prefix in name, so we could call non-instrumented variant
if needed.

We must use __memcpy/__memset to replace memcpy/memset when we copy
.data to RAM and when we clear .bss, because kasan_early_init can't
be called before the initialization of .data and .bss.

Reported-by: Russell King - ARM Linux <linux@armlinux.org.uk>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Joel Stanley <joel@jms.id.au>
Tested-by: Abbott Liu <liuwenliang@huawei.com>
Signed-off-by: Abbott Liu <liuwenliang@huawei.com>
arch/arm/boot/compressed/decompress.c
arch/arm/boot/compressed/libfdt_env.h
arch/arm/include/asm/string.h
arch/arm/kernel/head-common.S
arch/arm/lib/memcpy.S
arch/arm/lib/memmove.S
arch/arm/lib/memset.S