Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3481097imu; Sun, 11 Nov 2018 16:05:03 -0800 (PST) X-Google-Smtp-Source: AJdET5dNG1VlAAErnK/oQFU+RnecnNEZyRY5yrVK6xmQbu25dVjCflLNcL63Yc27mMf2xnvN0s3d X-Received: by 2002:a63:e40c:: with SMTP id a12mr15619166pgi.28.1541981102972; Sun, 11 Nov 2018 16:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981102; cv=none; d=google.com; s=arc-20160816; b=cvG3woCWpBy4AeMlqn7O10y/q9kV6xEy1hIVAXTKCpZWSVGjf/lqj+w7hNvu1XbwU4 Y6jcrIAc2izugQ+lLJkq76TXBdlSO/FAGugDfincnKg4RhTuS22WMECUXngNqx4NmDFN X+EMYDOmSuIenNDHRKU0Y6xBof0k3Pl6yK85KE7BBl3pUD9kFex2O2v+4/7R/Zwbqii6 x3fzGpfhEM5RCnd2Vi+92uqNjAkbDqt9Q3nnhZ6ug07AxOBNhKFOUkhIvcowfhX9fil8 uomUOH3dHA/7rOM66ZNiNxxFgWpJloWpA+XuYc2EMNhyXNm7uxcIB1zOiIgpBwdhBI8Y XKBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XDp0lFUseQYCX3Xfn6m0EX/VJ/E6x7dh/GGcG8Vg1wA=; b=sbbkRZmjy+z7fIztxeZmltm+d4Gq2Z7YkzwkBJ1BWxxKvejeiTs7Xx8Mb/8wJ5egr+ fM5+g5+X5JqzckQwu+BSF5Ywg3Zoaf1pTy9qQ5MHprZESjw7WUIwTIL7XOEdXoq7aOb7 S53EEfDeiNF4DhAggOEKOa9I6IN5qvCc1VZZW9NhRMk7b2p8IFxJa7B8tKWdYKwRNfxT bdbkLgwW/2P4fR3H8zhgz9mGAxGhkhq26fQw8wmM5HAmoR7XC8rxNLVNnCVYaumrFeHl dCs/G8c8athKw/N1D3cL0rwSttojQJvjUkvZaKx3gDWmQuxBPVTHGB6FpxkdHpwbtYm7 p9qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xtQWbypl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h80-v6si12595036pfj.112.2018.11.11.16.04.47; Sun, 11 Nov 2018 16:05:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xtQWbypl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732247AbeKLJyx (ORCPT + 99 others); Mon, 12 Nov 2018 04:54:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:34236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732038AbeKLIRr (ORCPT ); Mon, 12 Nov 2018 03:17:47 -0500 Received: from localhost (unknown [206.108.79.134]) (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 DD20021731; Sun, 11 Nov 2018 22:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975271; bh=1GdtEblomlALCS11+/Y1GL/pmPJvfYU1toSYcqq/2E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xtQWbyplm6qSXrszBN9X3xXmXlobHzaY/Vl0nKC43lD+96NIJChWWNo8LzY/2PJEo sLTbpUnsYaudHMxNlE76I7mcUM9lkH92xOTn0gLQrFFu6+74LhsIwDXYVuDfMjeNRQ t+qMlupPl2xiBaAeJt/Ub+iRHKYhn/NstJ/bVOdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Mattson , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.19 140/361] KVM: nVMX: Clear reserved bits of #DB exit qualification Date: Sun, 11 Nov 2018 14:18:07 -0800 Message-Id: <20181111221640.171330536@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jim Mattson [ Upstream commit cfb634fe3052aefc4e1360fa322018c9a0b49755 ] According to volume 3 of the SDM, bits 63:15 and 12:4 of the exit qualification field for debug exceptions are reserved (cleared to 0). However, the SDM is incorrect about bit 16 (corresponding to DR6.RTM). This bit should be set if a debug exception (#DB) or a breakpoint exception (#BP) occurred inside an RTM region while advanced debugging of RTM transactional regions was enabled. Note that this is the opposite of DR6.RTM, which "indicates (when clear) that a debug exception (#DB) or breakpoint exception (#BP) occurred inside an RTM region while advanced debugging of RTM transactional regions was enabled." There is still an issue with stale DR6 bits potentially being misreported for the current debug exception. DR6 should not have been modified before vectoring the #DB exception, and the "new DR6 bits" should be available somewhere, but it was and they aren't. Fixes: b96fb439774e1 ("KVM: nVMX: fixes to nested virt interrupt injection") Signed-off-by: Jim Mattson Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -177,6 +177,7 @@ enum { #define DR6_BD (1 << 13) #define DR6_BS (1 << 14) +#define DR6_BT (1 << 15) #define DR6_RTM (1 << 16) #define DR6_FIXED_1 0xfffe0ff0 #define DR6_INIT 0xffff0ff0 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3294,10 +3294,13 @@ static int nested_vmx_check_exception(st } } else { if (vmcs12->exception_bitmap & (1u << nr)) { - if (nr == DB_VECTOR) + if (nr == DB_VECTOR) { *exit_qual = vcpu->arch.dr6; - else + *exit_qual &= ~(DR6_FIXED_1 | DR6_BT); + *exit_qual ^= DR6_RTM; + } else { *exit_qual = 0; + } return 1; } }