18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ciconfig HAVE_GCC_PLUGINS
38c2ecf20Sopenharmony_ci	bool
48c2ecf20Sopenharmony_ci	help
58c2ecf20Sopenharmony_ci	  An arch should select this symbol if it supports building with
68c2ecf20Sopenharmony_ci	  GCC plugins.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cimenuconfig GCC_PLUGINS
98c2ecf20Sopenharmony_ci	bool "GCC plugins"
108c2ecf20Sopenharmony_ci	depends on HAVE_GCC_PLUGINS
118c2ecf20Sopenharmony_ci	depends on CC_IS_GCC
128c2ecf20Sopenharmony_ci	depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
138c2ecf20Sopenharmony_ci	default y
148c2ecf20Sopenharmony_ci	help
158c2ecf20Sopenharmony_ci	  GCC plugins are loadable modules that provide extra features to the
168c2ecf20Sopenharmony_ci	  compiler. They are useful for runtime instrumentation and static analysis.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	  See Documentation/kbuild/gcc-plugins.rst for details.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciif GCC_PLUGINS
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_CYC_COMPLEXITY
238c2ecf20Sopenharmony_ci	bool "Compute the cyclomatic complexity of a function" if EXPERT
248c2ecf20Sopenharmony_ci	depends on !COMPILE_TEST	# too noisy
258c2ecf20Sopenharmony_ci	help
268c2ecf20Sopenharmony_ci	  The complexity M of a function's control flow graph is defined as:
278c2ecf20Sopenharmony_ci	   M = E - N + 2P
288c2ecf20Sopenharmony_ci	  where
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	  E = the number of edges
318c2ecf20Sopenharmony_ci	  N = the number of nodes
328c2ecf20Sopenharmony_ci	  P = the number of connected components (exit nodes).
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	  Enabling this plugin reports the complexity to stderr during the
358c2ecf20Sopenharmony_ci	  build. It mainly serves as a simple example of how to create a
368c2ecf20Sopenharmony_ci	  gcc plugin for the kernel.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_SANCOV
398c2ecf20Sopenharmony_ci	bool
408c2ecf20Sopenharmony_ci	help
418c2ecf20Sopenharmony_ci	  This plugin inserts a __sanitizer_cov_trace_pc() call at the start of
428c2ecf20Sopenharmony_ci	  basic blocks. It supports all gcc versions with plugin support (from
438c2ecf20Sopenharmony_ci	  gcc-4.5 on). It is based on the commit "Add fuzzing coverage support"
448c2ecf20Sopenharmony_ci	  by Dmitry Vyukov <dvyukov@google.com>.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_LATENT_ENTROPY
478c2ecf20Sopenharmony_ci	bool "Generate some entropy during boot and runtime"
488c2ecf20Sopenharmony_ci	help
498c2ecf20Sopenharmony_ci	  By saying Y here the kernel will instrument some kernel code to
508c2ecf20Sopenharmony_ci	  extract some entropy from both original and artificially created
518c2ecf20Sopenharmony_ci	  program state.  This will help especially embedded systems where
528c2ecf20Sopenharmony_ci	  there is little 'natural' source of entropy normally.  The cost
538c2ecf20Sopenharmony_ci	  is some slowdown of the boot process (about 0.5%) and fork and
548c2ecf20Sopenharmony_ci	  irq processing.
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	  Note that entropy extracted this way is not cryptographically
578c2ecf20Sopenharmony_ci	  secure!
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	  This plugin was ported from grsecurity/PaX. More information at:
608c2ecf20Sopenharmony_ci	   * https://grsecurity.net/
618c2ecf20Sopenharmony_ci	   * https://pax.grsecurity.net/
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_RANDSTRUCT
648c2ecf20Sopenharmony_ci	bool "Randomize layout of sensitive kernel structures"
658c2ecf20Sopenharmony_ci	select MODVERSIONS if MODULES
668c2ecf20Sopenharmony_ci	help
678c2ecf20Sopenharmony_ci	  If you say Y here, the layouts of structures that are entirely
688c2ecf20Sopenharmony_ci	  function pointers (and have not been manually annotated with
698c2ecf20Sopenharmony_ci	  __no_randomize_layout), or structures that have been explicitly
708c2ecf20Sopenharmony_ci	  marked with __randomize_layout, will be randomized at compile-time.
718c2ecf20Sopenharmony_ci	  This can introduce the requirement of an additional information
728c2ecf20Sopenharmony_ci	  exposure vulnerability for exploits targeting these structure
738c2ecf20Sopenharmony_ci	  types.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	  Enabling this feature will introduce some performance impact,
768c2ecf20Sopenharmony_ci	  slightly increase memory usage, and prevent the use of forensic
778c2ecf20Sopenharmony_ci	  tools like Volatility against the system (unless the kernel
788c2ecf20Sopenharmony_ci	  source tree isn't cleaned after kernel installation).
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	  The seed used for compilation is located at
818c2ecf20Sopenharmony_ci	  scripts/gcc-plugins/randomize_layout_seed.h.  It remains after
828c2ecf20Sopenharmony_ci	  a make clean to allow for external modules to be compiled with
838c2ecf20Sopenharmony_ci	  the existing seed and will be removed by a make mrproper or
848c2ecf20Sopenharmony_ci	  make distclean.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	  Note that the implementation requires gcc 4.7 or newer.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	  This plugin was ported from grsecurity/PaX. More information at:
898c2ecf20Sopenharmony_ci	   * https://grsecurity.net/
908c2ecf20Sopenharmony_ci	   * https://pax.grsecurity.net/
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
938c2ecf20Sopenharmony_ci	bool "Use cacheline-aware structure randomization"
948c2ecf20Sopenharmony_ci	depends on GCC_PLUGIN_RANDSTRUCT
958c2ecf20Sopenharmony_ci	depends on !COMPILE_TEST	# do not reduce test coverage
968c2ecf20Sopenharmony_ci	help
978c2ecf20Sopenharmony_ci	  If you say Y here, the RANDSTRUCT randomization will make a
988c2ecf20Sopenharmony_ci	  best effort at restricting randomization to cacheline-sized
998c2ecf20Sopenharmony_ci	  groups of elements.  It will further not randomize bitfields
1008c2ecf20Sopenharmony_ci	  in structures.  This reduces the performance hit of RANDSTRUCT
1018c2ecf20Sopenharmony_ci	  at the cost of weakened randomization.
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ciconfig GCC_PLUGIN_ARM_SSP_PER_TASK
1048c2ecf20Sopenharmony_ci	bool
1058c2ecf20Sopenharmony_ci	depends on GCC_PLUGINS && ARM
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciendif
108