From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2FC6F2119AC24 for ; Mon, 10 Dec 2018 06:52:46 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 06:52:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,338,1539673200"; d="scan'208";a="100357956" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 10 Dec 2018 06:52:46 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 06:52:45 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 06:52:45 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Mon, 10 Dec 2018 22:52:43 +0800 From: "Gao, Liming" To: Ard Biesheuvel , "Wang, Jian J" CC: Andrew Jones , "Wu, Hao A" , "edk2-devel@lists.01.org" , "Kinney, Michael D" , Laszlo Ersek Thread-Topic: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account Thread-Index: AQHUjh9AxmIlTMI7Lki6FrlPuLey6qV2tuSAgABY+oCAAQLmYA== Date: Mon, 10 Dec 2018 14:52:42 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3898F8@SHSMSX104.ccr.corp.intel.com> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> <20181207112304.19765-4-ard.biesheuvel@linaro.org> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjM3MGMzZmUtYzc4OS00MDM2LTlhOTAtMzk2NGQwMzg2MTZmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVmo2bzd4VjhPWVk3NnppV0tFaU95Z1pqbCtJdDR2WUk3WE5DdFVlZXJacmpWdmd3U2luT2VPZWl0Y3BWWDYzRiJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Dec 2018 14:52:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard: I prefer to define MAX_ALLOC_ADDRESS together with MAX_ADDRESS in Process= orBind.h. I don't want to leave the choice to override MAX_ALLOC_ADDRESS de= finition.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ar= d Biesheuvel > Sent: Monday, December 10, 2018 3:23 PM > To: Wang, Jian J > Cc: Andrew Jones ; Wu, Hao A ; ed= k2-devel@lists.01.org; Gao, Liming > ; Kinney, Michael D ; L= aszlo Ersek > Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC= _ADDRESS into account >=20 > On Mon, 10 Dec 2018 at 03:04, Wang, Jian J wrote: > > > > Hi Ard, > > > > I think MAX_ALLOC_ADDRESS will affect other archs besides ARM. Please d= o enough > > test for them (IA32/X64 for my concern). > > >=20 > For all other architectures, MAX_ADDRESS =3D=3D MAX_ALLOC_ADDRESS is > always true, so these changes only affect AARCH64. >=20 > > In addition, do you think it's safer to replace MAX_ADDRESS with MAX_AL= LOC_ADDRESS > > in MemoryAllocationLib like following situation? > > > > (MdeModulePkg\Library\DxeCoreMemoryAllocationLib\MemoryAllocationLib.c) > > VOID * > > InternalAllocateCopyPool ( > > IN EFI_MEMORY_TYPE PoolType, > > IN UINTN AllocationSize, > > IN CONST VOID *Buffer > > ) > > { > > VOID *Memory; > > > > ASSERT (Buffer !=3D NULL); > > ASSERT (AllocationSize <=3D (MAX_ADDRESS - (UINTN) Buffer + 1)); > > ... >=20 > This assert ensures that the copied buffer does not extend across the > end of the address space and wraps. This is a separate concern, and is > similar to numerous other occurrences of MAX_ADDRESS that maybe we > should update as well at some point. However, it does not affect page > allocation at all, it only puts an upper bound on the *size* of the > allocation. So the changes as they are will be sufficient to ensure > that AllocateCopyPool() does not allocate from a region that is not > addressable by the CPU. > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel