[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2rlUVGv6ua7tK/1@MiWiFi-R3L-srv>
Date: Wed, 9 Nov 2022 07:25:05 +0800
From: Baoquan He <bhe@...hat.com>
To: Stephen Brennan <stephen.s.brennan@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Vivek Goyal <vgoyal@...hat.com>, kexec@...ts.infradead.org,
linux-kernel@...r.kernel.org, Dave Young <dyoung@...hat.com>
Subject: Re: [PATCH] vmcoreinfo: Warn if we exceed vmcoreinfo data size
On 10/27/22 at 01:50pm, Stephen Brennan wrote:
> 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
>
> Signed-off-by: Stephen Brennan <stephen.s.brennan@...cle.com>
> ---
> kernel/crash_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index a0eb4d5cf557..87ef6096823f 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -383,6 +383,9 @@ void vmcoreinfo_append_str(const char *fmt, ...)
> memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r);
>
> vmcoreinfo_size += r;
> +
> + WARN_ONCE(vmcoreinfo_size == VMCOREINFO_BYTES,
> + "vmcoreinfo data exceeds allocated size, truncating");
> }
Yeah, sounds like a good idea. Thanks.
Acked-by: Baoquan He <bhe@...hat.com>
Powered by blists - more mailing lists