Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3436507imu; Sun, 11 Nov 2018 15:04:16 -0800 (PST) X-Google-Smtp-Source: AJdET5cld4qW20L1ABtpFUtt21MuLSzg37LUZ4o/b+8MZHLKGpF7PYzMWh0BO8ikNTkDwj2dRUS1 X-Received: by 2002:a17:902:bcc4:: with SMTP id o4-v6mr17872999pls.13.1541977456742; Sun, 11 Nov 2018 15:04:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977456; cv=none; d=google.com; s=arc-20160816; b=gILIdr4hNsw9tWTsuoJ0sqlhg3cmu58jhjJMMizRLLVYywpd498MLTbzFdIYAmUK6w i0h75d98eh+UvNJWs70qGDKlic5RSLqG9Uxu/F/Y9trIXvFBo9ckhUvufrbrrwAdfyz9 N/VJRuIO/GQIx8w3ivjqirAdBRyN1ig7G7UVv+I6Li3e2GgY1ZeFSZS5UswH2dFVqLps Z7AkdJ95AAz8QXPQ9dyYZ0zhuUYiC9k+aaIiUaA0SGKlhVEj+H5VlLMC2eVT+sGh7sWJ b8fymzeRoLoESe1vOAKd/EyKffOvBB5tQJwOu4UGD6qsGDroNKynasrj2vAh+Jqts6FE a/Xg== 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=xAJOeGAzTipK409wpqRICDdazzrqc7KVmgRwLrLI+M4=; b=o/r/TBCHXvk3JDLypVxGivBuTJqHIOTp9ymLebYITMonMjvsS5EUw5lJ/VGPxA9lPr 89xkKzw15+W2PrwGWNTlGR8lokP5EjjIkj4DeuI7PsosGtU29rFhdCIDiHxrLl8ruuqq pHRLFnLhNd3Z9doYti4qBQRGcJnODYB7zj/tz6M4U51vymTMjCbGNaYPfWJWSUCnS31J XFpD63PNNDOQA3aBAR+CBe8InHS4o/2h67eIsMpgBl/JEZ9B8DF8SS1dU4dMx1E7G4Fi 9hNN/WJMvN5Y7V8rtvXW+zBc/r+tPTdVt8/D217gtVnWKFtl+KsWofZoh46+7omQbLG6 z5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MHrvbBh5; 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 l11-v6si15828115plt.5.2018.11.11.15.04.01; Sun, 11 Nov 2018 15:04:16 -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=MHrvbBh5; 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 S2389080AbeKLIxt (ORCPT + 99 others); Mon, 12 Nov 2018 03:53:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:51248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390539AbeKLIWX (ORCPT ); Mon, 12 Nov 2018 03:22:23 -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 473742245E; Sun, 11 Nov 2018 22:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975546; bh=x/zG+zGuSf1eZ1lOzst+O7I7F33beXHVPK4UhnJHOqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHrvbBh56+l27/7CTbq7CzMLYvMwLK63ZRCzg9DKcUkejTMHa3EkDUUx7+8WxtS38 1kYqDC7CziUeQHyIbzRUa/Lq3SeWIBg1j1Gv5QuwEm/L2gPccZ69bTTyaYpA8zrDNf DMKc+wTzWvrSkcQZLYLwYZrjAlig38YdZ/yAG4xI= 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.14 079/222] KVM: nVMX: Clear reserved bits of #DB exit qualification Date: Sun, 11 Nov 2018 14:22:56 -0800 Message-Id: <20181111221655.133959342@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -174,6 +174,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 @@ -2733,10 +2733,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; } }