Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5150287pxb; Mon, 15 Feb 2021 10:49:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOIdiojI9D83/Kk7KnNOOd67j/eBCkHYfx+CyAq0vx5fiyWmldZaXmp2uTEpnwU7/FMtmC X-Received: by 2002:a05:6402:164a:: with SMTP id s10mr17220509edx.37.1613414960312; Mon, 15 Feb 2021 10:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613414960; cv=none; d=google.com; s=arc-20160816; b=NiI0DOWyvcTa0FLdcfyWaZguCRNne6N97vt0hXjapY8IzE5exXBwxlldSgRMkf9CL8 ehFLqDdV4K6yAAU4deSQy0HYlCmelc9OJ5rZ9/SA7myV53AuTDmPCuV7XUo2L9kCAAm3 nU/Ck+lL4vw3zQOHDlav6/XBpZO5BzizaI+eTR922ZXx1l+Bb3e8jDO7j2mgFNYNQ4yV K6J7B+pTSpvqqBUq0m5VZMBOW1I4Ks/2TgVkwkq8HM8Vec9dlZ6BZNn+xgCN7B6kblYH g7OyQ2cb56lzxh4dU6721Bb+gYN67+0UrNyFabunF8s6Ow1cvjDHnZbnDhzNB0Uinbs4 2VQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SEbT6mSLKLX9dP/eg88W8wrGwoxtwT/xkGbQc5xFqd4=; b=FqFYXeng3+JvYfzOu4Jyt04KMCkA45ukXVIBxO1CRQkO438Bx+58qmhpasOYftKVCf 4J28Mp2ycVKarX8vlieaaA2trgJU8lTfvpUFOUxoGf/QsfV+y4q4mE5AEjsXV/0Qae5j 9OPzBmf2orYrEPk8gEHfhEbWRgWM4H6If+Ndo8asagszCRQYKShqxLzuRomkFJh5nJHL CjJm4kJVePUe+W8+kDdG4fto2W/3p3uX6S7FmSSXvSs275pzwZcotNWT55L5lMaoZOb9 /vWQ6i2c7LUAG+2uBP8AfVgq8LUN/2xXOW6Y6DaRdXyvZ55gWx5vobdF+fQdruiPy4En c5TA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z29si7761048edm.593.2021.02.15.10.48.56; Mon, 15 Feb 2021 10:49:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbhBOSr6 (ORCPT + 99 others); Mon, 15 Feb 2021 13:47:58 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:56648 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231236AbhBOSrm (ORCPT ); Mon, 15 Feb 2021 13:47:42 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id BA50F1C0B76; Mon, 15 Feb 2021 19:46:45 +0100 (CET) Date: Mon, 15 Feb 2021 19:46:44 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: Re: [PATCH 5.10 048/104] KVM: x86: cleanup CR3 reserved bits checks Message-ID: <20210215184644.GA8689@amd> References: <20210215152719.459796636@linuxfoundation.org> <20210215152721.031370031@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20210215152721.031370031@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > [ Upstream commit c1c35cf78bfab31b8cb455259524395c9e4c7cd6 ] >=20 > If not in long mode, the low bits of CR3 are reserved but not enforced to > be zero, so remove those checks. If in long mode, however, the MBZ bits > extend down to the highest physical address bit of the guest, excluding > the encryption bit. >=20 > Make the checks consistent with the above, and match them between > nested_vmcb_checks and KVM_SET_SREGS. > +++ b/arch/x86/kvm/x86.c > @@ -9558,6 +9558,8 @@ static int kvm_valid_sregs(struct kvm_vcpu *vcpu, s= truct kvm_sregs *sregs) > if (!(sregs->cr4 & X86_CR4_PAE) > || !(sregs->efer & EFER_LMA)) > return -EINVAL; > + if (sregs->cr3 & vcpu->arch.cr3_lm_rsvd_bits) > + return false; > } else { Function has different return type between 5.10 and 5.11, so this needs fixing. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmAqwZQACgkQMOfwapXb+vJgkACeN1p7SnT9C+Qaj6PP66/1I7Ed XP8An34INGsMCRNTWHZAkXh661eaS0Ko =zfyL -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--