All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: "Rafael V. Volkmer" <rafael.v.volkmer@gmail.com>
Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] overflow: extend shift helpers and add size_shl()
Date: Thu, 15 Jan 2026 16:43:46 -0800	[thread overview]
Message-ID: <202601151635.9C323403@keescook> (raw)
In-Reply-To: <20251128033830.331426-1-rafael.v.volkmer@gmail.com>

On Fri, Nov 28, 2025 at 12:38:28AM -0300, Rafael V. Volkmer wrote:
> while experimenting with check_shl_overflow() on an architecture with
> native __int128 support, I noticed that the helper always reports
> overflow as soon as the promoted type of @a/@d is wider than 64 bits,
> even when *@d is actually able to represent the shifted value.

Ah, whoops. Yeah. Can you add some tests for int128 to
lib/tests/overflow_kunit.c (see how check_one_op() uses:
	check_ ## op ## _overflow

there's a bunch of type checking in there but nothing uses int128, so
there might be more than just shl?

> On a toolchain and architecture that support __int128, this reports

What's the right way to attempt such testing?

-- 
Kees Cook

      parent reply	other threads:[~2026-01-16  0:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28  3:38 [PATCH 0/2] overflow: extend shift helpers and add size_shl() Rafael V. Volkmer
2025-11-28  3:38 ` [PATCH 1/2] overflow: make check_shl_overflow() 128-bit aware Rafael V. Volkmer
2025-11-28  3:38 ` [PATCH 2/2] overflow: add size_shl() helper for saturated left shifts Rafael V. Volkmer
2026-01-16  0:43 ` Kees Cook [this message]

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=202601151635.9C323403@keescook \
    --to=kees@kernel.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.v.volkmer@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.