Re: [PATCH] coredump: Do not lock during 'comm' reporting

From: Kees Cook
Date: Sat Sep 28 2024 - 17:39:52 EST


On Sat, Sep 28, 2024 at 02:35:32PM -0700, Andrew Morton wrote:
> On Sat, 28 Sep 2024 14:08:31 -0700 Kees Cook <kees@xxxxxxxxxx> wrote:
>
> > The 'comm' member will always be NUL terminated,
>
> Why is this? I thought this is only true if the caller holds task_lock()?

Because it's always written with strscpy_pad(). The final byte will
always be NUL. (And this has been true for a very long time.)

--
Kees Cook