Re: [PATCH 0/2] overflow: extend shift helpers and add size_shl()

From: Kees Cook

Date: Thu Jan 15 2026 - 19:43:46 EST


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