From nobody Fri May 17 17:38:22 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+102256+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+102256+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1680254096; cv=none; d=zohomail.com; s=zohoarc; b=CEhAHAm+Z8z8fs0ZWlCWCcCDOxNseWbNlOmpe+yXX40YmUsmmibCg8b+uQo+rWZFmNP1e4nLyLNpiGDsgcKb+kSo9awmauEZYEeoMBSjAe5eG4oaBQZYVMGxcH5euE1V++Cmokx0hrFc5LrY9RZefwkxVcRBT2l4GHknKNz0EDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680254096; 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=CiXkhoXWZ0FxI2dUC+9UuETB2UOclow+Zd8HthLV7vg=; b=CohCXaV8VJIwLuV2vuWfAPbfb6WN7TcF7AfOQ2oDfTEn/JiYDj8FiWRXXV6m0SS2PryvYlo9h8Y5OpA3RMZGODAGOK2g39/QwblF36hz4kq84hGTXgulzFs4tBEiT66/LClMlWF2KFoU2lT4Vt5vkbQL6DupFoTVoa5Hbg8C5R0= 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+102256+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 1680254096218209.39445726929966; Fri, 31 Mar 2023 02:14:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 76cDYY1788612xY4l33Odtbt; Fri, 31 Mar 2023 02:14:55 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.50282.1680254094977224397 for ; Fri, 31 Mar 2023 02:14:55 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DDF4B82D7E; Fri, 31 Mar 2023 09:14:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D453C433EF; Fri, 31 Mar 2023 09:14:49 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [edk2-devel] [RFT PATCH v3 1/5] BaseTools/tools_def CLANGDWARF: Permit text relocations Date: Fri, 31 Mar 2023 11:14:33 +0200 Message-Id: <20230331091437.1593337-2-ardb@kernel.org> In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org> References: <20230331091437.1593337-1-ardb@kernel.org> 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,ardb@kernel.org X-Gm-Message-State: hvgI9DRrndNT9nkVaIrZqy87x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680254095; bh=izTwiJDHCLqxGzS4HGswEBYG5zBXoavTslV//IetLjQ=; h=Cc:Date:From:Reply-To:Subject:To; b=D9sOiZm0crBblKXw5LynJWVY2ND+E82X7pkilFWbkqnhhjYuJmnw6Yz4UF+JRX/r++q trPh+uKte53Q9rXTS5cHxQyl92Yy4Rzg42D2ZaLecyQKUCKh+FPzfdUJgCoqIxsrXVDGz ZmnoUu2R/WtwDQs3Y47SQp9zvpG+Xp4Q1bk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680254096975100001 Content-Type: text/plain; charset="utf-8" We rely on PIE executables to get the codegen that is suitable for PE/COFF conversion where the resulting executables can be loaded anywhere in the address space. However, ELF linkers may default to disallowing text relocations in PIE executables, as this would require text segments to be updated at runtime, which is bad for security and increases the copy-on-write footprint of ELF executables and shared libraries. However, none of those concerns apply to PE/COFF executables in the context of EFI, which are copied into memory rather than mmap()'ed, and fixed up by the loader before launch. So pass -z notext to the LLD linker to permit runtime relocations in read-only sections. Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index ae43101853870c6d..5a3af55bfb09d753 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2870,7 +2870,7 @@ DEFINE CLANGDWARF_X64_PREFIX =3D ENV(CLANG_BIN) DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-q,--gc-sectio= ns -z max-page-size=3D0x40 DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =3D -Wl,--script=3D$(EDK_TOOLS_P= ATH)/Scripts/ClangBase.lds DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLIN= K_COMMON) -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0 DEF(CLANGDWARF_DLINK2_FLAGS= _COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable -DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLIN= K_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map= ,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive +DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLIN= K_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map= ,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive -Wl,-z,notext DEFINE CLANGDWARF_IA32_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER= _SIZE=3D0x220 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) DEFINE CLANGDWARF_X64_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER= _SIZE=3D0x228 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) =20 --=20 2.39.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 (#102256): https://edk2.groups.io/g/devel/message/102256 Mute This Topic: https://groups.io/mt/97969649/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 Fri May 17 17:38:22 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+102257+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+102257+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1680254097; cv=none; d=zohomail.com; s=zohoarc; b=CmlBrGMA2/qWtmdplUBUSFP8oDya7Y3v+5YYJOdEGDw51XOS5Raqz6be58NtEmUlT5e8LkuYJE0Ngq+fel+aLXTfBgMJIAPLLj2fHUPGR6992hgC2alPgyr5uiEa+s2eK4p7OmUMochznF1dUbXYCbQJgd3C0sQzYZkPc6Ci8cM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680254097; 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=LWZe7Vo4AL8pvj6LQhBZk+zWI6DFrmQhdVrO/9oU9vc=; b=Pu3cBj+WbAzitmYfgAv6BX6wzx0jOwEY7aarJdcpc6STPbDCbsdjTAYEAr1JqTpdTSiHfgiI1GxaePE6sz8u6ImaCl9IaOCw4H+PfsXpbu0jjZOwWa0pCgWnsPu2EOgDwL8kMkiHQiZ5ouZRYVdabokt2FtTE6AtVEzSM2ToZNA= 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+102257+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 16802540974951007.3236972834773; Fri, 31 Mar 2023 02:14:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id fwobYY1788612xaSRGsgwdzz; Fri, 31 Mar 2023 02:14:57 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.50284.1680254096292660682 for ; Fri, 31 Mar 2023 02:14:56 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A55E2B82D11; Fri, 31 Mar 2023 09:14:54 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A538C4339E; Fri, 31 Mar 2023 09:14:51 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [edk2-devel] [RFT PATCH v3 2/5] UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version Date: Fri, 31 Mar 2023 11:14:34 +0200 Message-Id: <20230331091437.1593337-3-ardb@kernel.org> In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org> References: <20230331091437.1593337-1-ardb@kernel.org> 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,ardb@kernel.org X-Gm-Message-State: Pyr0mZLigBY71I9O0OijvX51x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680254097; bh=FBCFSqtlrj7BSSLFkjA1W4SIOLXDgTBuVa0AXAGOPJA=; h=Cc:Date:From:Reply-To:Subject:To; b=mUbM3EAQ4FmRgcSKKcjNplPJXavaUZai2rS7Ell2WpZ04IGMZH2VXBEzk4nuNrSkhXN I8YlE6gtZk0EzwVXIXKDxSTo3pnkRGfZSsU21bT5GcX789nJb35BBk60ZW8Q8bBef7q/l NgIR69f54RiaG08YZ4E3Lt0+3gubZRgxpkY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680254099032100005 Content-Type: text/plain; charset="utf-8" Currently, we use the non-Xcode5 version of ExceptionHandlerAsm.nasm only for the SEC and PEI phases, and this version was not compatible with the XCODE or LLD linkers, which do not permit absolute relocations in read-only sections. Given that SEC and PEI code typically executes in place from flash and does not use page alignment for sections, we can simply emit the code carrying the absolute symbol references into the .data segment instead. This works around the linker's objections, and the resulting image will be mapped executable in its entirety anyway. Since this is only needed for XCODE, let's make this change conditionally using a preprocessor macro. Let's rename the .nasm file to reflect the fact that is used for the SecPei flavor of this library only, and while at it, remove some unnecessary absolute references. Also update the Xcode specific version of this library, and use this source file instead. This is necesessary, as the Xcode specific version modifies its own code at runtime, which is not permitted in SEC or PEI. Note that this also removes CET support from the Xcode5 specific build of the SEC/PEI version of this library, but this is not needed this early in any case, and this aligns it with other toolchains, which use this version of the library, which does not have CET support either. Signed-off-by: Ard Biesheuvel --- UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf= | 4 +++- UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm = =3D> SecPeiExceptionHandlerAsm.nasm} | 12 ++++++++---- UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerL= ib.inf | 4 +++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHa= ndlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException= HandlerLib.inf index df44371fe018e06d..885bb6638ab58620 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLi= b.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLi= b.inf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/ExceptionHandlerAsm.nasm + X64/SecPeiExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 @@ -58,3 +58,5 @@ [Pcd] [FeaturePcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONS= UMES =20 +[BuildOptions] + XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandler= Asm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHan= dlerAsm.nasm similarity index 94% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerA= sm.nasm rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHand= lerAsm.nasm index aaf8d622e6f3b8f1..ec45c60181906c14 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHandlerA= sm.nasm @@ -27,7 +27,9 @@ extern ASM_PFX(CommonExceptionHandler) SECTION .data =20 DEFAULT REL +#ifndef NO_ABSOLUTE_RELOCS_IN_TEXT SECTION .text +#endif =20 ALIGN 8 =20 @@ -51,6 +53,9 @@ HookAfterStubHeaderBegin: push rax mov rax, HookAfterStubHeaderEnd jmp rax + +SECTION .text + HookAfterStubHeaderEnd: mov rax, rsp and sp, 0xfff0 ; make sure 16-byte aligned for exception c= ontext @@ -276,8 +281,7 @@ DrFinish: ; and make sure RSP is 16-byte aligned ; sub rsp, 4 * 8 + 8 - mov rax, ASM_PFX(CommonExceptionHandler) - call rax + call ASM_PFX(CommonExceptionHandler) add rsp, 4 * 8 + 8 =20 cli @@ -384,10 +388,10 @@ DoIret: ; comments here for definition of address map global ASM_PFX(AsmGetTemplateAddressMap) ASM_PFX(AsmGetTemplateAddressMap): - mov rax, AsmIdtVectorBegin + lea rax, [AsmIdtVectorBegin] mov qword [rcx], rax mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32 - mov rax, HookAfterStubHeaderBegin + lea rax, [HookAfterStubHeaderBegin] mov qword [rcx + 0x10], rax ret =20 diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExcep= tionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPei= CpuExceptionHandlerLib.inf index 619b39d7f1de9ae3..17f872bb15eb0ff7 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHan= dlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHan= dlerLib.inf @@ -33,7 +33,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/SecPeiExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 @@ -63,3 +63,5 @@ [Pcd] [FeaturePcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONS= UMES =20 +[BuildOptions] + XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT --=20 2.39.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 (#102257): https://edk2.groups.io/g/devel/message/102257 Mute This Topic: https://groups.io/mt/97969650/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 Fri May 17 17:38:22 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+102258+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+102258+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1680254097; cv=none; d=zohomail.com; s=zohoarc; b=XRWTkME56/TL10QaJjmf/H76nYJvDhINS0DR+/jv1kA64JaKk9+MgKAI1JT8CKNO8vPXjOGxWrcmUayNzeu04RrF6y4ww1uN7FyWXI41GktwiwMQXAC62IsXbJ2gN0YLD1yZjcDgxsSlfgAZwCvW8p98h7RIQydeIHMYpsekGhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680254097; 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=HK9y+fH1u8vOjNWq1mtPVmktmojHbbS8pMwIaPkWHHI=; b=mi+CFfpW9+nzuJOeOiXsliWFFW974Gy5oGeY53qv16q2bwj0hFSIaQexk7kQXIwp5qPIwVaia7RO9mIbalh+JnJbRmkkkKjo0iOsm0/f9kwdntRkH5hI7rYPH/8kxRrLCUglMUOqj8GKz+jO66McjT2M3geqpC4SVZwHMVdkv5Y= 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+102258+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 1680254097921623.1196634035714; Fri, 31 Mar 2023 02:14:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0XOZYY1788612xT1qecfUHPQ; Fri, 31 Mar 2023 02:14:57 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.50285.1680254096714938104 for ; Fri, 31 Mar 2023 02:14:56 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40437625F3; Fri, 31 Mar 2023 09:14:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1006C433A1; Fri, 31 Mar 2023 09:14:53 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [edk2-devel] [RFT PATCH v3 3/5] UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only Date: Fri, 31 Mar 2023 11:14:35 +0200 Message-Id: <20230331091437.1593337-4-ardb@kernel.org> In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org> References: <20230331091437.1593337-1-ardb@kernel.org> 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,ardb@kernel.org X-Gm-Message-State: ridresQw5SJx34EWWHCP77eDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680254097; bh=G3WNUYgQL7veuRz/aQtXAMQXDsf3GLY9dkkhZKt0XMQ=; h=Cc:Date:From:Reply-To:Subject:To; b=jsfdu0mlnnBlIgYjKyS1YlEvAExaMm6kEHOvgI48leybIxYI051oNxh7jnYoSOtCNq5 7aF9PKEW1WCEK5cjle1XUqsiiZz4v8KnEhcZYLufqow+dwHc9yIp1lDPYYrfkky8pMB5X mVxZi6eNOCptFzKQOz9hNsE1kibOKgAiiYA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680254099047100008 Content-Type: text/plain; charset="utf-8" The CPU exception handler library code was rewritten at some point to populate the vector code templates with absolute references at runtime, given that the XCODE linker does not permit absolute references in executable code when creating PIE executables. This is rather unfortunate, as this prevents us from using strict permissions on the memory mappings, given that the .text section needs to be writable at runtime for this arrangement to work. So let's make this hack XCODE-only, by setting a preprocessor #define from the command line when using the XCODE toolchain, and only including the runtime fixup code when the macro is defined. While at it, rename the Xcode5ExceptionHandlerAsm.nasm source file and drop the Xcode5 prefix: this code is used by other toolchains too. Signed-off-by: Ard Biesheuvel Reviewed-by: Ray Ni --- UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf = | 5 ++++- UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf = | 4 +++- UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf = | 4 +++- UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandlerAsm.n= asm =3D> ExceptionHandlerAsm.nasm} | 10 ++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandle= rLib.inf index d0f82095cf926e99..ee9df805c05df4f7 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 @@ -61,3 +61,6 @@ [LibraryClasses] MemoryAllocationLib DebugLib CcExitLib + +[BuildOptions] + XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandle= rLib.inf index 5339f8e604045801..83970c54712f22a2 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 @@ -62,3 +62,5 @@ [Pcd] [FeaturePcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONS= UMES =20 +[BuildOptions] + XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandle= rLib.inf index 8f8a5dab79303f87..acd2936aef4490a5 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i= nf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h =20 [Sources.X64] - X64/Xcode5ExceptionHandlerAsm.nasm + X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h =20 @@ -61,3 +61,5 @@ [Pcd] [FeaturePcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONS= UMES =20 +[BuildOptions] + XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionH= andlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHan= dlerAsm.nasm similarity index 95% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHa= ndlerAsm.nasm rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm= .nasm index 957478574253e619..3823656ea7d4c3b8 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerA= sm.nasm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm @@ -59,7 +59,11 @@ AsmIdtVectorBegin: %rep 256 push strict dword %[Vector] ; This instruction pushes sign-extended= 8-byte value on stack push rax +#ifdef NO_ABSOLUTE_RELOCS_IN_TEXT mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptE= ntry) +#else + mov rax, ASM_PFX(CommonInterruptEntry) +#endif jmp rax %assign Vector Vector+1 %endrep @@ -69,8 +73,12 @@ HookAfterStubHeaderBegin: push strict dword 0 ; 0 will be fixed VectorNum: push rax +#ifdef NO_ABSOLUTE_RELOCS_IN_TEXT mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd JmpAbsoluteAddress: +#else + mov rax, HookAfterStubHeaderEnd +#endif jmp rax HookAfterStubHeaderEnd: mov rax, rsp @@ -457,6 +465,7 @@ ASM_PFX(AsmGetTemplateAddressMap): lea rax, [HookAfterStubHeaderBegin] mov qword [rcx + 0x10], rax =20 +#ifdef NO_ABSOLUTE_RELOCS_IN_TEXT ; Fix up CommonInterruptEntry address lea rax, [ASM_PFX(CommonInterruptEntry)] lea rcx, [AsmIdtVectorBegin] @@ -468,6 +477,7 @@ ASM_PFX(AsmGetTemplateAddressMap): lea rax, [HookAfterStubHeaderEnd] lea rcx, [JmpAbsoluteAddress] mov qword [rcx - 8], rax +#endif =20 ret =20 --=20 2.39.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 (#102258): https://edk2.groups.io/g/devel/message/102258 Mute This Topic: https://groups.io/mt/97969651/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 Fri May 17 17:38:22 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+102259+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+102259+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1680254102; cv=none; d=zohomail.com; s=zohoarc; b=MMSRA+93tlcEjMqhaSThALRN4R60EYqWoO6yzzUZBG4osX5P1G/zsDzS/uAOmhEln2xp3FmcIsbR14DBV9KyCJGDqVMYuVDyLAwSNNeeamkNA0LI+b0NfgRmTNGtSWuNWI56OV2n8F1/BpduKfuwlvMRe22JH0smPOznKg/5aro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680254102; 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=ranQLjJSsAQyZw6I2Xx2A14U591uqK33AqKHPx9yZzA=; b=jhjdHIs0V1PGs8ENtsEtHF13nAO5abwu0ZEcBIYtG+lFl5mZlLFFq1qXdJJdPei7FtyknbJGO5s0mELuM4y+qwsqVPeBC/JOhhkl4srLPfJJxDdiDK7gb/qlXHEVLuBfQ9C3Yhzz/1Krl6+awTKudQN8+LwCAI2XqYKiciw4+X0= 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+102259+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 1680254102440918.7824536963471; Fri, 31 Mar 2023 02:15:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id o25RYY1788612xOUOdFZ9616; Fri, 31 Mar 2023 02:15:02 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.50287.1680254100947766299 for ; Fri, 31 Mar 2023 02:15:01 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5091FB82D99; Fri, 31 Mar 2023 09:14:59 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A96EC4339B; Fri, 31 Mar 2023 09:14:55 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= , Jiewen Yao Subject: [edk2-devel] [RFT PATCH v3 4/5] OvmfPkg: Drop special Xcode5 version of exception handler library Date: Fri, 31 Mar 2023 11:14:36 +0200 Message-Id: <20230331091437.1593337-5-ardb@kernel.org> In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org> References: <20230331091437.1593337-1-ardb@kernel.org> 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,ardb@kernel.org X-Gm-Message-State: MvjLkts7KCCj6qw0lElvmZVkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680254102; bh=Tj/Xhv4VRziNecbG6h4/oOfoUmLkvIcx3zprtNhkGdQ=; h=Cc:Date:From:Reply-To:Subject:To; b=h7bM5QK9NdJtxijK9ZTniLm4jti+Z5PniBmEUHafYDvxAPgSPOih+8ANgujbJLpCdCW B1cR/LlTR9e6cNQ0KFfJjbhCPF9v1IL7wePCZTfsq52YkJ1P/dm2v76CxTbDtS94UvLI6 +y+3t5xREhtHUvyNQ46S+3b6eV3fg0V3wWs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680254103012100002 Content-Type: text/plain; charset="utf-8" The generic and XCODE5 versions of this library are now identical, so drop the special case. The library will be removed entirely in a subsequent patch. Signed-off-by: Ard Biesheuvel Acked-by: Jiewen Yao --- OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ---- OvmfPkg/CloudHv/CloudHvX64.dsc | 4 ---- OvmfPkg/IntelTdx/IntelTdxX64.dsc | 4 ---- OvmfPkg/Microvm/MicrovmX64.dsc | 4 ---- OvmfPkg/OvmfPkgIa32.dsc | 4 ---- OvmfPkg/OvmfPkgIa32X64.dsc | 4 ---- OvmfPkg/OvmfPkgX64.dsc | 4 ---- OvmfPkg/OvmfXen.dsc | 4 ---- 8 files changed, 32 deletions(-) diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index c005e474dd826759..943c4eed9831a1c5 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -224,11 +224,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc index b9820cc14bee0693..cc2dd925bc940ea8 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -270,11 +270,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX6= 4.dsc index 5c56858d063b96bf..f734409055400859 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -238,11 +238,7 @@ [LibraryClasses.common.SEC] ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseE= xtractGuidedSectionLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf PrePiHobListPointerLib|OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiH= obListPointerLibTdx.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 384b0b7afc74e90f..e9aab515592ffcec 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -272,11 +272,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index a6db902f54ece86f..86177bb948999435 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -275,11 +275,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 [LibraryClasses.common.PEI_CORE] diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 076fc0353de02aaa..065b5445064712d9 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -280,11 +280,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 [LibraryClasses.common.PEI_CORE] diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index b2f3d14cd94d5fff..3d405cd4ade07900 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -297,11 +297,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" || $(TOOL_CHAIN_TAG) =3D=3D "CLANGDW= ARF" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 990225d2dd05d3a8..8bfc16c2d3d6aabe 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -247,11 +247,7 @@ [LibraryClasses.common.SEC] PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLi= b.inf =20 [LibraryClasses.common.PEI_CORE] --=20 2.39.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 (#102259): https://edk2.groups.io/g/devel/message/102259 Mute This Topic: https://groups.io/mt/97969652/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 Fri May 17 17:38:22 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+102260+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+102260+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1680254107; cv=none; d=zohomail.com; s=zohoarc; b=j28tSaT2g4gWZzPFERzUsk6l90BVBMs4NHQKmWXQipGIdS0ytzyVymgBaPPZBLMdsShfK5DZGQr4Lrk4DNazS12ef98qUo7qpyUlZQlHZjrj/boQioYrBcFQu53vFR9hfAVcArEvx2XJdpPPxGrXwpLeF1ZzplJZOqOJP5eHpU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680254107; 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=fLTvmF6hdMW6s5iBuRZgxmdIz6B96BVrx7o6rFGppi0=; b=nM2GPN9syFAn1dbkI090EWkODJ16xfBG30es4xqooeUAmFs3y4OHzmlnXmgmhIwH3fjpqDp+hO4hcCrwU8kEaIWFgCAQJb/wxgvI3L8lPYCSYxAQ/pY8HwZw2BMEjI1HMc7Oz3FH81pmsZ2tyRIhHtWa3kT4nG8+Iv+NyMzzwgE= 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+102260+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 1680254107719308.98084111989726; Fri, 31 Mar 2023 02:15:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xE1hYY1788612xIXyPtPJ9gA; Fri, 31 Mar 2023 02:15:07 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.50324.1680254101544201612 for ; Fri, 31 Mar 2023 02:15:01 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 11CF562581; Fri, 31 Mar 2023 09:15:01 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88148C4339C; Fri, 31 Mar 2023 09:14:58 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [edk2-devel] [RFT PATCH v3 5/5] UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version Date: Fri, 31 Mar 2023 11:14:37 +0200 Message-Id: <20230331091437.1593337-6-ardb@kernel.org> In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org> References: <20230331091437.1593337-1-ardb@kernel.org> 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,ardb@kernel.org X-Gm-Message-State: NYa5RXInD7bOZraf4p2Amvhux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680254107; bh=FWVjwL69lK/nu4Van3E3+iHQ+3zMgREv+lQAX1AB3A4=; h=Cc:Date:From:Reply-To:Subject:To; b=wNFqt2cu0KZkZkbcPYS1Pel/Ku9Na0QDrQbgc8NKABV1GiHcMEmkZ4Zurpjl2YmAkLc Aj9V5BlmLRdFhCzbNuqbQUExFfw6VLYlwZEmDjNthL3zSlU3717xaRJn2CW0QiXvd7yZm rzFcGuwKtGMfVshtFuK0DutodZDFe+Q/TaU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680254109050100001 Content-Type: text/plain; charset="utf-8" This library is no longer used or needed, so let's remove it. Signed-off-by: Ard Biesheuvel Reviewed-by: Ray Ni --- UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerL= ib.inf | 67 -------------------- UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerL= ib.uni | 18 ------ UefiCpuPkg/UefiCpuPkg.dsc = | 7 -- 3 files changed, 92 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExcep= tionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPei= CpuExceptionHandlerLib.inf deleted file mode 100644 index 17f872bb15eb0ff7..0000000000000000 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHan= dlerLib.inf +++ /dev/null @@ -1,67 +0,0 @@ -## @file -# CPU Exception Handler library instance for SEC/PEI modules. -# -# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved. -# Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# This is the XCODE5 variant of the SEC/PEI CpuExceptionHandlerLib. This -# variant performs binary patching to fix up addresses that allow the -# XCODE5 toolchain to be used. -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Xcode5SecPeiCpuExceptionHandlerLib - MODULE_UNI_FILE =3D Xcode5SecPeiCpuExceptionHandlerLib.uni - FILE_GUID =3D 49C481AF-1621-42F3-8FA1-27C64143E304 - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.1 - LIBRARY_CLASS =3D CpuExceptionHandlerLib|SEC PEI_CORE P= EIM - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 -# - -[Sources.Ia32] - Ia32/ExceptionHandlerAsm.nasm - Ia32/ExceptionTssEntryAsm.nasm - Ia32/ArchExceptionHandler.c - Ia32/ArchInterruptDefs.h - -[Sources.X64] - X64/SecPeiExceptionHandlerAsm.nasm - X64/ArchExceptionHandler.c - X64/ArchInterruptDefs.h - -[Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - SecPeiCpuException.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - BaseLib - SerialPortLib - PrintLib - LocalApicLib - PeCoffGetEntryPointLib - CcExitLib - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard - gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList - gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize - -[FeaturePcd] - gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONS= UMES - -[BuildOptions] - XCODE:*_*_X64_PP_FLAGS =3D -DNO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExcep= tionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPei= CpuExceptionHandlerLib.uni deleted file mode 100644 index a63b25f39d992775..0000000000000000 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHan= dlerLib.uni +++ /dev/null @@ -1,18 +0,0 @@ -// /** @file -// XCODE5 CPU Exception Handler library instance for SEC/PEI modules. -// -// CPU Exception Handler library instance for SEC/PEI modules when built -// using the XCODE5 toolchain. -// -// Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved. -// Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "CPU Exception Han= dler library instance for SEC/PEI modules with the XCODE5 toolchain." - -#string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Han= dler library instance for SEC/PEI modules with the XCODE5 toolchain." - diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index a7318d3fe9db0ec4..d85d56916f2cdbce 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -69,11 +69,7 @@ [LibraryClasses] =20 [LibraryClasses.common.SEC] PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.= inf -!if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf -!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf -!endif HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf @@ -145,12 +141,9 @@ [Components.IA32, Components.X64] UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf -!if $(TOOL_CHAIN_TAG) !=3D "XCODE5" UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.i= nf -!endif UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf - UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandle= rLib.inf UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf --=20 2.39.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 (#102260): https://edk2.groups.io/g/devel/message/102260 Mute This Topic: https://groups.io/mt/97969653/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-