From nobody Mon Feb 9 07:05:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50061+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50061+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1573046017; cv=none; d=zoho.com; s=zohoarc; b=KObS8ZeZX7rD+6YQRlm8lz03sR96kTGXq/Xkxmoa1PsBL+GuVg9iRjoDpkP/uRJmL1A+AYHi3NzQoBCrL6m2FUJyaLaeX8+QLluWeVxGkv5JeL0wyJOu+ioUzizY0lp2Xuh5GX7XD7GD5r0S3eiUGtzYMf8pNXSxFDlc/hm3Sq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573046017; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=u8Lo0eLIN+gs8M0ZZLo3rzUmMrvgoUoQHlSZR+SUMY0=; b=cigSLwXii7Kdf4fKH9moGORo5luqog+URbR1mriIpSGCpWqm+xqJm2qDs6YJR7yEC5TaPSQGUh3mh5TB1pG6zHgc19PeCo4OIcpAOJ2+4I/00JDReFRtYmAlzCp4NAI9PeBeyPXSIY5Ys9penfM3c6yRnJI3MxuTCDsnji8wrFo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50061+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573046017329718.0235122110162; Wed, 6 Nov 2019 05:13:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Wed, 06 Nov 2019 05:13:36 -0800 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.8258.1573046015437825197 for ; Wed, 06 Nov 2019 05:13:36 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2019 05:13:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,274,1569308400"; d="scan'208";a="377043494" X-Received: from shwdeopenpsi777.ccr.corp.intel.com ([10.239.158.59]) by orsmga005.jf.intel.com with ESMTP; 06 Nov 2019 05:13:35 -0800 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Dandan Bi , Liming Gao , Ray Ni , Hao A Wu , Sean Brogan Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/DxeIplPeim: reserve page 0 for NULL pointer detection Date: Wed, 6 Nov 2019 21:13:32 +0800 Message-Id: <20191106131333.4684-2-jian.j.wang@intel.com> In-Reply-To: <20191106131333.4684-1-jian.j.wang@intel.com> References: <20191106131333.4684-1-jian.j.wang@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jian.j.wang@intel.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573046016; bh=p0mQiWN3G4vGJXCrWYN6ufHw5SPggV4jNbGpluw60I0=; h=Cc:Date:From:Reply-To:Subject:To; b=IwZ/VoPUvH3zognNz6n1APIj+qHvGoyu44EYR0SGwHcJjxqeFiN0NDuTSFn1x3wzDCu AInyRlogJh0cm8jYu14DOKa8jvtZwITojiBrYgWtkxb3szKO9ZTDAC2E9tzsvmX1wnXEi 3h4Iy5ycUPW0wHD6jpH3Hhi3FCrOCb4uwKw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When a boot loader examines the memory map, it can see that location 0 is available memory. If it chooses to use that memory, and PcdNullPointerDetectionPropertyMask is enabled, use of memory in page 0 will cause an exception. This does occur when running the memtest86 program. Leaving page 0 available is for legacy support purpose. Since we have deprecated the support of legacy, the solution is just reserving it so that it cannot be allocated for other uses. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1885 Cc: Dandan Bi Cc: Liming Gao Cc: Ray Ni Cc: Hao A Wu Cc: Sean Brogan Signed-off-by: Jian J Wang --- MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++ MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c b/MdeModulePkg= /Core/DxeIplPeim/Ia32/DxeLoadFunc.c index 172d7cd1c6..6e8ca824d4 100644 --- a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c +++ b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c @@ -246,8 +246,12 @@ HandOffToDxeCore ( EFI_PEI_VECTOR_HANDOFF_INFO_PPI *VectorHandoffInfoPpi; BOOLEAN BuildPageTablesIa32Pae; =20 + // + // Clear page 0 and mark it as allocated if NULL pointer detection is en= abled. + // if (IsNullDetectionEnabled ()) { ClearFirst4KPage (HobList.Raw); + BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesDat= a); } =20 Status =3D PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PA= GES (STACK_SIZE), &BaseOfStack); diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c b/MdeModulePkg/= Core/DxeIplPeim/X64/DxeLoadFunc.c index 2867610bff..f465eb1d8a 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c @@ -36,8 +36,12 @@ HandOffToDxeCore ( EFI_VECTOR_HANDOFF_INFO *VectorInfo; EFI_PEI_VECTOR_HANDOFF_INFO_PPI *VectorHandoffInfoPpi; =20 + // + // Clear page 0 and mark it as allocated if NULL pointer detection is en= abled. + // if (IsNullDetectionEnabled ()) { ClearFirst4KPage (HobList.Raw); + BuildMemoryAllocationHob (0, EFI_PAGES_TO_SIZE (1), EfiBootServicesDat= a); } =20 // --=20 2.17.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50061): https://edk2.groups.io/g/devel/message/50061 Mute This Topic: https://groups.io/mt/44036060/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-