From patchwork Mon Apr 15 12:46:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 2444911 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 706D33FD8C for ; Mon, 15 Apr 2013 12:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933709Ab3DOMqo (ORCPT ); Mon, 15 Apr 2013 08:46:44 -0400 Received: from mail-bk0-f53.google.com ([209.85.214.53]:49595 "EHLO mail-bk0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933036Ab3DOMqn (ORCPT ); Mon, 15 Apr 2013 08:46:43 -0400 Received: by mail-bk0-f53.google.com with SMTP id e19so2316456bku.26 for ; Mon, 15 Apr 2013 05:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=pgvxQmmHQMF4eOqOEoxBECgzRwdv+Rb6SDtH/LVyk0s=; b=B3Ap6pmQ+Rwpu0dFrEAwl8LbYNNNl4B9l9bU8fMK2C1NlpMJkKZyAs9MlS5kFvhHLh XFwIO8Iznt5KuvJtAopyjgoJZ1YPahBKcweeyKD0Ov/A3W2BSI8oX/9Uk8qib3DBKekl wjr/xukGZW2ao78VC6cy6JEA1D7FN5tzBsEj9I6gPmS4/ISsJk2wzKq4kRpf1durNafD a6yTFY2PLTQF08NjI1RWalZ6fx2vpYGJUyfrTtHUaHDJVJSoXD4D2NMl5OkxQJRKU59u NNw9iCGT3GyOCZOstTIUqWQ50M/3EOIrJLjP069O3p8GaEGzJ1OX8vNIxTrsu5k2ytYQ bmaQ== X-Received: by 10.204.200.139 with SMTP id ew11mr8242114bkb.70.1366030001624; Mon, 15 Apr 2013 05:46:41 -0700 (PDT) Received: from playground.lan (93-34-176-20.ip50.fastwebnet.it. [93.34.176.20]) by mx.google.com with ESMTPS id ej2sm8443634bkb.14.2013.04.15.05.46.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 15 Apr 2013 05:46:40 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org Cc: gnatapov@redhat.com, jan.kiszka@siemens.com, kvm@vger.kernel.org Subject: [PATCH] kvm: nVMX: check vmcs12 for valid activity state Date: Mon, 15 Apr 2013 14:46:36 +0200 Message-Id: <1366029996-3284-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org KVM does not use the activity state VMCS field, and does not support it in nested VMX either (the corresponding bits in the misc VMX feature MSR are zero). Fail entry if the activity state is set to anything but "active". Signed-off-by: Paolo Bonzini --- arch/x86/kvm/vmx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c75c25d..589e79a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7223,6 +7223,11 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) return 1; } + if (vmcs12->guest_activity_state != 0) { + nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD); + return 1; + } + if ((vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_MSR_BITMAPS) && !IS_ALIGNED(vmcs12->msr_bitmap, PAGE_SIZE)) { /*TODO: Also verify bits beyond physical address width are 0*/