All of lore.kernel.org
 help / color / mirror / Atom feed
* + vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch added to mm-nonmm-unstable branch
@ 2022-11-08 23:48 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-11-08 23:48 UTC (permalink / raw)
  To: mm-commits, vgoyal, keescook, dyoung, bhe, stephen.s.brennan, akpm


The patch titled
     Subject: vmcoreinfo: warn if we exceed vmcoreinfo data size
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Stephen Brennan <stephen.s.brennan@oracle.com>
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@oracle.com
Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 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@oracle.com are

vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-08 23:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 23:48 + vmcoreinfo-warn-if-we-exceed-vmcoreinfo-data-size.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.