Kconfig 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. menuconfig MODULES
  3. bool "Enable loadable module support"
  4. modules
  5. help
  6. Kernel modules are small pieces of compiled code which can
  7. be inserted in the running kernel, rather than being
  8. permanently built into the kernel. You use the "modprobe"
  9. tool to add (and sometimes remove) them. If you say Y here,
  10. many parts of the kernel can be built as modules (by
  11. answering M instead of Y where indicated): this is most
  12. useful for infrequently used options which are not required
  13. for booting. For more information, see the man pages for
  14. modprobe, lsmod, modinfo, insmod and rmmod.
  15. If you say Y here, you will need to run "make
  16. modules_install" to put the modules under /lib/modules/
  17. where modprobe can find them (you may need to be root to do
  18. this).
  19. If unsure, say Y.
  20. if MODULES
  21. config MODULE_FORCE_LOAD
  22. bool "Forced module loading"
  23. default n
  24. help
  25. Allow loading of modules without version information (ie. modprobe
  26. --force). Forced module loading sets the 'F' (forced) taint flag and
  27. is usually a really bad idea.
  28. config MODULE_UNLOAD
  29. bool "Module unloading"
  30. help
  31. Without this option you will not be able to unload any
  32. modules (note that some modules may not be unloadable
  33. anyway), which makes your kernel smaller, faster
  34. and simpler. If unsure, say Y.
  35. config MODULE_FORCE_UNLOAD
  36. bool "Forced module unloading"
  37. depends on MODULE_UNLOAD
  38. help
  39. This option allows you to force a module to unload, even if the
  40. kernel believes it is unsafe: the kernel will remove the module
  41. without waiting for anyone to stop using it (using the -f option to
  42. rmmod). This is mainly for kernel developers and desperate users.
  43. If unsure, say N.
  44. config MODULE_UNLOAD_TAINT_TRACKING
  45. bool "Tainted module unload tracking"
  46. depends on MODULE_UNLOAD
  47. default n
  48. help
  49. This option allows you to maintain a record of each unloaded
  50. module that tainted the kernel. In addition to displaying a
  51. list of linked (or loaded) modules e.g. on detection of a bad
  52. page (see bad_page()), the aforementioned details are also
  53. shown. If unsure, say N.
  54. config MODVERSIONS
  55. bool "Module versioning support"
  56. help
  57. Usually, you have to use modules compiled with your kernel.
  58. Saying Y here makes it sometimes possible to use modules
  59. compiled for different kernels, by adding enough information
  60. to the modules to (hopefully) spot any changes which would
  61. make them incompatible with the kernel you are running. If
  62. unsure, say N.
  63. config ASM_MODVERSIONS
  64. bool
  65. default HAVE_ASM_MODVERSIONS && MODVERSIONS
  66. help
  67. This enables module versioning for exported symbols also from
  68. assembly. This can be enabled only when the target architecture
  69. supports it.
  70. config MODULE_SRCVERSION_ALL
  71. bool "Source checksum for all modules"
  72. help
  73. Modules which contain a MODULE_VERSION get an extra "srcversion"
  74. field inserted into their modinfo section, which contains a
  75. sum of the source files which made it. This helps maintainers
  76. see exactly which source was used to build a module (since
  77. others sometimes change the module source without updating
  78. the version). With this option, such a "srcversion" field
  79. will be created for all modules. If unsure, say N.
  80. config MODULE_SCMVERSION
  81. bool "SCM version for modules"
  82. depends on LOCALVERSION_AUTO
  83. help
  84. This enables the module attribute "scmversion" which can be used
  85. by developers to identify the SCM version of a given module, e.g.
  86. git sha1 or hg sha1. The SCM version can be queried by modinfo or
  87. via the sysfs node: /sys/modules/MODULENAME/scmversion. This is
  88. useful when the kernel or kernel modules are updated separately
  89. since that causes the vermagic of the kernel and the module to
  90. differ.
  91. If unsure, say N.
  92. config MODULE_SIG
  93. bool "Module signature verification"
  94. select MODULE_SIG_FORMAT
  95. help
  96. Check modules for valid signatures upon load: the signature
  97. is simply appended to the module. For more information see
  98. <file:Documentation/admin-guide/module-signing.rst>.
  99. Note that this option adds the OpenSSL development packages as a
  100. kernel build dependency so that the signing tool can use its crypto
  101. library.
  102. You should enable this option if you wish to use either
  103. CONFIG_SECURITY_LOCKDOWN_LSM or lockdown functionality imposed via
  104. another LSM - otherwise unsigned modules will be loadable regardless
  105. of the lockdown policy.
  106. !!!WARNING!!! If you enable this option, you MUST make sure that the
  107. module DOES NOT get stripped after being signed. This includes the
  108. debuginfo strip done by some packagers (such as rpmbuild) and
  109. inclusion into an initramfs that wants the module size reduced.
  110. config MODULE_SIG_FORCE
  111. bool "Require modules to be validly signed"
  112. depends on MODULE_SIG
  113. help
  114. Reject unsigned modules or signed modules for which we don't have a
  115. key. Without this, such modules will simply taint the kernel.
  116. config MODULE_SIG_PROTECT
  117. bool "Android GKI module protection"
  118. depends on MODULE_SIG && !MODULE_SIG_FORCE
  119. help
  120. Enables Android GKI symbol and export protection support.
  121. This modifies the behavior of the MODULE_SIG_FORCE as follows:
  122. - Allows Android GKI Modules signed using MODULE_SIG_ALL during build.
  123. - Allows other modules to load if they don't violate the access to
  124. Android GKI protected symbols and do not export the symbols already
  125. exported by the Android GKI modules. Loading will fail and return
  126. -EACCES (Permission denied) if symbol access conditions are not met.
  127. config MODULE_SIG_ALL
  128. bool "Automatically sign all modules"
  129. default y
  130. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  131. help
  132. Sign all modules during make modules_install. Without this option,
  133. modules must be signed manually, using the scripts/sign-file tool.
  134. comment "Do not forget to sign required modules with scripts/sign-file"
  135. depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
  136. choice
  137. prompt "Which hash algorithm should modules be signed with?"
  138. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  139. help
  140. This determines which sort of hashing algorithm will be used during
  141. signature generation. This algorithm _must_ be built into the kernel
  142. directly so that signature verification can take place. It is not
  143. possible to load a signed module containing the algorithm to check
  144. the signature on that module.
  145. config MODULE_SIG_SHA1
  146. bool "Sign modules with SHA-1"
  147. select CRYPTO_SHA1
  148. config MODULE_SIG_SHA224
  149. bool "Sign modules with SHA-224"
  150. select CRYPTO_SHA256
  151. config MODULE_SIG_SHA256
  152. bool "Sign modules with SHA-256"
  153. select CRYPTO_SHA256
  154. config MODULE_SIG_SHA384
  155. bool "Sign modules with SHA-384"
  156. select CRYPTO_SHA512
  157. config MODULE_SIG_SHA512
  158. bool "Sign modules with SHA-512"
  159. select CRYPTO_SHA512
  160. endchoice
  161. config MODULE_SIG_HASH
  162. string
  163. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  164. default "sha1" if MODULE_SIG_SHA1
  165. default "sha224" if MODULE_SIG_SHA224
  166. default "sha256" if MODULE_SIG_SHA256
  167. default "sha384" if MODULE_SIG_SHA384
  168. default "sha512" if MODULE_SIG_SHA512
  169. choice
  170. prompt "Module compression mode"
  171. help
  172. This option allows you to choose the algorithm which will be used to
  173. compress modules when 'make modules_install' is run. (or, you can
  174. choose to not compress modules at all.)
  175. External modules will also be compressed in the same way during the
  176. installation.
  177. For modules inside an initrd or initramfs, it's more efficient to
  178. compress the whole initrd or initramfs instead.
  179. This is fully compatible with signed modules.
  180. Please note that the tool used to load modules needs to support the
  181. corresponding algorithm. module-init-tools MAY support gzip, and kmod
  182. MAY support gzip, xz and zstd.
  183. Your build system needs to provide the appropriate compression tool
  184. to compress the modules.
  185. If in doubt, select 'None'.
  186. config MODULE_COMPRESS_NONE
  187. bool "None"
  188. help
  189. Do not compress modules. The installed modules are suffixed
  190. with .ko.
  191. config MODULE_COMPRESS_GZIP
  192. bool "GZIP"
  193. help
  194. Compress modules with GZIP. The installed modules are suffixed
  195. with .ko.gz.
  196. config MODULE_COMPRESS_XZ
  197. bool "XZ"
  198. help
  199. Compress modules with XZ. The installed modules are suffixed
  200. with .ko.xz.
  201. config MODULE_COMPRESS_ZSTD
  202. bool "ZSTD"
  203. help
  204. Compress modules with ZSTD. The installed modules are suffixed
  205. with .ko.zst.
  206. endchoice
  207. config MODULE_DECOMPRESS
  208. bool "Support in-kernel module decompression"
  209. depends on MODULE_COMPRESS_GZIP || MODULE_COMPRESS_XZ
  210. select ZLIB_INFLATE if MODULE_COMPRESS_GZIP
  211. select XZ_DEC if MODULE_COMPRESS_XZ
  212. help
  213. Support for decompressing kernel modules by the kernel itself
  214. instead of relying on userspace to perform this task. Useful when
  215. load pinning security policy is enabled.
  216. If unsure, say N.
  217. config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
  218. bool "Allow loading of modules with missing namespace imports"
  219. help
  220. Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in
  221. a namespace. A module that makes use of a symbol exported with such a
  222. namespace is required to import the namespace via MODULE_IMPORT_NS().
  223. There is no technical reason to enforce correct namespace imports,
  224. but it creates consistency between symbols defining namespaces and
  225. users importing namespaces they make use of. This option relaxes this
  226. requirement and lifts the enforcement when loading a module.
  227. If unsure, say N.
  228. config MODPROBE_PATH
  229. string "Path to modprobe binary"
  230. default "/sbin/modprobe"
  231. help
  232. When kernel code requests a module, it does so by calling
  233. the "modprobe" userspace utility. This option allows you to
  234. set the path where that binary is found. This can be changed
  235. at runtime via the sysctl file
  236. /proc/sys/kernel/modprobe. Setting this to the empty string
  237. removes the kernel's ability to request modules (but
  238. userspace can still load modules explicitly).
  239. config TRIM_UNUSED_KSYMS
  240. bool "Trim unused exported kernel symbols" if EXPERT
  241. depends on !COMPILE_TEST
  242. help
  243. The kernel and some modules make many symbols available for
  244. other modules to use via EXPORT_SYMBOL() and variants. Depending
  245. on the set of modules being selected in your kernel configuration,
  246. many of those exported symbols might never be used.
  247. This option allows for unused exported symbols to be dropped from
  248. the build. In turn, this provides the compiler more opportunities
  249. (especially when using LTO) for optimizing the code and reducing
  250. binary size. This might have some security advantages as well.
  251. If unsure, or if you need to build out-of-tree modules, say N.
  252. config UNUSED_KSYMS_WHITELIST
  253. string "Whitelist of symbols to keep in ksymtab"
  254. depends on TRIM_UNUSED_KSYMS
  255. help
  256. By default, all unused exported symbols will be un-exported from the
  257. build when TRIM_UNUSED_KSYMS is selected.
  258. UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept
  259. exported at all times, even in absence of in-tree users. The value to
  260. set here is the path to a text file containing the list of symbols,
  261. one per line. The path can be absolute, or relative to the kernel
  262. source tree.
  263. config MODULES_TREE_LOOKUP
  264. def_bool y
  265. depends on PERF_EVENTS || TRACING || CFI_CLANG
  266. endif # MODULES