All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	Evgeniy Baskov <baskov@ispras.ru>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Jones <pjones@redhat.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH v3 1/8] x86/boot: Grab kernel_info offset from zoffset header directly
Date: Fri, 15 Sep 2023 17:16:25 +0000	[thread overview]
Message-ID: <20230915171623.655440-11-ardb@google.com> (raw)
In-Reply-To: <20230915171623.655440-10-ardb@google.com>

From: Ard Biesheuvel <ardb@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.

This change has no impact on the resulting bzImage binary.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 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 6059f87b159d..5575d0f06bab 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 10b0207a6b18..14ef13fe7ab0 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 _end;
 
 /*----------------------------------------------------------------------*/
@@ -337,7 +336,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, _end);
 
 		p = strchr(p, '\n');
@@ -419,8 +417,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)
-- 
2.42.0.459.ge4e396fd5e-goog


  reply	other threads:[~2023-09-15 17:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 17:16 [PATCH v3 0/8] x86/boot: Rework PE header generation Ard Biesheuvel
2023-09-15 17:16 ` Ard Biesheuvel [this message]
2023-09-17 18:12   ` [tip: x86/boot] x86/boot: Grab kernel_info offset from zoffset header directly tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 2/8] x86/boot: Set EFI handover offset directly in header asm Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 3/8] x86/boot: Define setup size in linker script Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 4/8] x86/boot: Derive file size from _edata symbol Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 5/8] x86/boot: Construct PE/COFF .text section from assembler Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 6/8] x86/boot: Drop PE/COFF .reloc section Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 7/8] x86/boot: Split off PE/COFF .data section Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-15 17:16 ` [PATCH v3 8/8] x86/boot: Increase section and file alignment to 4k/512 Ard Biesheuvel
2023-09-17 18:12   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2023-09-17 17:50 ` [PATCH v3 0/8] x86/boot: Rework PE header generation Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915171623.655440-11-ardb@google.com \
    --to=ardb@google.com \
    --cc=ardb@kernel.org \
    --cc=baskov@ispras.ru \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=pjones@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.