From: sashiko-bot@kernel.org
To: "Alvaro Parker" <alparkerdf@gmail.com>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
"Chun-Yi Lee" <jlee@suse.com>,
linux-efi@vger.kernel.org
Subject: Re: [PATCH] x86/efi: Map firmware runtime regions before boot services regions
Date: Thu, 03 Dec 2026 16:02:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-248168@kernel.org> (raw)
In-Reply-To: <20261203153018.26852-1-alparkerdf@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] x86/efi: RESTORE_MAGIC not bumped after EFI VA layout change
--
commit 03f226dbe02bf71f5724925527936ff61337bf15
Author: Alvaro Parker <alparkerdf@gmail.com>
x86/efi: Map firmware runtime regions before boot services regions
This commit splits efi_map_regions() into two passes so firmware runtime
regions are mapped before boot services regions, preventing boot services
layout changes from shifting runtime virtual addresses across boots.
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index f569d9a7c5ab6..31af1b0876d41 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
[ ... ]
> @@ -713,31 +728,56 @@ static void * __init efi_map_regions(int *count, int *pg_shift)
[ ... ]
> + for (pass = 0; pass < 2; pass++) {
> + p = NULL;
> + while ((p = efi_map_next_entry(p))) {
> + md = p;
>
> - if (!should_map_region(md))
> - continue;
> + if (!should_map_region(md))
> + continue;
>
> - efi_map_region(md);
> + if (efi_is_firmware_runtime_region(md) != (pass == 0))
> + continue;
>
> - if (left < desc_size) {
> - new_memmap = realloc_pages(new_memmap, *pg_shift);
> - if (!new_memmap)
> - return NULL;
> + efi_map_region(md);
[Severity: High]
Should RESTORE_MAGIC in arch/x86/power/hibernate.c be bumped for
CONFIG_X86_64 here?
On x86, CONFIG_ARCH_HIBERNATION_HEADER is always enabled with
CONFIG_HIBERNATION, so check_image_kernel() skips utsname matching and
only runs arch_hibernation_header_restore(), which checks RESTORE_MAGIC
and the e820_table_firmware checksum.
Because this two-pass mapping changes top-down EFI runtime virtual
addresses, an image resumed across a kernel upgrade or downgrade spanning
this commit is still accepted. The boot kernel relocates firmware with
its own layout, while the resumed kernel keeps its old efi_mm.pgd.
On the first EFI runtime call after resume, direct calls such as
virt_efi_reset_system() bypass efi_crash_gracefully_on_page_fault() and
oops, while relocated addresses that overlap another mapped region can
execute or corrupt wrong memory at ring 0.
Bumping RESTORE_MAGIC for CONFIG_X86_64, as done in 29671cabfc09
("x86/hibernate: Ignore page-zero RAM in E820 checksum"), ensures
incompatible cross-version images are refused cleanly at restore time.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203153018.26852-1-alparkerdf@gmail.com?part=1
prev parent reply other threads:[~2026-12-03 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 15:30 [PATCH] x86/efi: Map firmware runtime regions before boot services regions Alvaro Parker
2026-12-03 16:02 ` sashiko-bot [this message]
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=sashiko-outbox-248168@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alparkerdf@gmail.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jlee@suse.com \
--cc=linux-efi@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox