Hi Mike, Thanks for the patch! I suggest always cc kexec list for kexec/kdump patches. On 04/15/21 at 07:56pm, Mike Galbraith wrote: > x86/crash: fix crash_setup_memmap_entries() KASAN vmalloc-out-of-bounds gripe > > [ 15.428011] BUG: KASAN: vmalloc-out-of-bounds in crash_setup_memmap_entries+0x17e/0x3a0 > [ 15.428018] Write of size 8 at addr ffffc90000426008 by task kexec/1187 > > (gdb) list *crash_setup_memmap_entries+0x17e > 0xffffffff8107cafe is in crash_setup_memmap_entries (arch/x86/kernel/crash.c:322). > 317 unsigned long long mend) > 318 { > 319 unsigned long start, end; > 320 > 321 cmem->ranges[0].start = mstart; > 322 cmem->ranges[0].end = mend; > 323 cmem->nr_ranges = 1; > 324 > 325 /* Exclude elf header region */ > 326 start = image->arch.elf_load_addr; > (gdb) > > We're excluding two ranges, allocate the scratch space we need to do that. I think 1 range should be fine, have you tested 1? The code is just excluding the elf header space which will be loaded first before anything else so I assume it will be just at the start of the crashkernel resource region. Thus [a b] after exclude the start part will be [c b]. But I have not read the code for long time, maybe I need to double check. But anyway 2 would be good since the code is obscure we can easily miss it in the future. See how other people think. > > Signed-off-by: Mike Galbraith <efault@xxxxxx> > --- > arch/x86/kernel/crash.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- a/arch/x86/kernel/crash.c > +++ b/arch/x86/kernel/crash.c > @@ -337,7 +337,7 @@ int crash_setup_memmap_entries(struct ki > struct crash_memmap_data cmd; > struct crash_mem *cmem; > > - cmem = vzalloc(sizeof(struct crash_mem)); > + cmem = vzalloc(sizeof(struct crash_mem)+(2*sizeof(struct crash_mem_range))); Thanks for the patch, can you try below? vzalloc(struct_size(cmem, ranges, 2)); > if (!cmem) > return -ENOMEM; > > Thanks Dave _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec