From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 16E6021EC8CFE for ; Wed, 27 Sep 2017 18:00:44 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2017 18:03:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,447,1500966000"; d="scan'208";a="317053245" Received: from jwang36-mobl2.ccr.corp.intel.com ([10.239.192.74]) by fmsmga004.fm.intel.com with ESMTP; 27 Sep 2017 18:03:55 -0700 From: Jian J Wang To: edk2-devel@lists.01.org Cc: Star Zeng , Eric Dong , Laszlo Ersek , Jiewen Yao , Michael Kinney , Jordan Justen , Ayellet Wolman Date: Thu, 28 Sep 2017 09:03:47 +0800 Message-Id: <20170928010353.11968-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH v3 0/6] Add NULL pointer detection feature X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 01:00:45 -0000 The mechanism behind is to trigger a page fault exception at address 0. This can be made by disabling page 0 (0-4095) during page table setup. So this feature can only be available on platform with paging enabled. Once this feature is enabled, any code, like CSM, which has to access memory in page 0 needs to enable this page temporarily in advance and disable it afterwards. PcdNullPointerDetectionPropertyMask is used to control and elaborate the use cases. For example, BIT7 of this PCD must be set for Windows 7 boot on Qemu if BIT0 set; or boot will fail. Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Cc: Jiewen Yao Cc: Michael Kinney Cc: Jordan Justen Cc: Ayellet Wolman Suggested-by: Ayellet Wolman Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang Jian J Wang (5): MdeModulePkg/DxeIpl: Implement NULL pointer detection MdeModulePkg/Core/Dxe: Add EndOfDxe workaround for NULL pointer detection UefiCpuPkg/PiSmmCpuDxeSmm: Implement NULL pointer detection for SMM code IntelFrameworkModulePkg/Csm: Add code to bypass NULL pointer detection OvmfPkg/QemuVideoDxe: Bypass NULL pointer detection during VBE SHIM installing Wang, Jian J (1): MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointer detection PCD .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c | 101 ++++++++++++++ .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h | 2 + .../Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf | 2 + .../Csm/LegacyBiosDxe/LegacyBda.c | 4 + .../Csm/LegacyBiosDxe/LegacyBios.c | 152 +++++++++++++++++++++ .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf | 2 + .../Csm/LegacyBiosDxe/LegacyBiosInterface.h | 18 +++ .../Csm/LegacyBiosDxe/LegacyBootSupport.c | 23 +++- .../Csm/LegacyBiosDxe/LegacyPci.c | 17 ++- IntelFrameworkModulePkg/Csm/LegacyBiosDxe/Thunk.c | 27 +++- MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + MdeModulePkg/Core/Dxe/Mem/Page.c | 4 +- MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 48 +++++++ MdeModulePkg/Core/DxeIplPeim/DxeIpl.h | 25 ++++ MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 1 + MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 65 +++++++++ MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 11 +- MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c | 2 + MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 31 ++++- MdeModulePkg/MdeModulePkg.dec | 13 ++ MdeModulePkg/MdeModulePkg.uni | 13 ++ OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 1 + OvmfPkg/QemuVideoDxe/VbeShim.c | 14 ++ UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 12 ++ UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 25 +++- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 12 ++ 27 files changed, 606 insertions(+), 21 deletions(-) -- 2.14.1.windows.1