Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6204915ybv; Tue, 18 Feb 2020 12:00:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzhCnV525333L/78PcGQTJw6GoAMUe77XB10MQshB+uwfvzjqg4DdlbZCgzsR9gPs9ZH0zP X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr17089817oto.355.1582056046107; Tue, 18 Feb 2020 12:00:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582056046; cv=none; d=google.com; s=arc-20160816; b=lb+1dLpjCMwtXPOgQKqfWEiKp/FM49TWKhTTxLp37G/0a04oOyC9evKxiXutdXKmcC +8PkRq6U2Xa4zYrc5QyFin8uWBcVf8l/fNY0D8Yd2AuNZixAaEmgqH6x+yRvyS67qeSU klhYT0qgm1Xes22LlqiONNdVwWKv0k4iaRgxyVEtcLlxtuLdrbsSfhL7kX9GB63VBzPt eyppu10ufQWYRF1PAADB1Gln6QK8Y/KpHXjFRfAec0JuWbl9n/qHOw1TCVgWwIQBRDVA BtE6qhwqQh5g803qjjf/K2Cg1xvUPZuNuK09kASfFbRP4c/icKMnz877EWyxEvpnW2xv DjLg== 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=b03f4mXeMdDHOEroPsoDbMlfxQFj9JDkZfxgWgiDU00=; b=UCszsjM7RCutukviL9BG9nYnTKtHT3IWKCGghusTyPrhMLTxxqXs0BenOlyo9HPqNJ 4BwDymeDof/I/g9emA48BJol1FhkuuUJ/olknX1dEdgjUe42AoEdC8x0mQRvqfRwIEp3 sih64bYdxGcDOkHO7LYyW5xejOTvXDBbByAR74SCx5qH2bbzuDfyBKgcCc8BuzvGX62X Ewr/6n6qHkjq+2bDBuEHiCbRFfT7NwLuHSpoTeUKY1cdafotzcuAub5q6JcBvMw0sXbC fXiThVl4luuDwPJYZnN+22AhPtaA44g+9JdkfRphXET8hYlwE5T5bKEerdeFvQDebvYK XNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fEeFe9vs; 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 9si8179246oir.71.2020.02.18.12.00.33; Tue, 18 Feb 2020 12:00:46 -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=fEeFe9vs; 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 S1728599AbgBRUA3 (ORCPT + 99 others); Tue, 18 Feb 2020 15:00:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:39554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728095AbgBRUAX (ORCPT ); Tue, 18 Feb 2020 15:00:23 -0500 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 EFC6C24672; Tue, 18 Feb 2020 20:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582056022; bh=7M1vMXCQS5hu++7duI5JtqPDkix7ApqrdOPr8r1xcB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEeFe9vshpK5BlJpxgjtc/aA6uUSD+LPvbcw5VA12oMi0OLoLCFhOQDxRAlU8ukG6 +PS/1VZGkWO3YPCBP5RVG0BcgbyWcdo5EntAGEgcgZLAnOpIyKnWTUgeOiivhW4IqW az4ovi+y3gzQDBaJS+M1Ks2zN5HxXLhVhOZoaDvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Upton , Paolo Bonzini Subject: [PATCH 5.4 57/66] KVM: x86: Mask off reserved bit from #DB exception payload Date: Tue, 18 Feb 2020 20:55:24 +0100 Message-Id: <20200218190433.347254952@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200218190428.035153861@linuxfoundation.org> References: <20200218190428.035153861@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Oliver Upton commit 307f1cfa269657c63cfe2c932386fcc24684d9dd upstream. KVM defines the #DB payload as compatible with the 'pending debug exceptions' field under VMX, not DR6. Mask off bit 12 when applying the payload to DR6, as it is reserved on DR6 but not the 'pending debug exceptions' field. Fixes: f10c729ff965 ("kvm: vmx: Defer setting of DR6 until #DB delivery") Signed-off-by: Oliver Upton Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -445,6 +445,14 @@ void kvm_deliver_exception_payload(struc * for #DB exceptions under VMX. */ vcpu->arch.dr6 ^= payload & DR6_RTM; + + /* + * The #DB payload is defined as compatible with the 'pending + * debug exceptions' field under VMX, not DR6. While bit 12 is + * defined in the 'pending debug exceptions' field (enabled + * breakpoint), it is reserved and must be zero in DR6. + */ + vcpu->arch.dr6 &= ~BIT(12); break; case PF_VECTOR: vcpu->arch.cr2 = payload;