Re: [PATCH] powerpc/lib/xor_vmx: Relax frame size for clang

From: Arnd Bergmann
Date: Thu Sep 08 2022 - 11:07:54 EST

On Thu, Sep 8, 2022, at 2:27 AM, Michael Ellerman wrote:
> Christophe Leroy <christophe.leroy@xxxxxxxxxx> writes:
> Yeah that would make some sense.
> On 64-bit the largest frame in that file is 1424, which is below the
> default 2048 byte limit.
> So maybe just increase it for 32-bit && KASAN.
> What would be nice is if the FRAME_WARN value could be calculated as a
> percentage of the THREAD_SHIFT, but that's not easily doable with the
> way things are structured in Kconfig.

Increasing the warning limit slightly for 32-bit with
CONFIG_KASAN_STACK makes sense, but there are a lot of
related concerns:

- I was hoping to still stay under 1280 bytes for the warning
limit, so that even with KASAN_STACK enabled, we are able to
catch warnings in functions that use a stupid amount of
local variables, without getting too many false positives.

- if the XOR code has its frame size explode like this, it's
probably an indication of the compiler doing something wrong,
not the kernel code. The result is likely that the "optimized"
XOR implementation is slower than the default version as a
result, and the kernel will pick the other one at boot time.
This needs to be confirmed of course, but an easier workaround
for this instance might be to just disable the xor_vmx module
when KASAN_STACK is set.

- The warning limit on 32-bit is actually 2028 bytes when
GCC_PLUGIN_LATENT_ENTROPY is set. I think this is a mistake
and we should lower /that/ limit instead, but a side-effect
here is that an allmodconfig kernel build with gcc will fail
to warn about bugs that exist both with gcc and clang, while
clang complains about it.