Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13123510rwl; Wed, 4 Jan 2023 04:01:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXvIez5OZfRDmgASCPhgEGGk4OWVBvHkt46olMHXjmSwhtU8TdVFDtjBKh7KbMtD0nJ2Em5b X-Received: by 2002:a05:6402:448a:b0:481:9219:f603 with SMTP id er10-20020a056402448a00b004819219f603mr34843494edb.28.1672833702905; Wed, 04 Jan 2023 04:01:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672833702; cv=none; d=google.com; s=arc-20160816; b=wxIaXV3eWeqYv6RXOPqCXd3veD0ZWnNp/gYJeUZP6ceydq+GLl6yqqAuGrAhPkpP+K IsMmwtgy2uyoEartQLCWWHeEMo2A46hGqvx2njqTRHiVhlgEtUffSNBNdT5Ya++EDyee bqZzSzdcMudZOkBtoB5jLBXvMD1AMEc4KzuRcoiLa0LiOmu2syimobf92WuLvqa2/Ts9 2zaYuRGOFh790Ca9kmxEmIIY/1FYhJ2um2NyYoMcZFpEEiIYvPXTtlcOpYV+7BWYL9Kt 5l1tm7n2vbWBR1GvSfX9REQPzHlXV3NQCNuytRIaw1E/ZWNlYSorYV81QAxFZri2ctjU aUkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gyThIG2e5Nuis/QgAuN3yERUQBkbMWISTq+6xkKDJhg=; b=ICKtseR7lPd186qSkH0goPyYF9sE/ue0GshpqoWzdpXsQDDtbFHDGGbcw45bLyajll dfchWdshuGnAXa/z7qMuCBP9vfXyN/ucBPObL8JLLVG8t4cJu20IxPaJ/ovqXjMi1ba+ xNVZqD1W3xCDj4K3wy1+r0mT5M8eswS1dLybC/feN+k9cTnrMATSDGYDnh0azKEyM1en giOykonzCaGJSJCcqDLLw6LM/tjNkmKeLAk3BbX1zEThJ+NkkF1sSXY6cWJqv9AI1LAw 2aCHqFQMiXbkAso89xzzvFeLeMyjiJ5Lye+Q/TDGKXUYnSn4vSgBRSKX24K8ghKlMTm0 MwYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AkDX3AW3; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056402359600b0046bd9b65cd9si33641957edc.242.2023.01.04.04.01.18; Wed, 04 Jan 2023 04:01:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AkDX3AW3; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbjADMBQ (ORCPT + 99 others); Wed, 4 Jan 2023 07:01:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239170AbjADMBK (ORCPT ); Wed, 4 Jan 2023 07:01:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E9511EEF0; Wed, 4 Jan 2023 04:01:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FA1561426; Wed, 4 Jan 2023 12:01:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C3F7C433EF; Wed, 4 Jan 2023 12:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672833668; bh=AdBBHs+vk1+ihc9nifYgy4qWtVZl+0uaE+N5wIA1lqc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AkDX3AW3ufOyf1t0bKZaO2Gtqi7D7Wz54W2mFvnJH9m8ej+laXvXn9GSBlgHIICxm w0U56pDRDj0LdPBkcOArbb+3lN+0IV/Sk3I/EXEPtlZqWN+7XIdrxcuFbQ/No61WEj 62FOq83Fp+bXKmRWVaSVIKFApzZdWcirAFHKVfLVTVK7eaL7Wk0BAtpBg3a3wgDG8t O4Z4yfA9JIUGiWo5d77UocfLCSxCov/XUKloGPNhriB6Fkl/WmmJkbRNcslivZI2eg UPHeUy+YcAAikJyhIDvoCVN7MDFvYG2xARtJwPEdQp3HylEuFaYbaswDsXg5DbcH6r xydmzduMxp9GQ== Date: Wed, 4 Jan 2023 12:01:05 +0000 From: Jarkko Sakkinen To: Michael Roth , Chao Peng Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, bp@alien8.de, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, ashish.kalra@amd.com, harald@profian.com, Nikunj A Dadhania Subject: Re: [PATCH RFC v7 01/64] KVM: Fix memslot boundary condition for large page Message-ID: References: <20221214194056.161492-1-michael.roth@amd.com> <20221214194056.161492-2-michael.roth@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221214194056.161492-2-michael.roth@amd.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Dec 14, 2022 at 01:39:53PM -0600, Michael Roth wrote: > From: Nikunj A Dadhania > > Aligned end boundary causes a kvm crash, handle the case. > Link: https://lore.kernel.org/kvm/20221202061347.1070246-8-chao.p.peng@linux.intel.com/ Chao, are you aware of this issue already? > Signed-off-by: Nikunj A Dadhania > Signed-off-by: Michael Roth > --- > arch/x86/kvm/mmu/mmu.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index b1953ebc012e..b3ffc61c668c 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -7159,6 +7159,9 @@ static void kvm_update_lpage_private_shared_mixed(struct kvm *kvm, > for (gfn = first + pages; gfn < last; gfn += pages) > linfo_set_mixed(gfn, slot, level, false); > > + if (gfn == last) > + goto out; > + > gfn = last; > gfn_end = min(last + pages, slot->base_gfn + slot->npages); > mixed = mem_attrs_mixed(kvm, slot, level, attrs, gfn, gfn_end); > -- > 2.25.1 > BR, Jarkko