Re: [GIT PULL] kmalloc_obj treewide refactor for v7.0-rc1
From: Linus Torvalds
Date: Sat Feb 21 2026 - 18:01:40 EST
On Sat, 21 Feb 2026 at 14:43, Kees Cook <kees@xxxxxxxxxx> wrote:
>
> How about this, then?
I will do that, because it obviously fixes the immediate problem, and
I think that code is garbage, and we shouldn't have WARN_ON_ONCE()
like that in basic functions.
And the flex counter type isn't even something this code should care
about in the first place.
But I think I found the real bug:
#define overflows_flex_counter_type(TYPE, FAM, COUNT) \
(!overflows_type(COUNT, typeof_flex_counter(((TYPE *)NULL)->FAM)))
WTF is up with that '!' there? That seems entirely bogus. So now
overflows_flex_counter_type() will return true in it *doesn't*
overflow the type.
So I think clang was not actually the problem. That whole code looks buggy.
But that actually makes me *less* happy, because it means that this
whole patch must have been ENTIRELY untested in any shape or form.
If I read this right, none of this should have successfully booted
anywhere if you had actually tested it outside of just compile-testing
it.
I kiddingly say "It compiles - ship it". But it's a JOKE for
chrissake. That's not how kernel development should work.
Linus