Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6010968ybl; Tue, 10 Dec 2019 15:26:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxADfQwFa26wOcHAqBWqgGl3esUgP45x357PllyrIA7Od5CFsE+z7xIv+ULRdwohcbmuJmX X-Received: by 2002:aca:aa0d:: with SMTP id t13mr541670oie.18.1576020402805; Tue, 10 Dec 2019 15:26:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576020402; cv=none; d=google.com; s=arc-20160816; b=l6BZAiP0bNLe3PJHYWj2VOfH/HsiPgOEEIiznXN2t0m6elDpxf10L7QtSDdOWRIB8h AHEWy/FIoxLAxk9C18wFwT0KFXnhOwGyNfv0FpD1enBvJcGoBCtFAT7ILxUUbiIBvJhi HGGqBySu6ie+ZSfumxnH4/MAx+O9GBSqn9uRVscu2D63jsqcDy9NTOXBw/Kyxf4T0rYh UfDuZIvuxtQgDve58MJbVGsdi6jPZtbnltyk6GM3IdAcNWHZhQeGuOmpkn0MNR1xpksb uMDcx3JHhoSKCur11EUXklXsLGfNVII4TbGFZNQ5udEaDG0jSCXZMoLMsTYSlr63tRUo y69w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WF+KyNo4R8kXII8GuXj49tRA33g3fvToFblKW8/vsUY=; b=F0+zWuuvOTabEDgpsQ+unbp6srWIULvFPyQMFrBQpuXr/3X+6+EMs72EjxKtWF+yMi 1Y2kCAqBilmFXRtL3aT92w1kfQ2TBzlb+3tV8A1KZFAKxZGEXFmUsjKwCsFFSyCqO7Fc G0LO/eHFjcHOzWa0hgqu++Bru/Zm+S8KNW//qmq9348D3ee6fOPHhcVql4tSGARJhaCF vrEo8wlKJ88ey5jvt32cPaDvzF0xIGSgHqm7Seu/MfRMU0XoAvexhO4yhX0DUso+9+hb w2YrPUIQQXsNrrdOTbqe1Eo70XD9E8H5MYj8GmcJZ73qfnC5IEqK33DMEF7NOhfsVdSC +N2A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u18si66821oia.80.2019.12.10.15.26.31; Tue, 10 Dec 2019 15:26:42 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbfLJXYp (ORCPT + 99 others); Tue, 10 Dec 2019 18:24:45 -0500 Received: from mga17.intel.com ([192.55.52.151]:23344 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfLJXYf (ORCPT ); Tue, 10 Dec 2019 18:24:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2019 15:24:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,301,1571727600"; d="scan'208";a="210583769" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by fmsmga008.fm.intel.com with ESMTP; 10 Dec 2019 15:24:34 -0800 From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Luwei Kang Subject: [PATCH 1/2] KVM: VMX: Add non-canonical check on writes to RTIT address MSRs Date: Tue, 10 Dec 2019 15:24:32 -0800 Message-Id: <20191210232433.4071-2-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210232433.4071-1-sean.j.christopherson@intel.com> References: <20191210232433.4071-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 51e3b27f90ed..9aa2006dbe04 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -2152,6 +2152,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) (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 -- 2.24.0