Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6208160ybv; Tue, 18 Feb 2020 12:03:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxOV4U7iTzNsc5+RPnKnnyFdixtpOX+J78Ngzr3llegRXaSxMmEZ7YbBvMMNgwXa5L7fqu5 X-Received: by 2002:a05:6830:10c6:: with SMTP id z6mr18130313oto.203.1582056210806; Tue, 18 Feb 2020 12:03:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582056210; cv=none; d=google.com; s=arc-20160816; b=N5lj223xuPWPoVcTnf6KAu/yyZTYyY1K7Gn9ya5hi64tdgClkZeG5lJ3WRwicAR3lZ y7MvY/gmgSg9POZck+zttRnlQroLiF0HUcIMyy3Qv15DaWCcE+7Z1mOwY8HPAcXm4FOt lhAaH4C1HewBF2Jul9/SdvePrllWVYJBfaRU4vZSLASas5oKGdJFkI39bUmpNdfaHsiz m1lYM1Zpf9VUC+i4MvYNhqoWlpbFM4+ubEwOOSI417im1UYqNP0vVlbhdyIc0StmISbc cPXJWyx/+jAakSprbmUFTxUZpSrAQgV9eEPJqcpg4UieSO0p1ov/t7Rl6tbca4Hq7U/8 xuBg== 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=6dEd9G0J2xGoqwdChmkVN6Kt3Ekylu/JDQBRb44K2Ik=; b=vgP6V39AYkKLX3Nhcgzco9ho04603cimda0+pR10bKngBg8627mkcWDVgvY4xgG5AD DgYhHgXOBloweQx2W35O2ObVrot39DpzsNIEGgPlB3TNxyBk0FmK2HYGaclFs1ObfOiN S5mYXbHSKTVRoRSRjok5hxqzNiNSS3CxNwxHnwFkQJwYBSQm2rLONOrX7p5sYJM1liGq Cq6t6dYsY+1leyDAut5P5hHAz6p5rGjMRfVldDuUTUi56/Axu9mp+AKJc6TD2q2W99K9 hJ2SjOWzcitDoiVSYvf/TpAd3BCludySgqykhFclK6nebG2raecs8Y6tozliScGnRrAe OchQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hNai7Qpx; 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 r82si8389693oie.116.2020.02.18.12.03.18; Tue, 18 Feb 2020 12:03:30 -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=hNai7Qpx; 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 S1729088AbgBRUDQ (ORCPT + 99 others); Tue, 18 Feb 2020 15:03:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:44340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728871AbgBRUDN (ORCPT ); Tue, 18 Feb 2020 15:03:13 -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 8B1222467A; Tue, 18 Feb 2020 20:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582056193; bh=Q1xkFydBbWJIb3KftKavEfiznyZtcB2ryykPOajvrnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNai7Qpx22A42h409DPmcrMOZe2wizxuDr4ispbEUyUs7/VmwKsuMNgy6kRWLNpQq NPypwz6PGrGcbY89SnXjFuY0mCE5aB/6NXLUV+8GIVyWdZb5Z/fNHMFXY73gymkY1a bnBaPaI8SGhpyC9qod9Xsy7XX/4lK77NjCfw8uPE= 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.5 69/80] KVM: x86: Mask off reserved bit from #DB exception payload Date: Tue, 18 Feb 2020 20:55:30 +0100 Message-Id: <20200218190438.532451378@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200218190432.043414522@linuxfoundation.org> References: <20200218190432.043414522@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 @@ -437,6 +437,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;