All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	 Alejandro Colomar <alx@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Bill Wendling <morbo@google.com>, Petr Mladek <pmladek@suse.com>,
	 Randy Dunlap <rdunlap@infradead.org>,
	Shuvam Pandey <shuvampandey1@gmail.com>,
	 linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3] seq_buf: Mark a seq_buf overflowed when terminating it loses a byte
Date: Wed, 11 Nov 2026 00:33:45 +0100	[thread overview]
Message-ID: <avOpWXrMYrJz8ETU@devuan> (raw)
In-Reply-To: <20261110220602.272c5b-kees@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

Hi Kees,

> Date: 2026-11-10 14:06:07-0800
> From: Kees Cook <kees@kernel.org>
>
> On Wed, Nov 04, 2026 at 12:17:00PM +0100, Alejandro Colomar wrote:
> > > No current caller checks for overflow after terminating a seq_buf that
> > > can be left exactly full, so none of them behaves differently.
> >
> > Okay for this patch, but still some question:
> >
> > Since data truncation is almost always wrong, is it a bug that those
> > users are not verifying that no overflow happened?  Or do they have a
> > good reason to not verify?
> 
> Right, this would need a case-by-case analysis. Some expect it and some
> don't. This change to the API is to make it defensive in the general
> case without making existing truncation worse.

Agree.  In shadow-utils we have the same approach.  We're first
hardening the writes to avoid overflows, and are leaving the truncations
unreported as they were before, since that needs a case-by-case
analysis.

I won't give my reviewed-by, since I fundamentally think this is
building on the mistake of having sizes and lengths instead of pointers.
But I _think_ this patch is good, FWIW.


Have a lovely night!
Alex

> 
> -Kees
> 
> -- 
> Kees Cook

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-11-10 23:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  3:31 [PATCH v3] seq_buf: Mark a seq_buf overflowed when terminating it loses a byte Kees Cook
2026-11-04 11:17 ` Alejandro Colomar
2026-11-10 22:06   ` Kees Cook
2026-11-10 23:33     ` Alejandro Colomar [this message]
2026-11-04 11:28 ` Alejandro Colomar
2026-11-10 22:07   ` Kees Cook
2026-11-10 23:35     ` Alejandro Colomar
2026-11-11  6:16       ` Kees Cook
2026-11-11  8:51         ` Andy Shevchenko
2026-11-11  8:49       ` Andy Shevchenko
2026-11-04 13:40 ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avOpWXrMYrJz8ETU@devuan \
    --to=alx+linux-hardening@kernel.org \
    --cc=alx@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morbo@google.com \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shuvampandey1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.