Kconfig 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. preferred-plugin-hostcc := $(if-success,[ $(gcc-version) -ge 40800 ],$(HOSTCXX),$(HOSTCC))
  2. config PLUGIN_HOSTCC
  3. string
  4. default "$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC
  5. help
  6. Host compiler used to build GCC plugins. This can be $(HOSTCXX),
  7. $(HOSTCC), or a null string if GCC plugin is unsupported.
  8. config HAVE_GCC_PLUGINS
  9. bool
  10. help
  11. An arch should select this symbol if it supports building with
  12. GCC plugins.
  13. menuconfig GCC_PLUGINS
  14. bool "GCC plugins"
  15. depends on HAVE_GCC_PLUGINS
  16. depends on PLUGIN_HOSTCC != ""
  17. help
  18. GCC plugins are loadable modules that provide extra features to the
  19. compiler. They are useful for runtime instrumentation and static analysis.
  20. See Documentation/gcc-plugins.txt for details.
  21. if GCC_PLUGINS
  22. config GCC_PLUGIN_CYC_COMPLEXITY
  23. bool "Compute the cyclomatic complexity of a function" if EXPERT
  24. depends on !COMPILE_TEST # too noisy
  25. help
  26. The complexity M of a function's control flow graph is defined as:
  27. M = E - N + 2P
  28. where
  29. E = the number of edges
  30. N = the number of nodes
  31. P = the number of connected components (exit nodes).
  32. Enabling this plugin reports the complexity to stderr during the
  33. build. It mainly serves as a simple example of how to create a
  34. gcc plugin for the kernel.
  35. config GCC_PLUGIN_SANCOV
  36. bool
  37. help
  38. This plugin inserts a __sanitizer_cov_trace_pc() call at the start of
  39. basic blocks. It supports all gcc versions with plugin support (from
  40. gcc-4.5 on). It is based on the commit "Add fuzzing coverage support"
  41. by Dmitry Vyukov <dvyukov@google.com>.
  42. config GCC_PLUGIN_LATENT_ENTROPY
  43. bool "Generate some entropy during boot and runtime"
  44. help
  45. By saying Y here the kernel will instrument some kernel code to
  46. extract some entropy from both original and artificially created
  47. program state. This will help especially embedded systems where
  48. there is little 'natural' source of entropy normally. The cost
  49. is some slowdown of the boot process (about 0.5%) and fork and
  50. irq processing.
  51. Note that entropy extracted this way is not cryptographically
  52. secure!
  53. This plugin was ported from grsecurity/PaX. More information at:
  54. * https://grsecurity.net/
  55. * https://pax.grsecurity.net/
  56. config GCC_PLUGIN_STRUCTLEAK
  57. bool "Force initialization of variables containing userspace addresses"
  58. # Currently STRUCTLEAK inserts initialization out of live scope of
  59. # variables from KASAN point of view. This leads to KASAN false
  60. # positive reports. Prohibit this combination for now.
  61. depends on !KASAN_EXTRA
  62. help
  63. This plugin zero-initializes any structures containing a
  64. __user attribute. This can prevent some classes of information
  65. exposures.
  66. This plugin was ported from grsecurity/PaX. More information at:
  67. * https://grsecurity.net/
  68. * https://pax.grsecurity.net/
  69. config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
  70. bool "Force initialize all struct type variables passed by reference"
  71. depends on GCC_PLUGIN_STRUCTLEAK
  72. depends on !COMPILE_TEST
  73. help
  74. Zero initialize any struct type local variable that may be passed by
  75. reference without having been initialized.
  76. config GCC_PLUGIN_STRUCTLEAK_VERBOSE
  77. bool "Report forcefully initialized variables"
  78. depends on GCC_PLUGIN_STRUCTLEAK
  79. depends on !COMPILE_TEST # too noisy
  80. help
  81. This option will cause a warning to be printed each time the
  82. structleak plugin finds a variable it thinks needs to be
  83. initialized. Since not all existing initializers are detected
  84. by the plugin, this can produce false positive warnings.
  85. config GCC_PLUGIN_RANDSTRUCT
  86. bool "Randomize layout of sensitive kernel structures"
  87. select MODVERSIONS if MODULES
  88. help
  89. If you say Y here, the layouts of structures that are entirely
  90. function pointers (and have not been manually annotated with
  91. __no_randomize_layout), or structures that have been explicitly
  92. marked with __randomize_layout, will be randomized at compile-time.
  93. This can introduce the requirement of an additional information
  94. exposure vulnerability for exploits targeting these structure
  95. types.
  96. Enabling this feature will introduce some performance impact,
  97. slightly increase memory usage, and prevent the use of forensic
  98. tools like Volatility against the system (unless the kernel
  99. source tree isn't cleaned after kernel installation).
  100. The seed used for compilation is located at
  101. scripts/gcc-plgins/randomize_layout_seed.h. It remains after
  102. a make clean to allow for external modules to be compiled with
  103. the existing seed and will be removed by a make mrproper or
  104. make distclean.
  105. Note that the implementation requires gcc 4.7 or newer.
  106. This plugin was ported from grsecurity/PaX. More information at:
  107. * https://grsecurity.net/
  108. * https://pax.grsecurity.net/
  109. config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
  110. bool "Use cacheline-aware structure randomization"
  111. depends on GCC_PLUGIN_RANDSTRUCT
  112. depends on !COMPILE_TEST # do not reduce test coverage
  113. help
  114. If you say Y here, the RANDSTRUCT randomization will make a
  115. best effort at restricting randomization to cacheline-sized
  116. groups of elements. It will further not randomize bitfields
  117. in structures. This reduces the performance hit of RANDSTRUCT
  118. at the cost of weakened randomization.
  119. config GCC_PLUGIN_STACKLEAK
  120. bool "Erase the kernel stack before returning from syscalls"
  121. depends on GCC_PLUGINS
  122. depends on HAVE_ARCH_STACKLEAK
  123. help
  124. This option makes the kernel erase the kernel stack before
  125. returning from system calls. That reduces the information which
  126. kernel stack leak bugs can reveal and blocks some uninitialized
  127. stack variable attacks.
  128. The tradeoff is the performance impact: on a single CPU system kernel
  129. compilation sees a 1% slowdown, other systems and workloads may vary
  130. and you are advised to test this feature on your expected workload
  131. before deploying it.
  132. This plugin was ported from grsecurity/PaX. More information at:
  133. * https://grsecurity.net/
  134. * https://pax.grsecurity.net/
  135. config STACKLEAK_TRACK_MIN_SIZE
  136. int "Minimum stack frame size of functions tracked by STACKLEAK"
  137. default 100
  138. range 0 4096
  139. depends on GCC_PLUGIN_STACKLEAK
  140. help
  141. The STACKLEAK gcc plugin instruments the kernel code for tracking
  142. the lowest border of the kernel stack (and for some other purposes).
  143. It inserts the stackleak_track_stack() call for the functions with
  144. a stack frame size greater than or equal to this parameter.
  145. If unsure, leave the default value 100.
  146. config STACKLEAK_METRICS
  147. bool "Show STACKLEAK metrics in the /proc file system"
  148. depends on GCC_PLUGIN_STACKLEAK
  149. depends on PROC_FS
  150. help
  151. If this is set, STACKLEAK metrics for every task are available in
  152. the /proc file system. In particular, /proc/<pid>/stack_depth
  153. shows the maximum kernel stack consumption for the current and
  154. previous syscalls. Although this information is not precise, it
  155. can be useful for estimating the STACKLEAK performance impact for
  156. your workloads.
  157. config STACKLEAK_RUNTIME_DISABLE
  158. bool "Allow runtime disabling of kernel stack erasing"
  159. depends on GCC_PLUGIN_STACKLEAK
  160. help
  161. This option provides 'stack_erasing' sysctl, which can be used in
  162. runtime to control kernel stack erasing for kernels built with
  163. CONFIG_GCC_PLUGIN_STACKLEAK.
  164. endif