From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.8258.1573046015437825197 for ; Wed, 06 Nov 2019 05:13:35 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: jian.j.wang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,274,1569308400"; d="scan'208";a="377043490" Received: from shwdeopenpsi777.ccr.corp.intel.com ([10.239.158.59]) by orsmga005.jf.intel.com with ESMTP; 06 Nov 2019 05:13:33 -0800 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Dandan Bi , Liming Gao , Ray Ni , Hao A Wu , Sean Brogan Subject: [PATCH 0/2] Reserve page 0 for NULL pointer detection Date: Wed, 6 Nov 2019 21:13:31 +0800 Message-Id: <20191106131333.4684-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 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. Tests: - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x03 - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x83 - boot OVMF into Windows 7 with PcdNullPointerDetectionPropertyMask set to 0x83 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1885 Cc: Dandan Bi Cc: Liming Gao Cc: Ray Ni Cc: Hao A Wu Cc: Sean Brogan Jian J Wang (2): MdeModulePkg/DxeIplPeim: reserve page 0 for NULL pointer detection MdeModulePkg/Core/Dxe: free page 0 after disabling NULL pointer detection MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 5 +++++ MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++ MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c | 4 ++++ 3 files changed, 13 insertions(+) -- 2.17.1.windows.2