Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3699596ybv; Mon, 10 Feb 2020 04:57:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyarnjs1JIBS/Eu/sBYRGmUtbfjfsSU/ftbhyWPoNYGMDQ0ejwOoeZ2B/otZfaDAIEtSvtO X-Received: by 2002:a9d:6f11:: with SMTP id n17mr949134otq.126.1581339458254; Mon, 10 Feb 2020 04:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339458; cv=none; d=google.com; s=arc-20160816; b=zhq3EGZROesRZ8fGGujBwfs1T5Z1MZv7SArm6OjLi1JLC//xfXe3bOjl9OWY3clcjf x0lJq+E/fpcSuZEyjfbOYSUg0h4p3NXgBywe7wTwcmel3oS/R9oUklv+UwhymgnrnFxM 75j6exaoxCx8dhZHgz7oMxR33tvwV9Tss/zOuAeczwzWmNo3aHs0vhg7y2xOzjdAWnR6 E0/TNCYfFMP7Fx7L3xSQHeo9+7ruZWH6Q2u5bg7oSFBxqO4pMWRtb4OTDua4p7Vd0r7i 6MKoVtckS3+oDN9F16NRiOTSi5SqCDRYyzP7Mkny/kvhChYeE00Xlrp2aFEN4/B3Kcqz DlGA== 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=NN5y2REJsMIKGf2qbhqsmZf5dQ7EDLTqGGX6zdRx3qI=; b=WLxzDhHKz3eVZFbB/UFxCTqConI6QCT2GX2yIWuJ7lANIwBH374HK+2OhFi5sn9QnA 3+qX5u09mjPfi9nbChA9z7A+vxk9yAUi3wzbwHWoq6H4xsruzidWv8vdKq0NmkPoewQt qOrcKar57/cYSHoi2noD9t1TKpr5AApoT5Z8J9nOuoT6Ci5lZha8sNx46NduBBwXWhxx LLBTKMKVwK6PgV1AoX5cbksa/z2SMXVIJkV2SCUPZrTujhv0sRzY3KdDXW7bTrpdfHcs 2Jp5y3DsTiTH9YP/d7qNyH5cMn2+aCxk+MfE+lyW9GcI/RpU57EMzGXKqVo8xl7JRGLB Lj0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1JNi4r0D; 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 q195si136748oic.83.2020.02.10.04.57.26; Mon, 10 Feb 2020 04:57:38 -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=1JNi4r0D; 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 S1730046AbgBJM41 (ORCPT + 99 others); Mon, 10 Feb 2020 07:56:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:44366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730041AbgBJMlj (ORCPT ); Mon, 10 Feb 2020 07:41:39 -0500 Received: from localhost (unknown [209.37.97.194]) (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 1CA30208C4; Mon, 10 Feb 2020 12:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338499; bh=evifrWkT2Z0Yki/6O4b+V1Z5s99CuQPgLJk5Bx1nAzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1JNi4r0DEwTmq2K2Du2+xe7E7BsbYTrErmNjIcC7Bs8U5LUeUHZPcrfBllVuMeNY3 Es6ipVY1Q/+gv4cwTgamq0OfW+pMRupPf+HSSl0kbTf1CJSlFNSkue+zaiIa2WHNdV Ra94IaKoTWe8faL4KmKo6GPEwJhh/PUoPNg8dilg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.5 251/367] KVM: VMX: Add non-canonical check on writes to RTIT address MSRs Date: Mon, 10 Feb 2020 04:32:44 -0800 Message-Id: <20200210122447.361284302@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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: Sean Christopherson commit fe6ed369fca98e99df55c932b85782a5687526b5 upstream. Reject writes to RTIT address MSRs if the data being written is a non-canonical address as the MSRs are subject to canonical checks, e.g. KVM will trigger an unchecked #GP when loading the values to hardware during pt_guest_enter(). Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -2146,6 +2146,8 @@ static int vmx_set_msr(struct kvm_vcpu * (index >= 2 * intel_pt_validate_cap(vmx->pt_desc.caps, PT_CAP_num_address_ranges))) return 1; + if (is_noncanonical_address(data, vcpu)) + return 1; if (index % 2) vmx->pt_desc.guest.addr_b[index / 2] = data; else