Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5162070pxb; Mon, 15 Feb 2021 11:10:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA6beQG+1guLiuBiduXg537BHZp2kgCaZoqYIhUu4CzdKL86FQikV+bf7GlyeV5Pw4XjMV X-Received: by 2002:a05:6402:3514:: with SMTP id b20mr16910458edd.100.1613416199774; Mon, 15 Feb 2021 11:09:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613416199; cv=none; d=google.com; s=arc-20160816; b=tunk79YbjvIBHXKeQaHSeU0toeU8FB36UBjOFtTXTkzroBGQv9OZJDDBN5gx9TSxbe lBNg4n2oaRLsOC9y+MPUYpVcCk07gX8HRVnVdL0pnu71x7WIQK4WJlV4TTaXx5QlPd91 wLSgHZlI5IdIBZkWceMx++Bsp92bIR19t+YRWDnPzJUf74nifPQSmrFsFZSmPVfYlWuG QpVqSEcuhDG3i6joNzS4E/JPGPgjABGjzXKjRwWEc1nl4doKL1PkrzO0KCciVD6KG8aD PSfRxYvS37m0FJD0MKLhTLUkqD3krOyXw3qZMHZQcBK3POgAIbjgAtgvsuzmxuIebQm7 iurw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ImJRI1yuJ7O4+8pVfGV5azZCf98csp8Xgq02hsPklo8=; b=ArvwDxjpE3t9c4KCAf68wSG/ff/wa8mbf2SiDTsKlcOyt7pPwyhFltcw/jJgCgLeFE 8YMldVLZGi35n5Re6XxFoDnggTNfTbPJgrbN1QyOpQsaAkF4ABu5czph9+yFeyaO8YEA odiXIlVHhBtRW+MRj3Jzqz1KoRZjqGdr9lucS+nJwWTgORATUlKnUEIW0H39GuPehrv/ N0X+DMxxw617wpceGq5p9/Mv5JHFKx2QSzdQNozNOnUfJM7i1F6h7lYAv6yjM0k13NU4 ipcaXH/i9DBbVFXPYjPuVzSCxru/PulueJ+IWw2H97f+GHW3QPMeX7Q6SuT4a1NrFtbc +2hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PkhSB2vX; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si16530675edc.514.2021.02.15.11.09.36; Mon, 15 Feb 2021 11:09:59 -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=@redhat.com header.s=mimecast20190719 header.b=PkhSB2vX; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbhBOTGP (ORCPT + 99 others); Mon, 15 Feb 2021 14:06:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41920 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbhBOTF6 (ORCPT ); Mon, 15 Feb 2021 14:05:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613415871; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ImJRI1yuJ7O4+8pVfGV5azZCf98csp8Xgq02hsPklo8=; b=PkhSB2vX1t0B4pK3Gkw1ULtz5q14KXiXyKqaHm0xG10TUWo6qwCODiIwBYbNS/pJyuUDNf ag6cUFB9nQjquwKHn3qH1Z4hyuLpN2v1MMPuCAleS4jMqa1fufBloqtW7P1M1dyK9YGrhy tOxYGi1kNkkwYRgu2BP5LBYVcnO1ySY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-445-xHf1PWq8Mz2YXnzNEzSIHw-1; Mon, 15 Feb 2021 14:04:30 -0500 X-MC-Unique: xHf1PWq8Mz2YXnzNEzSIHw-1 Received: by mail-wm1-f70.google.com with SMTP id s131so7625831wme.7 for ; Mon, 15 Feb 2021 11:04:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ImJRI1yuJ7O4+8pVfGV5azZCf98csp8Xgq02hsPklo8=; b=pxDIa9BJwTRZQS3riChKR7rTfVlH7feAY1VqNXsUKIJFjK/qRLIxaZwI+uj0mnsfMN XDjfy2u+F1pOWJWeN1ZU2ul6Vwh7sATJgyrktv+HLy9W/BfJXxdSPx/opUIu/andk4gx DgVJ2Sfq9r0cfqk7qdwMOWYSuH3G4MfBJfL2aTXzf1dxjZnHiLaObnnWMRmXD0T18fnv oGMu3sczvmmisVemk9iut4wCsAz8KhRGkcfyvTAAs2dPqjRvNCOFPWCGXbhlHiQAYPGw 0p90f35BNJ9AwFqJj5A1TghaxWrXD2swudrTL2JDJuijqHSFp2A+kIWMBgIjD4+l4JcE Er7Q== X-Gm-Message-State: AOAM533soo95aY9btfa5JpXKS9TNOshJXrciJroynm1VJKTEPK053glu FXE5UJSmF6VVunYZMDmGB9ZqRuYConS/jMgU1nSDsEzPDvUDA700gJIvDMaq7GhI/nTyZYI4lg8 YCHxUKBTDbh0AQsXTBbXzEipG X-Received: by 2002:adf:bb54:: with SMTP id x20mr20480953wrg.112.1613415869037; Mon, 15 Feb 2021 11:04:29 -0800 (PST) X-Received: by 2002:adf:bb54:: with SMTP id x20mr20480939wrg.112.1613415868802; Mon, 15 Feb 2021 11:04:28 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id c9sm278741wmb.33.2021.02.15.11.04.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Feb 2021 11:04:28 -0800 (PST) Subject: Re: [PATCH 5.10 048/104] KVM: x86: cleanup CR3 reserved bits checks To: Pavel Machek , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sean Christopherson , Sasha Levin References: <20210215152719.459796636@linuxfoundation.org> <20210215152721.031370031@linuxfoundation.org> <20210215184644.GA8689@amd> From: Paolo Bonzini Message-ID: Date: Mon, 15 Feb 2021 20:04:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210215184644.GA8689@amd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/02/21 19:46, Pavel Machek wrote: > Hi! > >> [ Upstream commit c1c35cf78bfab31b8cb455259524395c9e4c7cd6 ] >> >> 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. >> >> 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, struct 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. I'll check that c1c35cf78bfab31b8cb455259524395c9e4c7cd6 is enough and send either a backport of that one, or a fixed patch for <= 5.10. Thanks Pavel. Paolo