From: Jaehee Park <jaehee3park@gmail.com>
To: ardb@kernel.org
Cc: sebastien@wenske.fr, ilias.apalodimas@linaro.org,
tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/efi: Drop stale INITRD table entry on kexec boot
Date: Thu, 22 Oct 2026 11:39:54 -0400 [thread overview]
Message-ID: <20261022153954.51577-1-jaehee3park@gmail.com> (raw)
In-Reply-To: <20261012133712.618913-1-sebastien@wenske.fr>
From: Jaehee Park <jpark@coreweave.com>
The EFI stub allocates the INITRD configuration table in EFI_LOADER_DATA
memory. That memory can be reused after boot, but the configuration table
entry pointing to it survives kexec.
When a kexec'd kernel consumes the stale entry, efi_config_parse_tables()
clears the base and size fields at the old table address. If the new
initramfs occupies that memory, this overwrites 16 bytes of compressed
data and prevents the capture kernel from unpacking its initramfs.
Invalidate the INITRD entry when reusing the EFI configuration tables on
x86. Kexec supplies the new initrd through boot_params, so the capture
kernel does not need the old table.
Fixes: 6e62d1c6f2c7 ("efi: Wipe INITRD config table from memory after consumption")
Cc: stable@vger.kernel.org
Signed-off-by: Jaehee Park <jpark@coreweave.com>
---
Hi Ard, Sebastien,
I independently diagnosed and locally fixed this issue on October 6
while debugging kdump on an x86_64 L40S system. I was preparing to submit
my fix after internal review and found your October 12 proposal.
In my case, the stale INITRD table address overlapped the capture
initramfs. The capture kernel reported:
Initramfs unpacking failed: ZSTD-compressed data is corrupt
Failed to execute /init (error -2)
Kernel panic - not syncing: No working init found.
My local fix invalidates the inherited INITRD entry in efi_reuse_config()
instead of changing the stub allocation. With that fix, the capture
initramfs checksum remained unchanged through successful unpacking and
kdump saved a crash dump.
The tested version also removed the data->smbios early return. I have
left that change out of this submission to keep the initial patch small.
This reduced version has not been boot-tested separately. It retains
the existing SMBIOS guard, so it does not cover SMBIOS3-only systems.
Would you prefer handling that guard as part of this fix?
Would invalidating the inherited entry also be useful when kexec boots
from a kernel whose stub allocated the table in EFI_LOADER_DATA? The
allocation change appears to address the lifetime at its source, while
this change prevents the incoming x86 kernel from consuming a stale
entry created by an older kernel.
I have not tested the ACPI reclaim patch, so I am not offering a
Tested-by for that patch.
Thanks,
Jaehee
arch/x86/platform/efi/quirks.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -615,6 +615,13 @@
if (!efi_guidcmp(guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID))
((efi_config_table_64_t *)p)->table = EFI_INVALID_TABLE_ADDR;
+ /*
+ * The EFI stub allocated this table in loader data, which may
+ * have been reused. Kexec passes its initrd in boot_params.
+ */
+ if (!efi_guidcmp(guid, LINUX_EFI_INITRD_MEDIA_GUID))
+ ((efi_config_table_64_t *)p)->table = EFI_INVALID_TABLE_ADDR;
+
p += sz;
}
early_memunmap(tablep, nr_tables * sz);
base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614
--
2.54.0
prev parent reply other threads:[~2026-10-22 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 13:37 [PATCH] efi/libstub: Allocate the INITRD table in ACPI reclaim memory Sebastien WENSKE
2026-10-22 15:39 ` Jaehee Park [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=20261022153954.51577-1-jaehee3park@gmail.com \
--to=jaehee3park@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=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sebastien@wenske.fr \
--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
all inboxes | Powered by JetHome®