[PATCH v4 05/11] seq_buf: Add seq_buf_strlen()
Alejandro Colomar
alx+linux-hardening at kernel.org
Mon Oct 5 11:34:10 UTC 2026
Hi Kees, Andy,
> Date: 2026-10-05 04:22:15-0700
> From: Kees Cook <kees at kernel.org>
>
> On Sun, Oct 04, 2026 at 11:34:30AM +0300, Andy Shevchenko wrote:
> > On Sun, Oct 04, 2026 at 12:26:39AM -0700, Kees Cook wrote:
> > > I'd rather not make all 0-len strings return the .data segment's const
> > > "" string...
> >
> > Good point. Perhaps then to add a short note to the kernel doc,
> > so we won't see patches based on the suggestion like I gave?
>
> Yeah, reasonable. :) For v5 I've added this to seq_buf_str()'s kernel-doc:
>
> * A zero-sized seq_buf has nowhere to put a NUL, so the empty string
> * is returned instead of writing to @s->buffer. Any other seq_buf
> * returns @s->buffer, even when it holds an empty string, so callers
> * always get their own buffer back.
Are such buffers actually used on purpose anywhere? Why not keep the
WARN_ON?
Have a lovely day!
Alex
>
> -Kees
>
> --
> Kees Cook
>
--
<https://www.alejandro-colomar.es>
More information about the Linux-security-module-archive
mailing list