[v2,20/21] gcc-plugins: enable GCC_PLUGINS for COMPILE_TEST

Message ID 1522128575-5326-21-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series
  • kconfig: move compiler capability tests to Kconfig
Related show

Commit Message

Masahiro Yamada March 27, 2018, 5:29 a.m.
The plugin availability is checked in Kconfig, so all{yes,mod}config
will not be bothered.  Remove 'depends on !COMPILE_TEST'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

Changes in v2:
  - Remove more 'depends on'

 arch/Kconfig | 4 ----
 1 file changed, 4 deletions(-)

-- 
2.7.4

Comments

Kees Cook March 28, 2018, 11:47 a.m. | #1
On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> The plugin availability is checked in Kconfig, so all{yes,mod}config

> will not be bothered.  Remove 'depends on !COMPILE_TEST'.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---

>

> Changes in v2:

>   - Remove more 'depends on'

>

>  arch/Kconfig | 4 ----

>  1 file changed, 4 deletions(-)

>

> diff --git a/arch/Kconfig b/arch/Kconfig

> index 88cc925..b07094c 100644

> --- a/arch/Kconfig

> +++ b/arch/Kconfig

> @@ -414,7 +414,6 @@ menuconfig GCC_PLUGINS

>         bool "GCC plugins"

>         depends on HAVE_GCC_PLUGINS

>         depends on $(success $srctree/scripts/gcc-plugin.sh $HOSTCXX $CC)

> -       depends on !COMPILE_TEST

>         help

>           GCC plugins are loadable modules that provide extra features to the

>           compiler. They are useful for runtime instrumentation and static analysis.


This one is nice, yes! We get coverage for anyone with plugin support.

> @@ -424,7 +423,6 @@ menuconfig GCC_PLUGINS

>  config GCC_PLUGIN_CYC_COMPLEXITY

>         bool "Compute the cyclomatic complexity of a function" if EXPERT

>         depends on GCC_PLUGINS

> -       depends on !COMPILE_TEST

>         help

>           The complexity M of a function's control flow graph is defined as:

>            M = E - N + 2P

> @@ -487,7 +485,6 @@ config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL

>  config GCC_PLUGIN_STRUCTLEAK_VERBOSE

>         bool "Report forcefully initialized variables"

>         depends on GCC_PLUGIN_STRUCTLEAK

> -       depends on !COMPILE_TEST

>         help

>           This option will cause a warning to be printed each time the

>           structleak plugin finds a variable it thinks needs to be

> @@ -527,7 +524,6 @@ config GCC_PLUGIN_RANDSTRUCT

>  config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE

>         bool "Use cacheline-aware structure randomization"

>         depends on GCC_PLUGIN_RANDSTRUCT

> -       depends on !COMPILE_TEST

>         help

>           If you say Y here, the RANDSTRUCT randomization will make a

>           best effort at restricting randomization to cacheline-sized


All three of these, though, please leave as they were. They're either
needlessly noisy for COMPILE_TEST (GCC_PLUGIN_CYC_COMPLEXITY and
*_VERBOSE), or reduce the COMPILE_TEST coverage
(GCC_PLUGIN_RANDSTRUCT_PERFORMANCE).

(And perhaps a comment is needed to explain these to avoid confusion
in the future?)

-Kees

-- 
Kees Cook
Pixel Security
Masahiro Yamada April 10, 2018, 6:15 a.m. | #2
2018-03-28 20:47 GMT+09:00 Kees Cook <keescook@chromium.org>:
> On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada

> <yamada.masahiro@socionext.com> wrote:

>> The plugin availability is checked in Kconfig, so all{yes,mod}config

>> will not be bothered.  Remove 'depends on !COMPILE_TEST'.

>>

>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>> ---

>>

>> Changes in v2:

>>   - Remove more 'depends on'

>>

>>  arch/Kconfig | 4 ----

>>  1 file changed, 4 deletions(-)

>>

>> diff --git a/arch/Kconfig b/arch/Kconfig

>> index 88cc925..b07094c 100644

>> --- a/arch/Kconfig

>> +++ b/arch/Kconfig

>> @@ -414,7 +414,6 @@ menuconfig GCC_PLUGINS

>>         bool "GCC plugins"

>>         depends on HAVE_GCC_PLUGINS

>>         depends on $(success $srctree/scripts/gcc-plugin.sh $HOSTCXX $CC)

>> -       depends on !COMPILE_TEST

>>         help

>>           GCC plugins are loadable modules that provide extra features to the

>>           compiler. They are useful for runtime instrumentation and static analysis.

>

> This one is nice, yes! We get coverage for anyone with plugin support.

>

>> @@ -424,7 +423,6 @@ menuconfig GCC_PLUGINS

>>  config GCC_PLUGIN_CYC_COMPLEXITY

>>         bool "Compute the cyclomatic complexity of a function" if EXPERT

>>         depends on GCC_PLUGINS

>> -       depends on !COMPILE_TEST

>>         help

>>           The complexity M of a function's control flow graph is defined as:

>>            M = E - N + 2P

>> @@ -487,7 +485,6 @@ config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL

>>  config GCC_PLUGIN_STRUCTLEAK_VERBOSE

>>         bool "Report forcefully initialized variables"

>>         depends on GCC_PLUGIN_STRUCTLEAK

>> -       depends on !COMPILE_TEST

>>         help

>>           This option will cause a warning to be printed each time the

>>           structleak plugin finds a variable it thinks needs to be

>> @@ -527,7 +524,6 @@ config GCC_PLUGIN_RANDSTRUCT

>>  config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE

>>         bool "Use cacheline-aware structure randomization"

>>         depends on GCC_PLUGIN_RANDSTRUCT

>> -       depends on !COMPILE_TEST

>>         help

>>           If you say Y here, the RANDSTRUCT randomization will make a

>>           best effort at restricting randomization to cacheline-sized

>

> All three of these, though, please leave as they were. They're either

> needlessly noisy for COMPILE_TEST (GCC_PLUGIN_CYC_COMPLEXITY and

> *_VERBOSE),



CONFIG_GCC_PLUGIN_CYC_COMPLEXITY is crazily annoying.
I wonder if the right thing might be to dump the log to
a separate report file instead of messing up the console,
but this is a different issue.
So I will keep this as-is.




CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE prinkles
 'userspace variable will be forcibly initialized'

If this is a matter of warning level,
we generally control this by W= option
as you see in scripts/Makefile.extrawarn

But, maybe I am wrong.  I will keep this as-is
until I figure out what is the right thing to do
for warning verbosity.




> or reduce the COMPILE_TEST coverage

> (GCC_PLUGIN_RANDSTRUCT_PERFORMANCE).

>


Can you explain a bit more about GCC_PLUGIN_RANDSTRUCT_PERFORMANCE?

IIUC, this option reduces the randomization.

Is it related to COMPILE_TEST coverage?






> (And perhaps a comment is needed to explain these to avoid confusion

> in the future?)

>

> -Kees

>

> --

> Kees Cook

> Pixel Security

> --

> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in

> the body of a message to majordomo@vger.kernel.org

> More majordomo info at  http://vger.kernel.org/majordomo-info.html




-- 
Best Regards
Masahiro Yamada
Kees Cook April 10, 2018, 7 a.m. | #3
On Mon, Apr 9, 2018 at 11:15 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Can you explain a bit more about GCC_PLUGIN_RANDSTRUCT_PERFORMANCE?

>

> IIUC, this option reduces the randomization.


Correct: I don't want to do COMPILE_TEST buids with
GCC_PLUGIN_RANDSTRUCT_PERFORMANCE since it is effectively a subset of
the GCC_PLUGIN_RANDSTRUCT possibilities. So, ..._PERFORMANCE shouldn't
be enabled for COMPILE_TEST, as that would reduce the coverage for
buid tests.

-Kees

-- 
Kees Cook
Pixel Security

Patch

diff --git a/arch/Kconfig b/arch/Kconfig
index 88cc925..b07094c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -414,7 +414,6 @@  menuconfig GCC_PLUGINS
 	bool "GCC plugins"
 	depends on HAVE_GCC_PLUGINS
 	depends on $(success $srctree/scripts/gcc-plugin.sh $HOSTCXX $CC)
-	depends on !COMPILE_TEST
 	help
 	  GCC plugins are loadable modules that provide extra features to the
 	  compiler. They are useful for runtime instrumentation and static analysis.
@@ -424,7 +423,6 @@  menuconfig GCC_PLUGINS
 config GCC_PLUGIN_CYC_COMPLEXITY
 	bool "Compute the cyclomatic complexity of a function" if EXPERT
 	depends on GCC_PLUGINS
-	depends on !COMPILE_TEST
 	help
 	  The complexity M of a function's control flow graph is defined as:
 	   M = E - N + 2P
@@ -487,7 +485,6 @@  config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
 config GCC_PLUGIN_STRUCTLEAK_VERBOSE
 	bool "Report forcefully initialized variables"
 	depends on GCC_PLUGIN_STRUCTLEAK
-	depends on !COMPILE_TEST
 	help
 	  This option will cause a warning to be printed each time the
 	  structleak plugin finds a variable it thinks needs to be
@@ -527,7 +524,6 @@  config GCC_PLUGIN_RANDSTRUCT
 config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
 	bool "Use cacheline-aware structure randomization"
 	depends on GCC_PLUGIN_RANDSTRUCT
-	depends on !COMPILE_TEST
 	help
 	  If you say Y here, the RANDSTRUCT randomization will make a
 	  best effort at restricting randomization to cacheline-sized