forked from luck/tmp_suning_uos_patched
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
This commit is contained in:
commit
7bd1d5edd0
|
@ -11,7 +11,7 @@
|
||||||
#include "../string.c"
|
#include "../string.c"
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
static void *__memcpy(void *dest, const void *src, size_t n)
|
static void *____memcpy(void *dest, const void *src, size_t n)
|
||||||
{
|
{
|
||||||
int d0, d1, d2;
|
int d0, d1, d2;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
|
@ -25,7 +25,7 @@ static void *__memcpy(void *dest, const void *src, size_t n)
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void *__memcpy(void *dest, const void *src, size_t n)
|
static void *____memcpy(void *dest, const void *src, size_t n)
|
||||||
{
|
{
|
||||||
long d0, d1, d2;
|
long d0, d1, d2;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
|
@ -56,7 +56,7 @@ void *memmove(void *dest, const void *src, size_t n)
|
||||||
const unsigned char *s = src;
|
const unsigned char *s = src;
|
||||||
|
|
||||||
if (d <= s || d - s >= n)
|
if (d <= s || d - s >= n)
|
||||||
return __memcpy(dest, src, n);
|
return ____memcpy(dest, src, n);
|
||||||
|
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
d[n] = s[n];
|
d[n] = s[n];
|
||||||
|
@ -71,5 +71,11 @@ void *memcpy(void *dest, const void *src, size_t n)
|
||||||
warn("Avoiding potentially unsafe overlapping memcpy()!");
|
warn("Avoiding potentially unsafe overlapping memcpy()!");
|
||||||
return memmove(dest, src, n);
|
return memmove(dest, src, n);
|
||||||
}
|
}
|
||||||
return __memcpy(dest, src, n);
|
return ____memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_KASAN
|
||||||
|
extern void *__memset(void *s, int c, size_t n) __alias(memset);
|
||||||
|
extern void *__memmove(void *dest, const void *src, size_t n) __alias(memmove);
|
||||||
|
extern void *__memcpy(void *dest, const void *src, size_t n) __alias(memcpy);
|
||||||
|
#endif
|
||||||
|
|
|
@ -824,8 +824,11 @@ static void init_amd_zn(struct cpuinfo_x86 *c)
|
||||||
{
|
{
|
||||||
set_cpu_cap(c, X86_FEATURE_ZEN);
|
set_cpu_cap(c, X86_FEATURE_ZEN);
|
||||||
|
|
||||||
/* Fix erratum 1076: CPB feature bit not being set in CPUID. */
|
/*
|
||||||
if (!cpu_has(c, X86_FEATURE_CPB))
|
* Fix erratum 1076: CPB feature bit not being set in CPUID.
|
||||||
|
* Always set it, except when running under a hypervisor.
|
||||||
|
*/
|
||||||
|
if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_CPB))
|
||||||
set_cpu_cap(c, X86_FEATURE_CPB);
|
set_cpu_cap(c, X86_FEATURE_CPB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user