... but keep the current behaviour of using the policy vendor when compiled for userspace, where cross-vendor configurations are expected.
Not a functional change. Signed-off-by: Alejandro Vallejo <[email protected]> --- xen/arch/x86/x86_emulate/private.h | 6 +++++- xen/arch/x86/x86_emulate/x86_emulate.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h index 24c79c4e8f..1b6fc48ab6 100644 --- a/xen/arch/x86/x86_emulate/private.h +++ b/xen/arch/x86/x86_emulate/private.h @@ -15,6 +15,7 @@ # include <xen/kernel.h> # include <asm/cpu-user-regs.h> +# include <asm/cpufeature.h> # include <asm/endbr.h> # include <asm/msr-index.h> # include <asm/stubs.h> @@ -30,8 +31,11 @@ void BUG(void); # define X86EMUL_NO_SIMD # endif +# define x86emul_cpu(cp) ({ (void)(cp); cpu_vendor(); }) + #else /* !__XEN__ */ # include "x86-emulate.h" +# define x86emul_cpu(cp) ((cp)->x86_vendor) #endif #ifdef __i386__ @@ -520,7 +524,7 @@ in_protmode( static inline bool _amd_like(const struct cpu_policy *cp) { - return cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON); + return x86emul_cpu(cp) & (X86_VENDOR_AMD | X86_VENDOR_HYGON); } static inline bool diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 7751a67130..fcd8cbccc9 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3104,7 +3104,7 @@ x86_emulate( * in fact risking to make guest OSes vulnerable to the equivalent of * XSA-7 (CVE-2012-0217). */ - generate_exception_if(cp->x86_vendor == X86_VENDOR_INTEL && + generate_exception_if((x86emul_cpu(cp) == X86_VENDOR_INTEL) && op_bytes == 8 && !is_canonical_address(_regs.rcx), X86_EXC_GP, 0); #endif -- 2.43.0
