Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1346917rwb; Tue, 27 Sep 2022 11:42:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM431eWnmVGvuw7Z+rrq2tJHBQhyoekkMLzxRx3fK5QXax/MFOEsHlmQgHdEuzhrA9EqEbzj X-Received: by 2002:a63:1508:0:b0:438:eb90:52d1 with SMTP id v8-20020a631508000000b00438eb9052d1mr26101784pgl.252.1664304158533; Tue, 27 Sep 2022 11:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664304158; cv=none; d=google.com; s=arc-20160816; b=XXlLY8tJf0q3dmAZzPK9ZdDhWpGyfOR129/cTqZ44M/HhiaYz7i9XRkI/yJ8jeMIpz cLJ3IfETFrEVVIqKdmwIyXySZbtTuzC+DBHj7M0E4wOMj8fCf3FmK4g2hX8m7BNHE5EV NOzmksbEEWOO6uELLJ6EQsE7f2LKDkZVASISI12VC2z5Wwo3kr9jHRjERH+NaLIYRcAI bgIGOsmZiFMBOn++xqnP4xOiSOi7luL4YPepfWsLutaJNfQdYwCWY2JDLknCfVWVRvkU VoMdTLJfGFHT+JtFnRb5z6CCW0YBkZidetW4qCeqLXFcMhzD54lUfJhAOYj1/JkssfBm 4OzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=0OUyaU2W6ySWWGDJr9ms2RWPJJi8JI4G01p2s1rsbVA=; b=j7NSGXvKp+vt6o9eldByCxLjy4UIDf1kTEPjLxA6JxP4kMXoDAUc8aJjyq2l5vkglo +59WuzrPbFczVb58egjx7n9a082xtUlxP17XQmYa7x/ejDaHwjEuDYl7dpkXZfgC9WIg cpmchXoHWMvMq1U8FGw9v91K3zYDxiCEHO2oJAZHk7XPpCkrvJPhNxOTLofieUeRajPZ FId9IlADbPQ4ROz557lXjA++3ZNGHBq3MmkMJ6GW8mvTMH9sKrqMJ/s707GCwsZ0BX6R +RfR/lMmvrRv2nl2oMI0thXKYvWvxGmkzXgzHWFig3lTY+fZFsY1WKrwiX/6SwUARN5P AXMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VEISxDmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a63110c000000b004360383b3a7si2497072pgl.185.2022.09.27.11.42.25; Tue, 27 Sep 2022 11:42:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@intel.com header.s=Intel header.b=VEISxDmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbiI0RLD (ORCPT + 99 others); Tue, 27 Sep 2022 13:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231802AbiI0RK6 (ORCPT ); Tue, 27 Sep 2022 13:10:58 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B20DFB32E for ; Tue, 27 Sep 2022 10:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298656; x=1695834656; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=r8qgJjScy6RDWKbO5ZguVDjydkbLQqYVIQpzxlqrb7g=; b=VEISxDmmVXIIa1aOmjH5bXKwGJfXktHinokr4mvdXqQ1/aezSHaMMiss h8UlX5FQlrV/7FB1NBuGFogu8EdhoXCJ6e+37h1GXMicnl7xfJWwlkhez 5TkutaRSe3UQt07o6Nl+/QnacM+MMcXe672iXNF9Y5eb1OPUyaK3cSBcU 2140TlmT2Muduo5FkekcdlIOXKWiYy/OdGGrvW/gV5weQTFRxQfybxOww GQIUmETg6SFTXzDc5KFLbU/VnxhX87xv7A6ZnaRtKCPU4gE6Y6AFyFRsc MWOYsKZTBy9+fopS0iEQ5bFLpj1KyXeUXKW0JDFffgdQtCE2Lm8CuzkG6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="302853943" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="302853943" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:10:56 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="616903090" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="616903090" Received: from mgateho-mobl1.amr.corp.intel.com (HELO [10.255.229.33]) ([10.255.229.33]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:10:55 -0700 Message-ID: <51eeb843-204f-5b9d-9f7f-9bf3c22d2c00@intel.com> Date: Tue, 27 Sep 2022 10:10:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v5 1/6] x86/sev: Fix calculation of end address based on number of pages Content-Language: en-US To: Tom Lendacky , linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "Kirill A. Shutemov" , "H. Peter Anvin" , Michael Roth , Joerg Roedel , Andy Lutomirski , Peter Zijlstra References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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-kernel@vger.kernel.org On 9/27/22 10:04, Tom Lendacky wrote: > --- a/arch/x86/kernel/sev.c > +++ b/arch/x86/kernel/sev.c > @@ -649,7 +649,7 @@ static void pvalidate_pages(unsigned long vaddr, unsigned int npages, bool valid > int rc; > > vaddr = vaddr & PAGE_MASK; > - vaddr_end = vaddr + (npages << PAGE_SHIFT); > + vaddr_end = vaddr + ((unsigned long)npages << PAGE_SHIFT); Could we please just fix the fragile typing that cascaded down to this point? Shouldn't 'npages' in this interface be a long? > struct x86_guest { > void (*enc_status_change_prepare)(unsigned long vaddr, int npages, bool enc); > bool (*enc_status_change_finish)(unsigned long vaddr, int npages, bool enc); > bool (*enc_tlb_flush_required)(bool enc); > bool (*enc_cache_flush_required)(void); > };