Re: [PATCH] gcc-plugins: randstruct: Only warn about true flexible arrays

From: Kees Cook
Date: Wed Nov 08 2023 - 17:20:36 EST


On Sat, 04 Nov 2023 13:43:37 -0700, Kees Cook wrote:
> The randstruct GCC plugin tried to discover "fake" flexible arrays
> to issue warnings about them in randomized structs. In the future
> LSM overhead reduction series, it would be legal to have a randomized
> struct with a 1-element array, and this should _not_ be treated as a
> flexible array, especially since commit df8fc4e934c1 ("kbuild: Enable
> -fstrict-flex-arrays=3"). Disable the 0-sized and 1-element array
> discovery logic in the plugin, but keep the "true" flexible array check.
>
> [...]

Applied to for-next/hardening, thanks!

[1/1] gcc-plugins: randstruct: Only warn about true flexible arrays
https://git.kernel.org/kees/c/1ee60356c2dc

Take care,

--
Kees Cook