From a62c6fe05c4ae905b7d4cb0ca946508b7f96d522 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 22 Apr 2020 13:01:10 +0200 Subject: [PATCH] x86: validate VM assist value in arch_set_info_guest() While I can't spot anything that would go wrong, just like the respective hypercall only permits applicable bits to be set, we should also do so when loading guest context. Reported-by: Andrew Cooper Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- xen/arch/x86/domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 7f18f4a88a..a4428190d5 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -932,6 +932,9 @@ int arch_set_info_guest( } } + if ( v->vcpu_id == 0 && (c(vm_assist) & ~arch_vm_assist_valid_mask(d)) ) + return -EINVAL; + if ( is_hvm_domain(d) ) { for ( i = 0; i < ARRAY_SIZE(v->arch.dr); ++i ) -- 2.30.2