From patchwork Fri Aug 18 13:44:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 715258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D9D1C71153 for ; Fri, 18 Aug 2023 13:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377259AbjHRNov (ORCPT ); Fri, 18 Aug 2023 09:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348157AbjHRNor (ORCPT ); Fri, 18 Aug 2023 09:44:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018BE3589; Fri, 18 Aug 2023 06:44:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90AC5668D0; Fri, 18 Aug 2023 13:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 269E3C433C7; Fri, 18 Aug 2023 13:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692366285; bh=Bdt3dnT3PkezZZXx7wU43uaGt0Ad+1xDJCxtNTUmhhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxQCnCm35VHvjJdE7inNoatr+9zM6kr5y/tyhEqHGTkpXig54SOHXPWcTv3H08vz9 mJb7JEljiE63xypdH5gJ2t3LuUOPF/WGjLMwCJMazwpFsot9ml21BYOyMaZ1t9sYMn YnEyyrhBuGBD4BThYV50hSYLz0hHYMoMG535iRNHFFbuanSFkRmdI601RBVUBilK6f p5B8ghF5x5uc6mYSyliO4NAbwz+O3wbluHnqL1f4UKqL5+RMAmAmDO4cJAznoGvQfS EO8QZOVOVXKzKivNzf6+/ALlARo0I6sog1mPeF4SdTbf3CAR8TNOJvzrCAJFS6aZfn K4Yl6DfvxHG+w== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Evgeniy Baskov , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Peter Jones , Matthew Garrett , Gerd Hoffmann , Kees Cook , "H. Peter Anvin" , =?utf-8?q?Marvin_H=C3=A4user?= Subject: [PATCH 01/17] x86/efi: Drop EFI stub .bss from .data section Date: Fri, 18 Aug 2023 15:44:06 +0200 Message-Id: <20230818134422.380032-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230818134422.380032-1-ardb@kernel.org> References: <20230818134422.380032-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1658; i=ardb@kernel.org; h=from:subject; bh=Bdt3dnT3PkezZZXx7wU43uaGt0Ad+1xDJCxtNTUmhhs=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIeV+6bSi3LqslkvT5PemxwrP0Mq4wlqurPd5zelui7dlN 9re8bB3lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgIlsYGNk+DR/QYbLjYv9QtLb rWr/rPPkShKoENbqmH/sBvfbgiiNDwz//eJO68vqaSuVc7Y//vdXbGFy9MFNVj8vS86tE5629v0 2dgA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Now that the EFI stub always zero inits its BSS section upon entry, there is no longer a need to place the BSS symbols carried by the stub into the .data section. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/vmlinux.lds.S | 1 - drivers/firmware/efi/libstub/Makefile | 7 ------- 2 files changed, 8 deletions(-) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index b22f34b8684a725b..4ff6ab1b67d9b336 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -47,7 +47,6 @@ SECTIONS _data = . ; *(.data) *(.data.*) - *(.bss.efistub) _edata = . ; } . = ALIGN(L1_CACHE_BYTES); diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index ae8874401a9f1490..8302ba66ef0b3d45 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -108,13 +108,6 @@ lib-y := $(patsubst %.o,%.stub.o,$(lib-y)) # https://bugs.llvm.org/show_bug.cgi?id=46480 STUBCOPY_FLAGS-y += --remove-section=.note.gnu.property -# -# For x86, bootloaders like systemd-boot or grub-efi do not zero-initialize the -# .bss section, so the .bss section of the EFI stub needs to be included in the -# .data section of the compressed kernel to ensure initialization. Rename the -# .bss section here so it's easy to pick out in the linker script. -# -STUBCOPY_FLAGS-$(CONFIG_X86) += --rename-section .bss=.bss.efistub,load,alloc STUBCOPY_RELOC-$(CONFIG_X86_32) := R_386_32 STUBCOPY_RELOC-$(CONFIG_X86_64) := R_X86_64_64