Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4173843pxb; Mon, 8 Feb 2021 09:36:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzF1GBQqb6itdxeQuHSYXpm6TtQs3bi1xcuA0fdLHjrLyCnXM86ccliWgMLr3v3pKF+msS9 X-Received: by 2002:a17:907:20c4:: with SMTP id qq4mr17041048ejb.495.1612805766241; Mon, 08 Feb 2021 09:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612805766; cv=none; d=google.com; s=arc-20160816; b=g/mgvLrpo0OTAXy7h/11/zUL12ZtU/anb+uz/OfkpbOK2k+E2gmODTMhiFb2BXs2Fg SOSZELt508GD25yVn8Sn586r7GFyEsYBp15+YGxvGF0qLf9e6ksUhrE9UpV//XvYSw5Y G/dlpQSWtAS+sRNqssFtxOn2+nBMvxRYX0h15o7ES43ofWfM4DmQzHjcqLkPKuctk2eT YoT09B+WXhCAPjNIybny26DaDTXAc/h+2gJpQAQdynpu7a60QmWfm85GEb+3bcH8gycI pcfkJkl+EbLj866PVlsvWydsnfKbV3uea6fDGEdDjJrmYQGXTpRenKIYvAMdJ9mgdv+v H9vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D5fh3DywLTSD72P06vl8ZZ9CMa4xUvzTEGDkyQ8hzyY=; b=iDvJ1mM082dJBsO4P83iVbb05isXeyo+ZtHBmVLFwFAnMxt02vuijKFf+k0gAHTEK7 7fxVufODpdjWWuNhT3TrK3iTlPLORz8WzBCMlhDyCh8LjfDUhbb9Li2UsnVAMgyXOS79 e1v6rEI7VS8W/KijpnarjbksaG30hJ2XEz7KbCmolg8LzYD2Gy0121U+aSnaVEdmK5EE B2XbjMT2iGMn7BKVp6CjBrciLsGCk169HzNlt7xmL7+k5zrKJMcBVp2ENcq1VGEW//KF 9yQgn5gORdrPiGGG6Ck4+ZYrHtdpefXdZI/gxtYitSwlQ8ldZVkv9fkRssdQXPxP4H+X YXmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rq8d4nOw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id he44si10943543ejc.386.2021.02.08.09.35.42; Mon, 08 Feb 2021 09:36:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rq8d4nOw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235003AbhBHRdG (ORCPT + 99 others); Mon, 8 Feb 2021 12:33:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:37472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbhBHP3X (ORCPT ); Mon, 8 Feb 2021 10:29:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9248964F2A; Mon, 8 Feb 2021 15:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612797394; bh=9aN0FJX0jOlDuAPMqXBlCxY3IMNfEnOHwsCbfDjUC5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rq8d4nOwQ2UOalSPBkgBhum/LSzYY8aRcBLPtpxGW08kKLd5zmmN3nyy7QUYDfvjw Tu1aFHI1JLfqHhzAta5GRqbo8XXOTEUZF6kyZ7ugBd7e9vsZ39jvLrVy05ue2RNTXN TpdHw8vX7l+jjPiF39foU3Q2kxItuLTPHEHPRlag= 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.10 093/120] KVM: x86: Set so called reserved CR3 bits in LM mask at vCPU reset Date: Mon, 8 Feb 2021 16:01:20 +0100 Message-Id: <20210208145822.104891461@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145818.395353822@linuxfoundation.org> References: <20210208145818.395353822@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 031b91a5fe6f1ce61b7617614ddde9ed61e252be upstream. Set cr3_lm_rsvd_bits, which is effectively an invalid GPA mask, at vCPU reset. The reserved bits check needs to be done even if userspace never configures the guest's CPUID model. Cc: stable@vger.kernel.org Fixes: 0107973a80ad ("KVM: x86: Introduce cr3_lm_rsvd_bits in kvm_vcpu_arch") Signed-off-by: Sean Christopherson Message-Id: <20210204000117.3303214-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9915,6 +9915,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu fx_init(vcpu); vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu); + vcpu->arch.cr3_lm_rsvd_bits = rsvd_bits(cpuid_maxphyaddr(vcpu), 63); vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;