[RFC PATCH v2 39/43] crash: Size the vmcoreinfo page array for the smallest page size
From: Eric Curtin
Date: Mon Nov 30 2026 - 20:53:54 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
kimage_crash_copy_vmcoreinfo() keeps the vmcoreinfo pages in an on-stack
array whose length is computed from VMCOREINFO_BYTES and PAGE_SIZE, both
of which are runtime values with arm64 boot-time page size selection.
Add VMCOREINFO_BYTES_MAX, defined as PAGE_SIZE_MAX, and size the array
as DIV_ROUND_UP(VMCOREINFO_BYTES_MAX, PAGE_SIZE_MIN), which is the
largest number of pages the buffer can span.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
(cherry picked from commit 08a51916386a159aeb15a6e51605740a895b7bb5)
---
include/linux/vmcore_info.h | 1 +
kernel/crash_core.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h
index e71518caacdf..f5d49e71ac7b 100644
--- a/include/linux/vmcore_info.h
+++ b/include/linux/vmcore_info.h
@@ -21,6 +21,7 @@
CRASH_CORE_NOTE_DESC_BYTES)
#define VMCOREINFO_BYTES PAGE_SIZE
+#define VMCOREINFO_BYTES_MAX PAGE_SIZE_MAX
#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
#define VMCOREINFO_NOTE_SIZE ((CRASH_CORE_NOTE_HEAD_BYTES * 2) + \
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index c7eb72748fee..ca7252fda848 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -43,7 +43,7 @@ note_buf_t __percpu *crash_notes;
int kimage_crash_copy_vmcoreinfo(struct kimage *image)
{
struct page *vmcoreinfo_base;
- struct page *vmcoreinfo_pages[DIV_ROUND_UP(VMCOREINFO_BYTES, PAGE_SIZE)];
+ struct page *vmcoreinfo_pages[DIV_ROUND_UP(VMCOREINFO_BYTES_MAX, PAGE_SIZE_MIN)];
unsigned int order, nr_pages;
int i;
void *safecopy;