The quilt patch titled Subject: vmcoreinfo: warn if we exceed vmcoreinfo data size has been removed from the -mm tree. Its filename was vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Stephen Brennan <stephen.s.brennan@xxxxxxxxxx> Subject: vmcoreinfo: warn if we exceed vmcoreinfo data size Date: Thu, 27 Oct 2022 13:50:08 -0700 Though vmcoreinfo is intended to be small, at just one page, useful information is still added to it, so we risk running out of space. Currently there is no runtime check to see whether the vmcoreinfo buffer has been exhausted. Add a warning for this case. Currently, my static checking tool[1] indicates that a good upper bound for vmcoreinfo size is currently 3415 bytes, but the best time to add warnings is before the risk becomes too high. [1] https://github.com/brenns10/kernel_stuff/blob/master/vmcoreinfosize/vmcoreinfosize.py Link: https://lkml.kernel.org/r/20221027205008.312534-1-stephen.s.brennan@xxxxxxxxxx Signed-off-by: Stephen Brennan <stephen.s.brennan@xxxxxxxxxx> Acked-by: Baoquan He <bhe@xxxxxxxxxx> Cc: Dave Young <dyoung@xxxxxxxxxx> Cc: Vivek Goyal <vgoyal@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/crash_core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/kernel/crash_core.c~vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size +++ a/kernel/crash_core.c @@ -383,6 +383,9 @@ void vmcoreinfo_append_str(const char *f memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r); vmcoreinfo_size += r; + + WARN_ONCE(vmcoreinfo_size == VMCOREINFO_BYTES, + "vmcoreinfo data exceeds allocated size, truncating"); } /* _ Patches currently in -mm which might be from stephen.s.brennan@xxxxxxxxxx are