Re: [PATCH 2/2] gcc-plugins: Remove cyc_complexity

From: Kees Cook
Date: Wed Oct 20 2021 - 15:10:39 EST


On Wed, Oct 20, 2021 at 10:48:59AM -0700, Nathan Chancellor wrote:
> On Wed, Oct 20, 2021 at 10:35:54AM -0700, Kees Cook wrote:
> > This plugin has no impact on the resulting binary, is disabled
> > under COMPILE_TEST, and is not enabled on any builds I'm aware of.
> > Additionally, given the clarified purpose of GCC plugins in the kernel,
> > remove cyc_complexity.
> >
> > Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > Cc: Michal Marek <michal.lkml@xxxxxxxxxxx>
> > Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> > Cc: Jonathan Corbet <corbet@xxxxxxx>
> > Cc: linux-hardening@xxxxxxxxxxxxxxx
> > Cc: linux-kbuild@xxxxxxxxxxxxxxx
> > Cc: linux-doc@xxxxxxxxxxxxxxx
> > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
>
> Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
>
> One comment below.
>
> > ---
> > Documentation/kbuild/gcc-plugins.rst | 2 -
> > scripts/Makefile.gcc-plugins | 2 -
> > scripts/gcc-plugins/Kconfig | 16 -----
> > scripts/gcc-plugins/cyc_complexity_plugin.c | 69 ---------------------
> > 4 files changed, 89 deletions(-)
> > delete mode 100644 scripts/gcc-plugins/cyc_complexity_plugin.c
> >
> > diff --git a/Documentation/kbuild/gcc-plugins.rst b/Documentation/kbuild/gcc-plugins.rst
> > index 4b28c7a4032f..0ba76719f1b9 100644
> > --- a/Documentation/kbuild/gcc-plugins.rst
> > +++ b/Documentation/kbuild/gcc-plugins.rst
> > @@ -96,7 +96,6 @@ Enable the GCC plugin infrastructure and some plugin(s) you want to use
> > in the kernel config::
> >
> > CONFIG_GCC_PLUGINS=y
> > - CONFIG_GCC_PLUGIN_CYC_COMPLEXITY=y
> > CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
> > ...
> >
>
> There is a comment about the cyc_complexity plugin at the very end of
> this file that should also be removed it seems:
>
> "See the cyc_complexity_plugin.c (CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) GCC plugin."

Yup; I think it was hiding from you, see here:

>
> > @@ -115,4 +114,3 @@ The GCC plugins are in scripts/gcc-plugins/. You need to put plugin source files
> > right under scripts/gcc-plugins/. Creating subdirectories is not supported.
> > It must be added to scripts/gcc-plugins/Makefile, scripts/Makefile.gcc-plugins
> > and a relevant Kconfig file.
> > -See the cyc_complexity_plugin.c (CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) GCC plugin.
^^^^

:)

Thanks!

-Kees

--
Kees Cook