Skip to content

Commit a75ca54

Browse files
aryabininIngo Molnar
authored andcommitted
x86, kasan: Fix build failure on KASAN=y && KMEMCHECK=y kernels
Declaration of memcpy() is hidden under #ifndef CONFIG_KMEMCHECK. In asm/efi.h under #ifdef CONFIG_KASAN we #undef memcpy(), due to which the following happens: In file included from arch/x86/kernel/setup.c:96:0: ./arch/x86/include/asm/desc.h: In function ‘native_write_idt_entry’: ./arch/x86/include/asm/desc.h:122:2: error: implicit declaration of function ‘memcpy’ [-Werror=implicit-function-declaration] memcpy(&idt[entry], gate, sizeof(*gate)); ^ cc1: some warnings being treated as errors make[2]: *** [arch/x86/kernel/setup.o] Error 1 We will get rid of that #undef in asm/efi.h eventually. But in the meanwhile move memcpy() declaration out of #ifdefs to fix the build. Reported-by: Borislav Petkov <[email protected]> Signed-off-by: Andrey Ryabinin <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent fcafdde commit a75ca54

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/x86/include/asm/string_64.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ static __always_inline void *__inline_memcpy(void *to, const void *from, size_t
2727
function. */
2828

2929
#define __HAVE_ARCH_MEMCPY 1
30+
extern void *memcpy(void *to, const void *from, size_t len);
3031
extern void *__memcpy(void *to, const void *from, size_t len);
3132

3233
#ifndef CONFIG_KMEMCHECK
33-
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
34-
extern void *memcpy(void *to, const void *from, size_t len);
35-
#else
34+
#if (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || __GNUC__ < 4
3635
#define memcpy(dst, src, len) \
3736
({ \
3837
size_t __len = (len); \

0 commit comments

Comments
 (0)