From patchwork Fri Aug 18 13:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 714838 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 910C9C71156 for ; Fri, 18 Aug 2023 13:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377281AbjHRNpY (ORCPT ); Fri, 18 Aug 2023 09:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377356AbjHRNpP (ORCPT ); Fri, 18 Aug 2023 09:45:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DDD3C35; Fri, 18 Aug 2023 06:45:05 -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 438CC6377E; Fri, 18 Aug 2023 13:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD2FBC433C7; Fri, 18 Aug 2023 13:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692366304; bh=2RDy+W/bBz8r/G8wx1n/R7eiKUx6glvcr3j1Qzz9c44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZMC3I9RTRSpEMY6srqglIe7t//9k7QF0ztFy0LN5qdkdG0roZrpLklM6PJV1wEAI H78c2U+UGJN2D2UhgiT9VdHGGd3/9NssZudGoXYmbB2yBa7vqY++Bu1a+TDrelkSCA 0Pls3tpGVqEhJJ73VOR0eztM8nWdOA0FVmmpOVARGFBzvaXDqHReYHbhG0gnTPSd/z MFRMRmcZodd1CH/ZG9M6r9NQvy/HEzLgC7eMPaUfn8dv6zJDtD9si8uxj6r6kIptqX KuebsCionpHdJmoHgfexfWcrUH0CBTsKUSQin4t7s9K2gl2rK2rtGuAem4L7RN5lCq +1erXE0NioIaA== 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 07/17] x86/boot: Grab kernel_info offset from zoffset header directly Date: Fri, 18 Aug 2023 15:44:12 +0200 Message-Id: <20230818134422.380032-8-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=1967; i=ardb@kernel.org; h=from:subject; bh=2RDy+W/bBz8r/G8wx1n/R7eiKUx6glvcr3j1Qzz9c44=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIeV+6eKQvl3RMq6L3yTPWfc2U9yA48aPqXIsc1lTny6Xv eh//FtxRykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZjItK0M/5NaeMJ+3N7Lccmc Q+Oalsu8mkfzcsXYPG/sXvl9S9u30O0M/10/PFn3wtY4rUPRtcrv1US5O2oP5eu902a+Ern5vjv YlQ0A X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Instead of parsing zoffset.h and poking the kernel_info offset value into the header from the build tool, just grab the value directly in the asm file that describes this header. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/header.S | 2 +- arch/x86/boot/tools/build.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 6059f87b159d0e14..5575d0f06bab1918 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -526,7 +526,7 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr init_size: .long INIT_SIZE # kernel initialization size handover_offset: .long 0 # Filled in by build.c -kernel_info_offset: .long 0 # Filled in by build.c +kernel_info_offset: .long ZO_kernel_info # End of setup header ##################################################### diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index efa4e9c7d7135ba7..660627ea6cbb46f5 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c @@ -59,7 +59,6 @@ static unsigned long efi32_stub_entry; static unsigned long efi64_stub_entry; static unsigned long efi_pe_entry; static unsigned long efi32_pe_entry; -static unsigned long kernel_info; static unsigned long startup_64; static unsigned long _end; @@ -339,7 +338,6 @@ static void parse_zoffset(char *fname) PARSE_ZOFS(p, efi64_stub_entry); PARSE_ZOFS(p, efi_pe_entry); PARSE_ZOFS(p, efi32_pe_entry); - PARSE_ZOFS(p, kernel_info); PARSE_ZOFS(p, startup_64); PARSE_ZOFS(p, _end); @@ -422,8 +420,6 @@ int main(int argc, char ** argv) update_pecoff_text(setup_sectors * 512, i + (sys_size * 16)); efi_stub_entry_update(); - /* Update kernel_info offset. */ - put_unaligned_le32(kernel_info, &buf[0x268]); crc = partial_crc32(buf, i, crc); if (fwrite(buf, 1, i, dest) != i)