From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 236C081895 for ; Sun, 26 Feb 2017 22:43:23 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2017 22:43:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,213,1484035200"; d="scan'208";a="828788091" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 26 Feb 2017 22:43:22 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 26 Feb 2017 22:43:22 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 26 Feb 2017 22:43:22 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Mon, 27 Feb 2017 14:43:20 +0800 From: "Gao, Liming" To: Ard Biesheuvel , "edk2-devel@lists.01.org" , "Yao, Jiewen" , "leif.lindholm@linaro.org" CC: "Tian, Feng" , "afish@apple.com" , "Kinney, Michael D" , "lersek@redhat.com" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v3 2/6] MdeModulePkg/PeiCore: allocate BootServicesCode memory for PE/COFF images Thread-Index: AQHSkF5xqhFLw3uCOEmLAMF/xu4Ew6F8V70Q Date: Mon, 27 Feb 2017 06:43:20 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6E4EB9@shsmsx102.ccr.corp.intel.com> References: <1488133805-4773-1-git-send-email-ard.biesheuvel@linaro.org> <1488133805-4773-3-git-send-email-ard.biesheuvel@linaro.org> In-Reply-To: <1488133805-4773-3-git-send-email-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 2/6] MdeModulePkg/PeiCore: allocate BootServicesCode memory for PE/COFF images X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2017 06:43:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard: In line 128, there is another AllocatePages() to allocate memory to stor= e the code. To be consistent, could you help also update it?=20 =20 Thanks Liming >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard >Biesheuvel >Sent: Monday, February 27, 2017 2:30 AM >To: edk2-devel@lists.01.org; Yao, Jiewen ; >leif.lindholm@linaro.org >Cc: Tian, Feng ; Ard Biesheuvel >; afish@apple.com; Gao, Liming >; Kinney, Michael D ; >lersek@redhat.com; Zeng, Star >Subject: [edk2] [PATCH v3 2/6] MdeModulePkg/PeiCore: allocate >BootServicesCode memory for PE/COFF images > >Ensure that any memory allocated for PE/COFF images is identifiable as >a boot services code region, so that we know it requires its executable >permissions to be preserved when we tighten mapping permissions later on. > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Ard Biesheuvel >Reviewed-by: Jiewen Yao >--- > MdeModulePkg/Core/Pei/Image/Image.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > >diff --git a/MdeModulePkg/Core/Pei/Image/Image.c >b/MdeModulePkg/Core/Pei/Image/Image.c >index d659de8b3e64..8cc9ed93e9b6 100644 >--- a/MdeModulePkg/Core/Pei/Image/Image.c >+++ b/MdeModulePkg/Core/Pei/Image/Image.c >@@ -453,12 +453,16 @@ LoadAndRelocatePeCoffImage ( > // > // The PEIM is not assiged valid address, try to allocate page to= load it. > // >- ImageContext.ImageAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN) >AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize)); >+ Status =3D PeiServicesAllocatePages (EfiBootServicesCode, >+ EFI_SIZE_TO_PAGES ((UINT32) Al= ignImageSize), >+ &ImageContext.ImageAddress); > } > } else { >- ImageContext.ImageAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN) >AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) AlignImageSize)); >+ Status =3D PeiServicesAllocatePages (EfiBootServicesCode, >+ EFI_SIZE_TO_PAGES ((UINT32) Alig= nImageSize), >+ &ImageContext.ImageAddress); > } >- if (ImageContext.ImageAddress !=3D 0) { >+ if (!EFI_ERROR (Status)) { > // > // Adjust the Image Address to make sure it is section alignment. > // >-- >2.7.4 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel