aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-02 14:10:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-02 14:10:01 -0400
commit7bd1d5edd0160b615ab8748cf94dabcab1fb01cb (patch)
tree377c23ab160b7f5770b9c3a1b232359b30fa004b
parent6751b8d91af515a5dc5196fe305eee0a635e2ea2 (diff)
parent2ac44ab608705948564791ce1d15d43ba81a1e38 (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Two fixes: a quirk for KVM guests running on certain AMD CPUs, and a KASAN related build fix" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor x86/boot: Provide KASAN compatible aliases for string routines
-rw-r--r--arch/x86/boot/compressed/string.c14
-rw-r--r--arch/x86/kernel/cpu/amd.c7
2 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c
index 19dbbcdd1a53..81fc1eaa3229 100644
--- a/arch/x86/boot/compressed/string.c
+++ b/arch/x86/boot/compressed/string.c
@@ -11,7 +11,7 @@
11#include "../string.c" 11#include "../string.c"
12 12
13#ifdef CONFIG_X86_32 13#ifdef CONFIG_X86_32
14static void *__memcpy(void *dest, const void *src, size_t n) 14static void *____memcpy(void *dest, const void *src, size_t n)
15{ 15{
16 int d0, d1, d2; 16 int d0, d1, d2;
17 asm volatile( 17 asm volatile(
@@ -25,7 +25,7 @@ static void *__memcpy(void *dest, const void *src, size_t n)
25 return dest; 25 return dest;
26} 26}
27#else 27#else
28static void *__memcpy(void *dest, const void *src, size_t n) 28static void *____memcpy(void *dest, const void *src, size_t n)
29{ 29{
30 long d0, d1, d2; 30 long d0, d1, d2;
31 asm volatile( 31 asm volatile(
@@ -56,7 +56,7 @@ void *memmove(void *dest, const void *src, size_t n)
56 const unsigned char *s = src; 56 const unsigned char *s = src;
57 57
58 if (d <= s || d - s >= n) 58 if (d <= s || d - s >= n)
59 return __memcpy(dest, src, n); 59 return ____memcpy(dest, src, n);
60 60
61 while (n-- > 0) 61 while (n-- > 0)
62 d[n] = s[n]; 62 d[n] = s[n];
@@ -71,5 +71,11 @@ void *memcpy(void *dest, const void *src, size_t n)
71 warn("Avoiding potentially unsafe overlapping memcpy()!"); 71 warn("Avoiding potentially unsafe overlapping memcpy()!");
72 return memmove(dest, src, n); 72 return memmove(dest, src, n);
73 } 73 }
74 return __memcpy(dest, src, n); 74 return ____memcpy(dest, src, n);
75} 75}
76
77#ifdef CONFIG_KASAN
78extern void *__memset(void *s, int c, size_t n) __alias(memset);
79extern void *__memmove(void *dest, const void *src, size_t n) __alias(memmove);
80extern void *__memcpy(void *dest, const void *src, size_t n) __alias(memcpy);
81#endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 80a405c2048a..8d4e50428b68 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -824,8 +824,11 @@ static void init_amd_zn(struct cpuinfo_x86 *c)
824{ 824{
825 set_cpu_cap(c, X86_FEATURE_ZEN); 825 set_cpu_cap(c, X86_FEATURE_ZEN);
826 826
827 /* Fix erratum 1076: CPB feature bit not being set in CPUID. */ 827 /*
828 if (!cpu_has(c, X86_FEATURE_CPB)) 828 * Fix erratum 1076: CPB feature bit not being set in CPUID.
829 * Always set it, except when running under a hypervisor.
830 */
831 if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_CPB))
829 set_cpu_cap(c, X86_FEATURE_CPB); 832 set_cpu_cap(c, X86_FEATURE_CPB);
830} 833}
831 834