[PATCH] fixup! ARM: Replace string mem* functions for KASan
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Oct 14 06:59:59 EDT 2020
CONFIG_FORTIFY_SOURCE doesn't play nicely for files that are compiled
with CONFIG_KASAN=y, but have sanitization disabled.
This happens despite 47227d27e2fc ("string.h: fix incompatibility between
FORTIFY_SOURCE and KASAN"). For now, do what ARM64 is already doing and
disable FORTIFY_SOURCE for such files.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
CONFIG_FORTIFY_SOURCE kernel on i.MX6Q hangs indefinitely in a
memcpy inside the very first printk without this patch.
With this patch squashed:
Tested-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/arm/include/asm/string.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h
index 947f93037d87..6c607c68f3ad 100644
--- a/arch/arm/include/asm/string.h
+++ b/arch/arm/include/asm/string.h
@@ -58,6 +58,11 @@ static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
#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
#endif
--
2.28.0
More information about the linux-arm-kernel
mailing list