From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD0BC4360C for ; Thu, 10 Oct 2019 08:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F16D220679 for ; Thu, 10 Oct 2019 08:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697801; bh=HYJ6TBJCDPcKIy71M87pqTGMonT+AGK/9LfEE7RF5CY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=G1urpxmEyYGs9xJo18osFKqHbdC8S7oZ7P9dTb2G91B/jAkGhK5Oa0HxVHY5XGoAM eU9v1cycYxSz5rapyvimdDu/J9NV4yOQS4FkvDOp3VieVA2xBOmkbHfNWpkyE7Tw5G RK29DHx2pCGKxrYoupm6y83HO0G4R18LGDQ/BdV8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389551AbfJJIrx (ORCPT ); Thu, 10 Oct 2019 04:47:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:53956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388762AbfJJIrw (ORCPT ); Thu, 10 Oct 2019 04:47:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5317208C3; Thu, 10 Oct 2019 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697272; bh=HYJ6TBJCDPcKIy71M87pqTGMonT+AGK/9LfEE7RF5CY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sX3Z1aqgQkLkljJG6UD1JQQOlJLa88JzqnxvfSm7ABAo0SFvpSMUV9iuC5q19XgO/ 0AYLJZQaCHqw9yKLq/oaKqbBw6XqstRx/+JorKW7VFHUds4U5Rw2wfyf0mi4FTAmP6 xws/0rSllijgEhAme/Hd7XBK4u+aQfCqtZ9iCkW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , Sean Christopherson , Jim Mattson , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.19 079/114] KVM: nVMX: Fix consistency check on injected exception error code Date: Thu, 10 Oct 2019 10:36:26 +0200 Message-Id: <20191010083612.158518676@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083544.711104709@linuxfoundation.org> References: <20191010083544.711104709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sean Christopherson [ Upstream commit 567926cca99ba1750be8aae9c4178796bf9bb90b ] Current versions of Intel's SDM incorrectly state that "bits 31:15 of the VM-Entry exception error-code field" must be zero. In reality, bits 31:16 must be zero, i.e. error codes are 16-bit values. The bogus error code check manifests as an unexpected VM-Entry failure due to an invalid code field (error number 7) in L1, e.g. when injecting a #GP with error_code=0x9f00. Nadav previously reported the bug[*], both to KVM and Intel, and fixed the associated kvm-unit-test. [*] https://patchwork.kernel.org/patch/11124749/ Reported-by: Nadav Amit Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d3a900a4fa0e7..6f7b3acdab263 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -12574,7 +12574,7 @@ static int check_vmentry_prereqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) /* VM-entry exception error code */ if (has_error_code && - vmcs12->vm_entry_exception_error_code & GENMASK(31, 15)) + vmcs12->vm_entry_exception_error_code & GENMASK(31, 16)) return VMXERR_ENTRY_INVALID_CONTROL_FIELD; /* VM-entry interruption-info field: reserved bits */ -- 2.20.1