arm64: lib: use C string functions with KASAN enabled
ARM64 has asm implementation of memchr(), memcmp(), str[r]chr(), str[n]cmp(), str[n]len(). KASAN don't see memory accesses in asm code, thus it can potentially miss many bugs. Ifdef out __HAVE_ARCH_* defines of these functions when KASAN is enabled, so the generic implementations from lib/string.c will be used. We can't just remove the asm functions because efistub uses them. And we can't have two non-weak functions either, so declare the asm functions as weak. Link: http://lkml.kernel.org/r/20180920135631.23833-2-aryabinin@virtuozzo.com Signed-off-by:Andrey Ryabinin <aryabinin@virtuozzo.com> Reported-by:
Kyeongdon Kim <kyeongdon.kim@lge.com> Cc: Alexander Potapenko <glider@google.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
Showing
- arch/arm64/include/asm/string.h 8 additions, 6 deletionsarch/arm64/include/asm/string.h
- arch/arm64/kernel/arm64ksyms.c 5 additions, 2 deletionsarch/arm64/kernel/arm64ksyms.c
- arch/arm64/lib/memchr.S 1 addition, 1 deletionarch/arm64/lib/memchr.S
- arch/arm64/lib/memcmp.S 1 addition, 1 deletionarch/arm64/lib/memcmp.S
- arch/arm64/lib/strchr.S 1 addition, 1 deletionarch/arm64/lib/strchr.S
- arch/arm64/lib/strcmp.S 1 addition, 1 deletionarch/arm64/lib/strcmp.S
- arch/arm64/lib/strlen.S 1 addition, 1 deletionarch/arm64/lib/strlen.S
- arch/arm64/lib/strncmp.S 1 addition, 1 deletionarch/arm64/lib/strncmp.S
- arch/arm64/lib/strnlen.S 1 addition, 1 deletionarch/arm64/lib/strnlen.S
- arch/arm64/lib/strrchr.S 1 addition, 1 deletionarch/arm64/lib/strrchr.S
Loading
Please register or sign in to comment