[PATCH 2/3] crash: Don't report a misaligned crashkernel offset as memory in use
From: Chris Down
Date: Fri Dec 04 2026 - 15:59:28 EST
When the offset in crashkernel=size@offset isn't aligned the way the
architecture requires, reserve_crashkernel_generic() can't reserve
anything. Rather unhelpfully, it then prints the following:
crashkernel reservation failed - memory is in use.
But that is codswallop, the problem is that it's not aligned, not that
the memory is in use.
To fix this, let's check the offset's alignment before trying to
reserve anything, and tell the user what it must be aligned to. With
this applied, crashkernel=256M@1000500K on x86 gives:
crashkernel reservation failed - offset 0x3d10d000 is not aligned to 0x100000.
Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
---
kernel/crash_reserve.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
index d3364242e3a9..817cfe6b7d93 100644
--- a/kernel/crash_reserve.c
+++ b/kernel/crash_reserve.c
@@ -400,6 +400,11 @@ void __init reserve_crashkernel_generic(unsigned long long crash_size,
if (crash_base) {
fixed_base = true;
align = CRASH_FIXED_BASE_ALIGN;
+ if (!IS_ALIGNED(crash_base, align)) {
+ pr_warn("crashkernel reservation failed - offset 0x%llx is not aligned to 0x%llx.\n",
+ crash_base, align);
+ return;
+ }
search_base = crash_base;
search_end = crash_base + crash_size;
} else if (high) {
--
2.56.1