[PATCH 1/3] x86/crash: Reserve crashkernel=size@offset at 1M-aligned offsets again

From: Chris Down

Date: Fri Dec 04 2026 - 15:59:26 EST


Since x86 moved to the generic crashkernel reservation code in v6.7,
crashkernel=size@offset fails for any offset that isn't a multiple of
16M. For example, on a 4G x86-64 guest booted with nokaslr, where we
easily have over 1G of free memory:

crashkernel=256M@1000M
crashkernel reservation failed - memory is in use.

crashkernel=256M@1024M
crashkernel reserved: 0x0000000040000000 - 0x0000000050000000 (256 MB)

As you can see, the messaging we give to users here is a bit janky too,
that's fixed in the next patch.

The bug likely went unnoticed since the usual offsets are multiples of
16M, but nevertheless this means that a command line that worked up to
v6.6 may have silently stopped working.

For context, I ran into this in practice when testing kexec/KHO code,
and was rather bemused by the error given (which is also improved in the
following two patches).

To fix this, let's add CRASH_FIXED_BASE_ALIGN. This is the alignment
reserve_crashkernel_generic() asks for when the user gives an offset,
and it defaults to CRASH_ALIGN, so other architectures are unaffected.
x86 sets it to 1M, which restores the pre-v6.7 behaviour.

Fixes: 9c08a2a139fe ("x86: kdump: use generic interface to simplify crashkernel reservation code")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
---
arch/x86/include/asm/crash_reserve.h | 2 ++
include/linux/crash_reserve.h | 3 +++
kernel/crash_reserve.c | 4 +++-
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/crash_reserve.h b/arch/x86/include/asm/crash_reserve.h
index 047f638a766d..b5dafc771325 100644
--- a/arch/x86/include/asm/crash_reserve.h
+++ b/arch/x86/include/asm/crash_reserve.h
@@ -5,6 +5,8 @@
/* 16M alignment for crash kernel regions */
#define CRASH_ALIGN SZ_16M

+#define CRASH_FIXED_BASE_ALIGN SZ_1M
+
/*
* Keep the crash kernel below this limit.
*
diff --git a/include/linux/crash_reserve.h b/include/linux/crash_reserve.h
index 30864d90d7f5..5c8cce363147 100644
--- a/include/linux/crash_reserve.h
+++ b/include/linux/crash_reserve.h
@@ -46,6 +46,9 @@ static inline bool arch_add_crash_res_to_iomem(void)
#ifndef CRASH_ALIGN
#define CRASH_ALIGN SZ_2M
#endif
+#ifndef CRASH_FIXED_BASE_ALIGN
+#define CRASH_FIXED_BASE_ALIGN CRASH_ALIGN
+#endif
#ifndef CRASH_ADDR_LOW_MAX
#define CRASH_ADDR_LOW_MAX SZ_4G
#endif
diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
index eee37a11380c..d3364242e3a9 100644
--- a/kernel/crash_reserve.c
+++ b/kernel/crash_reserve.c
@@ -393,11 +393,13 @@ void __init reserve_crashkernel_generic(unsigned long long crash_size,
bool high)
{
unsigned long long search_end = CRASH_ADDR_LOW_MAX, search_base = 0;
+ unsigned long long align = CRASH_ALIGN;
bool fixed_base = false;

/* User specifies base address explicitly. */
if (crash_base) {
fixed_base = true;
+ align = CRASH_FIXED_BASE_ALIGN;
search_base = crash_base;
search_end = crash_base + crash_size;
} else if (high) {
@@ -406,7 +408,7 @@ void __init reserve_crashkernel_generic(unsigned long long crash_size,
}

retry:
- crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN,
+ crash_base = memblock_phys_alloc_range(crash_size, align,
search_base, search_end);
if (!crash_base) {
/*
--
2.56.1