[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJ9E_W4Z0n7EzjUw@aspen.lan>
Date: Fri, 15 Aug 2025 15:32:29 +0100
From: Daniel Thompson <daniel@...cstar.com>
To: Doug Anderson <dianders@...omium.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <danielt@...nel.org>,
Justin Stitt <justinstitt@...gle.com>,
linux-hardening@...r.kernel.org,
kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kdb: Replace deprecated strcpy() with memmove() in
vkdb_printf()
On Tue, Aug 12, 2025 at 09:24:55AM -0700, Doug Anderson wrote:
> Hi,
>
> On Tue, Aug 12, 2025 at 6:27 AM Thorsten Blum <thorsten.blum@...ux.dev> wrote:
> >
> > strcpy() is deprecated and its behavior is undefined when the source and
> > destination buffers overlap. Use memmove() instead to avoid any
> > undefined behavior.
> >
> > Adjust comments for clarity.
> >
> > Link: https://github.com/KSPP/linux/issues/88
> > Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> > ---
> > Changes in v2:
> > - Use memmove() because of strcpy()'s undefined behavior with
> > overlapping buffers as suggested by Doug Anderson
> > - Compile-tested only
> > - Link to v1: https://lore.kernel.org/lkml/20250811170351.68985-1-thorsten.blum@linux.dev/
> > ---
> > kernel/debug/kdb/kdb_io.c | 14 ++++++++------
> > 1 file changed, 8 insertions(+), 6 deletions(-)
>
> Much nicer, thank you!
>
> Given that the old code was officially relying on undefined behavior
> of strcpy() before, I'd personally even add:
>
> Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)")
>
> In any case:
>
> Reviewed-by: Douglas Anderson <dianders@...omium.org>
LGTM... and I agree that this is bug rather than a clean up so am
waiting to hear back on the Fixes: .
Daniel
PS Feel free to roll all three kdb patches discussed recently into a
series so I can pull in one go ;-) .
Powered by blists - more mailing lists