summaryrefslogtreecommitdiff
path: root/arch/arm/boot/compressed/string.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2020-12-21 11:19:24 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2020-12-21 11:19:24 +0000
commit8cc9251737d1883e33fd0a7dafbd4062916c1ca6 (patch)
tree6a1901ccbce167330049ce9b2afced122b325c4a /arch/arm/boot/compressed/string.c
parente64ab473dddaffdfc4bd0b385204f472f2cb00d6 (diff)
parent10fce53c0ef8f6e79115c3d9e0d7ea1338c3fa37 (diff)
Merge branches 'fixes' and 'misc' into for-next
Diffstat (limited to 'arch/arm/boot/compressed/string.c')
-rw-r--r--arch/arm/boot/compressed/string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c
index ade5079bebbf..8c0fa276d994 100644
--- a/arch/arm/boot/compressed/string.c
+++ b/arch/arm/boot/compressed/string.c
@@ -7,6 +7,25 @@
#include <linux/string.h>
+/*
+ * The decompressor is built without KASan but uses the same redirects as the
+ * rest of the kernel when CONFIG_KASAN is enabled, defining e.g. memcpy()
+ * to __memcpy() but since we are not linking with the main kernel string
+ * library in the decompressor, that will lead to link failures.
+ *
+ * Undefine KASan's versions, define the wrapped functions and alias them to
+ * the right names so that when e.g. __memcpy() appear in the code, it will
+ * still be linked to this local version of memcpy().
+ */
+#ifdef CONFIG_KASAN
+#undef memcpy
+#undef memmove
+#undef memset
+void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
+void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
+void *__memset(void *s, int c, size_t count) __alias(memset);
+#endif
+
void *memcpy(void *__dest, __const void *__src, size_t __n)
{
int i = 0;