From nobody Sun May 5 15:15:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90467+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90467+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655091556; cv=none; d=zohomail.com; s=zohoarc; b=Fvu46mVuXJN42IE/QmRJRpbcJ8b60fzEsQvFJsb7vKZ7rIG2N/UZYAXgd3uAkexziTUi7glB8cocfszeCyT48PPuKUn5U1UpvqxBO2LWQ8s/I2iaejLmPPQhgTtm3ePIY6j6rXUX6gr6XiW3rOx3stDsILh/jVVM8iJlI2acNnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655091556; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=XWx1fHhdRpuwktUpNkqL5GPW4adLa0NCt7RPzcGoFL4=; b=nGttDrgNC2hgyD0m+SeemzkJNsIo936qtuNsTEYtqfG/rXPrmtNI/jiGlvkqXg4IT6mdB7tLj72Z8usK9sJXsaXJYLYYU0xf7G9RF6iq/TKVDUWYrOSyebzgwkco84GwiF9VRpzGzFsgwZaDSIn9Y2kthFnCgdLXfgK/6nx9ZtM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90467+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165509155688016.319075561524414; Sun, 12 Jun 2022 20:39:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YUFLYY1788612xY4i9dw3kY1; Sun, 12 Jun 2022 20:39:16 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.1988.1655091554100657261 for ; Sun, 12 Jun 2022 20:39:15 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10376"; a="339826055" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="339826055" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2022 20:39:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="639470377" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.183.102]) by fmsmga008.fm.intel.com with ESMTP; 12 Jun 2022 20:39:08 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH 1/2] ArmPkg/ArmExceptionLib: Follow new CpuExceptionHandlerLib APIs Date: Mon, 13 Jun 2022 11:39:02 +0800 Message-Id: <20220613033903.1395-2-ray.ni@intel.com> In-Reply-To: <20220613033903.1395-1-ray.ni@intel.com> References: <20220613033903.1395-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ray.ni@intel.com X-Gm-Message-State: TTfp91Tm7aDWVtQB01S1z2FAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655091556; bh=Usn7glxrc1WN5egSwl2YMSslkiW/aPF5RZkU9GUcE1k=; h=Cc:Date:From:Reply-To:Subject:To; b=v/VUXJREKs0V6Jf/GOnWlDRMm1gK6BU4aVkcgTnyt8vThazxQV8sgkWxIdFS6iMpg/D qo0xkRTcKwu66KyrZCxYW3qrJZ9wj0ihzx1slZQDksjvPk5TClQpPw/BkSW+1YT74/qUX xJSLuDmF/jFiT5LyxXffZozFbfM2c94ymxk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655091558561100010 Content-Type: text/plain; charset="utf-8" CpuExceptionHandlerLib has been refactored with following changes: 1. Removed InitializeCpuInterruptHandlers in 2a09527ebcb459b40 2. Removed InitializeCpuExceptionHandlersEx and added InitializeSeparateExceptionStacks in e7abb94d1fb8a0e7 The patch updates ARM version of CpuExceptionHandlerLib to follow the API changes. The functionality to ARM platforms should be none. Signed-off-by: Ray Ni Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Reviewed-by: Sami Mujawar --- .../Library/ArmExceptionLib/ArmExceptionLib.c | 58 ++++--------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c b/ArmPkg/Libr= ary/ArmExceptionLib/ArmExceptionLib.c index 1904816c16..2c7bc66aa7 100644 --- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c +++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c @@ -4,6 +4,7 @@ * Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
* Copyright (c) 2011-2021, Arm Limited. All rights reserved.
* Copyright (c) 2016 HP Development Company, L.P. +* Copyright (c) 2022, Intel Corporation. All rights reserved.
* * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -194,32 +195,6 @@ CopyExceptionHandlers ( return RETURN_SUCCESS; } =20 -/** -Initializes all CPU interrupt/exceptions entries and provides the default = interrupt/exception handlers. - -Caller should try to get an array of interrupt and/or exception vectors th= at are in use and need to -persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. -If caller cannot get reserved vector list or it does not exists, set Vecto= rInfo to NULL. -If VectorInfo is not NULL, the exception vectors will be initialized per v= ector attribute accordingly. - -@param[in] VectorInfo Pointer to reserved vector list. - -@retval EFI_SUCCESS All CPU interrupt/exception entries have bee= n successfully initialized -with default interrupt/exception handlers. -@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if V= ectorInfo is not NULL. -@retval EFI_UNSUPPORTED This function is not supported. - -**/ -EFI_STATUS -EFIAPI -InitializeCpuInterruptHandlers ( - IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL - ) -{ - // not needed, this is what the CPU driver is for - return EFI_UNSUPPORTED; -} - /** Registers a function to be called from the processor exception handler. (O= n ARM/AArch64 this only provides exception handlers, not interrupt handling which is provided thro= ugh the Hardware Interrupt @@ -229,8 +204,8 @@ This function registers and enables the handler specifi= ed by ExceptionHandler fo interrupt or exception type specified by ExceptionType. If ExceptionHandle= r is NULL, then the handler for the processor interrupt or exception type specified by Excepti= onType is uninstalled. The installed handler is called once for each processor interrupt or excep= tion. -NOTE: This function should be invoked after InitializeCpuExceptionHandlers= () or -InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED return= ed. +NOTE: This function should be invoked after InitializeCpuExceptionHandlers= () is invoked, +otherwise EFI_UNSUPPORTED returned. =20 @param[in] ExceptionType Defines which interrupt or exception to hook. @param[in] ExceptionHandler A pointer to a function of type EFI_CPU_INTE= RRUPT_HANDLER that is called @@ -312,33 +287,22 @@ CommonCExceptionHandler ( } =20 /** - Initializes all CPU exceptions entries with optional extra initializatio= ns. - - By default, this method should include all functionalities implemented by - InitializeCpuExceptionHandlers(), plus extra initialization works, if an= y. - This could be done by calling InitializeCpuExceptionHandlers() directly - in this method besides the extra works. + Setup separate stacks for certain exception handlers. =20 - InitData is optional and its use and content are processor arch dependen= t. - The typical usage of it is to convey resources which have to be reserved - elsewhere and are necessary for the extra initializations of exception. + InitData is optional and processor arch dependent. =20 - @param[in] VectorInfo Pointer to reserved vector list. - @param[in] InitData Pointer to data optional for extra initializat= ions - of exception. + @param[in] InitData Pointer to data optional for information about= how + to assign stacks for certain exception handler= s. =20 - @retval EFI_SUCCESS The exceptions have been successfully - initialized. - @retval EFI_INVALID_PARAMETER VectorInfo or InitData contains invalid - content. + @retval EFI_SUCCESS The stacks are assigned successfully. + @retval EFI_UNSUPPORTED This function is not supported. =20 **/ EFI_STATUS EFIAPI -InitializeCpuExceptionHandlersEx ( - IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL, +InitializeSeparateExceptionStacks ( IN CPU_EXCEPTION_INIT_DATA *InitData OPTIONAL ) { - return InitializeCpuExceptionHandlers (VectorInfo); + return EFI_SUCCESS; } --=20 2.35.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 (#90467): https://edk2.groups.io/g/devel/message/90467 Mute This Topic: https://groups.io/mt/91719887/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- From nobody Sun May 5 15:15:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90468+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90468+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655091557; cv=none; d=zohomail.com; s=zohoarc; b=aqAv3lpPZBbl/J7Avz/42uH/5s6BL3cNQVfHEnfTsRWwMXLY2ReVLEId57FlfaAKcuDTqcPiqEUvUMabXrqPFodpaku3mOIo53C9kHwx4vbc+sr/L0ERlDoLNiY95ax9/ilJb9SRS2jevRgJPPyQu6/BnToyBOB7tG0wZLlmQv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655091557; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=OUHCRD3V98cDSlFau9qNVRXmRrCuH5ZjEm5j76ZPBdE=; b=nhXCbFhWrR1cNxS4FoMYz6OT0R3/k9to4aIAtiApPAE3FpFzQKANq1o0CqFTIxAP1Wh6klhK8I7sP4+aFzNwAgtV8v72AyBrNh3k9xsP6lpju5L5m303phf9pEM1OGL2bJWn3eL9RrJoT58MZz15qb21jtwoVNv/D2wSZcWQAIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90468+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655091557601625.4858795616723; Sun, 12 Jun 2022 20:39:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EiBZYY1788612xvoO1Bz2Jbr; Sun, 12 Jun 2022 20:39:17 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.1990.1655091556516189970 for ; Sun, 12 Jun 2022 20:39:16 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10376"; a="339826056" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="339826056" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2022 20:39:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="639470402" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.183.102]) by fmsmga008.fm.intel.com with ESMTP; 12 Jun 2022 20:39:10 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao Subject: [edk2-devel] [PATCH 2/2] DxeMain: Fix the bug that StackGuard is not enabled Date: Mon, 13 Jun 2022 11:39:03 +0800 Message-Id: <20220613033903.1395-3-ray.ni@intel.com> In-Reply-To: <20220613033903.1395-1-ray.ni@intel.com> References: <20220613033903.1395-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ray.ni@intel.com X-Gm-Message-State: 9xlUCN48wEgel8yKRymEG0mxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655091557; bh=b3ZIL5opOMU+jvD4P18+kgQuUMpvmCgyv4P97RHBCNM=; h=Cc:Date:From:Reply-To:Subject:To; b=wo2czYcHhxXKgIFUphX0+G1khcc+KAhbycwdZXIb0TWak6AN+6f951z2pLGCHuSmZ55 aB+1Vii1fE54Qjq9YFYMt0Nb2Cs5WUPTdOewOP+zZ7I0jv4iUGOk145ggDnURvsj5dIL2 zHbUj8e/7KBYC6r+280lRyVnmXX3G5gVJ0Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655091558551100009 Content-Type: text/plain; charset="utf-8" Commit e7abb94d1 removed InitializeCpuExceptionHandlersEx and updated DxeMain to call InitializeCpuExceptionHandlers for exception setup. But the old behavior that calls *Ex() sets up the stack guard as well. To match the old behavior, the patch calls InitializeSeparateExceptionStacks. Signed-off-by: Ray Ni Reviewed-by: Jian J Wang Cc: Liming Gao Reviewed-by: Sami Mujawar --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dx= e/DxeMain/DxeMain.c index 83f49d7c00..0a1f3d79e2 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -256,6 +256,14 @@ DxeMain ( Status =3D InitializeCpuExceptionHandlers (VectorInfoList); ASSERT_EFI_ERROR (Status); =20 + // + // Setup Stack Guard + // + if (PcdGetBool (PcdCpuStackGuard)) { + Status =3D InitializeSeparateExceptionStacks (NULL); + ASSERT_EFI_ERROR (Status); + } + // // Initialize Debug Agent to support source level debug in DXE phase // --=20 2.35.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 (#90468): https://edk2.groups.io/g/devel/message/90468 Mute This Topic: https://groups.io/mt/91719888/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-