[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whVfxi4KRu-H=tsgSdoGdDz1bvu0_miJT0BTgAf4igpdg@mail.gmail.com>
Date: Sun, 6 Apr 2025 12:04:04 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kees Cook <kees@...nel.org>
Cc: linux-kernel@...r.kernel.org, Andrey Konovalov <andreyknvl@...il.com>,
Andy Shevchenko <andy@...nel.org>, Catalin Marinas <catalin.marinas@....com>,
Nathan Chancellor <nathan@...nel.org>, Peter Collingbourne <pcc@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>, Will Deacon <will@...nel.org>
Subject: Re: [GIT PULL] string fixes for v6.15-rc1
On Sun, 6 Apr 2025 at 10:54, Kees Cook <kees@...nel.org> wrote:
>
> - Add wcslen() to support more Clang libcalls (Nathan Chancellor)
Oh Christ.
Does clang not know how expensive function calls can be?
I really think the right fix here would have been to say "don't do
that", rather than make that function available.
When the function implementation is the stupid version, there is *no*
advantage to a function call.
In user mode, if you have
(a) long strings
(b) you use some optimized vectorized string library
(c) you don't have the problems with function calls being potentially
expensive due to return prediction CPU workarounds
this compiler optimization may make sense.
But in the kernel, it *never* makes sense, because none of those three
issues are ever true.
So this change is just *stupid*.
And I'm not pulling stupid code. The one-liner rto just disable an
optimization that isn't an optimization is the right thing to do.
And if LTO has problems with that, then LTO needs to be fixed, dammit.
It's stupid without LTO, it's doubly stupid with extra
"optimizations".
Linus
Powered by blists - more mailing lists