Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kernel: vmcoreinfo: allocate vmcoreinfo_data based on VMCOREINFO_BYTES

Patch series "vmcoreinfo: support VMCOREINFO_BYTES larger than PAGE_SIZE".

VMCOREINFO_BYTES is defined as a configurable size, but multiple
code paths implicitly assume it always fits into a single page.

This series removes that assumption by allocating and mapping
vmcoreinfo based on its actual size.

Patch 1 updates vmcoreinfo allocation to use get_order(VMCOREINFO_BYTES).
Patch 2 updates crash kernel handling to correctly allocate and map
multiple pages when copying vmcoreinfo.

This makes vmcoreinfo size consistent across the kernel and avoids
future breakage if VMCOREINFO_BYTES grows.

(No functional change when VMCOREINFO_BYTES == PAGE_SIZE.)


This patch (of 2):

VMCOREINFO_BYTES defines the size of vmcoreinfo data, but the current
implementation assumes a single page allocation.

Allocate vmcoreinfo_data using get_order(VMCOREINFO_BYTES) so that
vmcoreinfo can safely grow beyond PAGE_SIZE.

This avoids hidden assumptions and keeps vmcoreinfo size consistent across
the kernel.

Link: https://lkml.kernel.org/r/20251216132801.807260-1-pnina.feder@mobileye.com
Link: https://lkml.kernel.org/r/20251216132801.807260-2-pnina.feder@mobileye.com
Signed-off-by: Pnina Feder <pnina.feder@mobileye.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Pnina Feder and committed by
Andrew Morton
76103d1b 61e9210e

+4 -2
+4 -2
kernel/vmcore_info.c
··· 137 137 138 138 static int __init crash_save_vmcoreinfo_init(void) 139 139 { 140 - vmcoreinfo_data = (unsigned char *)get_zeroed_page(GFP_KERNEL); 140 + int order; 141 + order = get_order(VMCOREINFO_BYTES); 142 + vmcoreinfo_data = (unsigned char *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order); 141 143 if (!vmcoreinfo_data) { 142 144 pr_warn("Memory allocation for vmcoreinfo_data failed\n"); 143 145 return -ENOMEM; ··· 148 146 vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE, 149 147 GFP_KERNEL | __GFP_ZERO); 150 148 if (!vmcoreinfo_note) { 151 - free_page((unsigned long)vmcoreinfo_data); 149 + free_pages((unsigned long)vmcoreinfo_data, order); 152 150 vmcoreinfo_data = NULL; 153 151 pr_warn("Memory allocation for vmcoreinfo_note failed\n"); 154 152 return -ENOMEM;