powerpc: prepare string/mem functions for KASAN
CONFIG_KASAN implements wrappers for memcpy() memmove() and memset()
Those wrappers are doing the verification then call respectively
__memcpy() __memmove() and __memset(). The arches are therefore
expected to rename their optimised functions that way.
For files on which KASAN is inhibited, #defines are used to allow
them to directly call optimised versions of the functions without
going through the KASAN wrappers.
See commit 393f203f5f
("x86_64: kasan: add interceptors for
memset/memmove/memcpy functions") for details.
Other string / mem functions do not (yet) have kasan wrappers,
we therefore have to fallback to the generic versions when
KASAN is active, otherwise KASAN checks will be skipped.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[mpe: Fixups to keep selftests working]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
d69ca6bab3
commit
26deb04342
@@ -11,6 +11,7 @@
|
||||
#include <asm/export.h>
|
||||
#include <asm/asm-compat.h>
|
||||
#include <asm/feature-fixups.h>
|
||||
#include <asm/kasan.h>
|
||||
|
||||
#ifndef SELFTEST_CASE
|
||||
/* For big-endian, 0 == most CPUs, 1 == POWER6, 2 == Cell */
|
||||
@@ -18,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
.align 7
|
||||
_GLOBAL_TOC(memcpy)
|
||||
_GLOBAL_TOC_KASAN(memcpy)
|
||||
BEGIN_FTR_SECTION
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
cmpdi cr7,r5,0
|
||||
@@ -230,3 +231,4 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
|
||||
blr
|
||||
#endif
|
||||
EXPORT_SYMBOL(memcpy)
|
||||
EXPORT_SYMBOL_KASAN(memcpy)
|
||||
|
Reference in New Issue
Block a user