Kconfig 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. menuconfig MODULES
  3. bool "Enable loadable module support"
  4. modules
  5. select EXECMEM
  6. help
  7. Kernel modules are small pieces of compiled code which can
  8. be inserted in the running kernel, rather than being
  9. permanently built into the kernel. You use the "modprobe"
  10. tool to add (and sometimes remove) them. If you say Y here,
  11. many parts of the kernel can be built as modules (by
  12. answering M instead of Y where indicated): this is most
  13. useful for infrequently used options which are not required
  14. for booting. For more information, see the man pages for
  15. modprobe, lsmod, modinfo, insmod and rmmod.
  16. If you say Y here, you will need to run "make
  17. modules_install" to put the modules under /lib/modules/
  18. where modprobe can find them (you may need to be root to do
  19. this).
  20. If unsure, say Y.
  21. if MODULES
  22. config MODULE_DEBUGFS
  23. bool
  24. config MODULE_DEBUG
  25. bool "Module debugging"
  26. depends on DEBUG_FS
  27. help
  28. Allows you to enable / disable features which can help you debug
  29. modules. You don't need these options on production systems.
  30. if MODULE_DEBUG
  31. config MODULE_STATS
  32. bool "Module statistics"
  33. depends on DEBUG_FS
  34. select MODULE_DEBUGFS
  35. help
  36. This option allows you to maintain a record of module statistics.
  37. For example, size of all modules, average size, text size, a list
  38. of failed modules and the size for each of those. For failed
  39. modules we keep track of modules which failed due to either the
  40. existing module taking too long to load or that module was already
  41. loaded.
  42. You should enable this if you are debugging production loads
  43. and want to see if userspace or the kernel is doing stupid things
  44. with loading modules when it shouldn't or if you want to help
  45. optimize userspace / kernel space module autoloading schemes.
  46. You might want to do this because failed modules tend to use
  47. up significant amount of memory, and so you'd be doing everyone a
  48. favor in avoiding these failures proactively.
  49. This functionality is also useful for those experimenting with
  50. module .text ELF section optimization.
  51. If unsure, say N.
  52. config MODULE_DEBUG_AUTOLOAD_DUPS
  53. bool "Debug duplicate modules with auto-loading"
  54. help
  55. Module autoloading allows in-kernel code to request modules through
  56. the *request_module*() API calls. This in turn just calls userspace
  57. modprobe. Although modprobe checks to see if a module is already
  58. loaded before trying to load a module there is a small time window in
  59. which multiple duplicate requests can end up in userspace and multiple
  60. modprobe calls race calling finit_module() around the same time for
  61. duplicate modules. The finit_module() system call can consume in the
  62. worst case more than twice the respective module size in virtual
  63. memory for each duplicate module requests. Although duplicate module
  64. requests are non-fatal virtual memory is a limited resource and each
  65. duplicate module request ends up just unnecessarily straining virtual
  66. memory.
  67. This debugging facility will create pr_warn() splats for duplicate
  68. module requests to help identify if module auto-loading may be the
  69. culprit to your early boot virtual memory pressure. Since virtual
  70. memory abuse caused by duplicate module requests could render a
  71. system unusable this functionality will also converge races in
  72. requests for the same module to a single request. You can boot with
  73. the module.enable_dups_trace=1 kernel parameter to use WARN_ON()
  74. instead of the pr_warn().
  75. If the first module request used request_module_nowait() we cannot
  76. use that as the anchor to wait for duplicate module requests, since
  77. users of request_module() do want a proper return value. If a call
  78. for the same module happened earlier with request_module() though,
  79. then a duplicate request_module_nowait() would be detected. The
  80. non-wait request_module() call is synchronous and waits until modprobe
  81. completes. Subsequent auto-loading requests for the same module do
  82. not trigger a new finit_module() calls and do not strain virtual
  83. memory, and so as soon as modprobe successfully completes we remove
  84. tracking for duplicates for that module.
  85. Enable this functionality to try to debug virtual memory abuse during
  86. boot on systems which are failing to boot or if you suspect you may be
  87. straining virtual memory during boot, and you want to identify if the
  88. abuse was due to module auto-loading. These issues are currently only
  89. known to occur on systems with many CPUs (over 400) and is likely the
  90. result of udev issuing duplicate module requests for each CPU, and so
  91. module auto-loading is not the culprit. There may very well still be
  92. many duplicate module auto-loading requests which could be optimized
  93. for and this debugging facility can be used to help identify them.
  94. Only enable this for debugging system functionality, never have it
  95. enabled on real systems.
  96. config MODULE_DEBUG_AUTOLOAD_DUPS_TRACE
  97. bool "Force full stack trace when duplicates are found"
  98. depends on MODULE_DEBUG_AUTOLOAD_DUPS
  99. help
  100. Enabling this will force a full stack trace for duplicate module
  101. auto-loading requests using WARN_ON() instead of pr_warn(). You
  102. should keep this disabled at all times unless you are a developer
  103. and are doing a manual inspection and want to debug exactly why
  104. these duplicates occur.
  105. endif # MODULE_DEBUG
  106. config MODULE_FORCE_LOAD
  107. bool "Forced module loading"
  108. default n
  109. help
  110. Allow loading of modules without version information (ie. modprobe
  111. --force). Forced module loading sets the 'F' (forced) taint flag and
  112. is usually a really bad idea.
  113. config MODULE_UNLOAD
  114. bool "Module unloading"
  115. help
  116. Without this option you will not be able to unload any
  117. modules (note that some modules may not be unloadable
  118. anyway), which makes your kernel smaller, faster
  119. and simpler. If unsure, say Y.
  120. config MODULE_FORCE_UNLOAD
  121. bool "Forced module unloading"
  122. depends on MODULE_UNLOAD
  123. help
  124. This option allows you to force a module to unload, even if the
  125. kernel believes it is unsafe: the kernel will remove the module
  126. without waiting for anyone to stop using it (using the -f option to
  127. rmmod). This is mainly for kernel developers and desperate users.
  128. If unsure, say N.
  129. config MODULE_UNLOAD_TAINT_TRACKING
  130. bool "Tainted module unload tracking"
  131. depends on MODULE_UNLOAD
  132. select MODULE_DEBUGFS
  133. help
  134. This option allows you to maintain a record of each unloaded
  135. module that tainted the kernel. In addition to displaying a
  136. list of linked (or loaded) modules e.g. on detection of a bad
  137. page (see bad_page()), the aforementioned details are also
  138. shown. If unsure, say N.
  139. config MODVERSIONS
  140. bool "Module versioning support"
  141. depends on !COMPILE_TEST
  142. help
  143. Usually, you have to use modules compiled with your kernel.
  144. Saying Y here makes it sometimes possible to use modules
  145. compiled for different kernels, by adding enough information
  146. to the modules to (hopefully) spot any changes which would
  147. make them incompatible with the kernel you are running. If
  148. unsure, say N.
  149. config ASM_MODVERSIONS
  150. bool
  151. default HAVE_ASM_MODVERSIONS && MODVERSIONS
  152. help
  153. This enables module versioning for exported symbols also from
  154. assembly. This can be enabled only when the target architecture
  155. supports it.
  156. config MODULE_SRCVERSION_ALL
  157. bool "Source checksum for all modules"
  158. help
  159. Modules which contain a MODULE_VERSION get an extra "srcversion"
  160. field inserted into their modinfo section, which contains a
  161. sum of the source files which made it. This helps maintainers
  162. see exactly which source was used to build a module (since
  163. others sometimes change the module source without updating
  164. the version). With this option, such a "srcversion" field
  165. will be created for all modules. If unsure, say N.
  166. config MODULE_SIG
  167. bool "Module signature verification"
  168. select MODULE_SIG_FORMAT
  169. help
  170. Check modules for valid signatures upon load: the signature
  171. is simply appended to the module. For more information see
  172. <file:Documentation/admin-guide/module-signing.rst>.
  173. Note that this option adds the OpenSSL development packages as a
  174. kernel build dependency so that the signing tool can use its crypto
  175. library.
  176. You should enable this option if you wish to use either
  177. CONFIG_SECURITY_LOCKDOWN_LSM or lockdown functionality imposed via
  178. another LSM - otherwise unsigned modules will be loadable regardless
  179. of the lockdown policy.
  180. !!!WARNING!!! If you enable this option, you MUST make sure that the
  181. module DOES NOT get stripped after being signed. This includes the
  182. debuginfo strip done by some packagers (such as rpmbuild) and
  183. inclusion into an initramfs that wants the module size reduced.
  184. config MODULE_SIG_FORCE
  185. bool "Require modules to be validly signed"
  186. depends on MODULE_SIG
  187. help
  188. Reject unsigned modules or signed modules for which we don't have a
  189. key. Without this, such modules will simply taint the kernel.
  190. config MODULE_SIG_ALL
  191. bool "Automatically sign all modules"
  192. default y
  193. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  194. help
  195. Sign all modules during make modules_install. Without this option,
  196. modules must be signed manually, using the scripts/sign-file tool.
  197. comment "Do not forget to sign required modules with scripts/sign-file"
  198. depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
  199. choice
  200. prompt "Hash algorithm to sign modules"
  201. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  202. default MODULE_SIG_SHA512
  203. help
  204. This determines which sort of hashing algorithm will be used during
  205. signature generation. This algorithm _must_ be built into the kernel
  206. directly so that signature verification can take place. It is not
  207. possible to load a signed module containing the algorithm to check
  208. the signature on that module.
  209. config MODULE_SIG_SHA1
  210. bool "SHA-1"
  211. select CRYPTO_SHA1
  212. config MODULE_SIG_SHA256
  213. bool "SHA-256"
  214. select CRYPTO_SHA256
  215. config MODULE_SIG_SHA384
  216. bool "SHA-384"
  217. select CRYPTO_SHA512
  218. config MODULE_SIG_SHA512
  219. bool "SHA-512"
  220. select CRYPTO_SHA512
  221. config MODULE_SIG_SHA3_256
  222. bool "SHA3-256"
  223. select CRYPTO_SHA3
  224. config MODULE_SIG_SHA3_384
  225. bool "SHA3-384"
  226. select CRYPTO_SHA3
  227. config MODULE_SIG_SHA3_512
  228. bool "SHA3-512"
  229. select CRYPTO_SHA3
  230. endchoice
  231. config MODULE_SIG_HASH
  232. string
  233. depends on MODULE_SIG || IMA_APPRAISE_MODSIG
  234. default "sha1" if MODULE_SIG_SHA1
  235. default "sha256" if MODULE_SIG_SHA256
  236. default "sha384" if MODULE_SIG_SHA384
  237. default "sha512" if MODULE_SIG_SHA512
  238. default "sha3-256" if MODULE_SIG_SHA3_256
  239. default "sha3-384" if MODULE_SIG_SHA3_384
  240. default "sha3-512" if MODULE_SIG_SHA3_512
  241. config MODULE_COMPRESS
  242. bool "Module compression"
  243. help
  244. Enable module compression to reduce on-disk size of module binaries.
  245. This is fully compatible with signed modules.
  246. The tool used to work with modules needs to support the selected
  247. compression type. kmod MAY support gzip, xz and zstd. Other tools
  248. might have a limited selection of the supported types.
  249. Note that for modules inside an initrd or initramfs, it's more
  250. efficient to compress the whole ramdisk instead.
  251. If unsure, say N.
  252. choice
  253. prompt "Module compression type"
  254. depends on MODULE_COMPRESS
  255. help
  256. Choose the supported algorithm for module compression.
  257. config MODULE_COMPRESS_GZIP
  258. bool "GZIP"
  259. help
  260. Support modules compressed with GZIP. The installed modules are
  261. suffixed with .ko.gz.
  262. config MODULE_COMPRESS_XZ
  263. bool "XZ"
  264. help
  265. Support modules compressed with XZ. The installed modules are
  266. suffixed with .ko.xz.
  267. config MODULE_COMPRESS_ZSTD
  268. bool "ZSTD"
  269. help
  270. Support modules compressed with ZSTD. The installed modules are
  271. suffixed with .ko.zst.
  272. endchoice
  273. config MODULE_COMPRESS_ALL
  274. bool "Automatically compress all modules"
  275. default y
  276. depends on MODULE_COMPRESS
  277. help
  278. Compress all modules during 'make modules_install'.
  279. Your build system needs to provide the appropriate compression tool
  280. for the selected compression type. External modules will also be
  281. compressed in the same way during the installation.
  282. config MODULE_DECOMPRESS
  283. bool "Support in-kernel module decompression"
  284. depends on MODULE_COMPRESS
  285. select ZLIB_INFLATE if MODULE_COMPRESS_GZIP
  286. select XZ_DEC if MODULE_COMPRESS_XZ
  287. select ZSTD_DECOMPRESS if MODULE_COMPRESS_ZSTD
  288. help
  289. Support for decompressing kernel modules by the kernel itself
  290. instead of relying on userspace to perform this task. Useful when
  291. load pinning security policy is enabled.
  292. If unsure, say N.
  293. config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
  294. bool "Allow loading of modules with missing namespace imports"
  295. help
  296. Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in
  297. a namespace. A module that makes use of a symbol exported with such a
  298. namespace is required to import the namespace via MODULE_IMPORT_NS().
  299. There is no technical reason to enforce correct namespace imports,
  300. but it creates consistency between symbols defining namespaces and
  301. users importing namespaces they make use of. This option relaxes this
  302. requirement and lifts the enforcement when loading a module.
  303. If unsure, say N.
  304. config MODPROBE_PATH
  305. string "Path to modprobe binary"
  306. default "/sbin/modprobe"
  307. help
  308. When kernel code requests a module, it does so by calling
  309. the "modprobe" userspace utility. This option allows you to
  310. set the path where that binary is found. This can be changed
  311. at runtime via the sysctl file
  312. /proc/sys/kernel/modprobe. Setting this to the empty string
  313. removes the kernel's ability to request modules (but
  314. userspace can still load modules explicitly).
  315. config TRIM_UNUSED_KSYMS
  316. bool "Trim unused exported kernel symbols"
  317. help
  318. The kernel and some modules make many symbols available for
  319. other modules to use via EXPORT_SYMBOL() and variants. Depending
  320. on the set of modules being selected in your kernel configuration,
  321. many of those exported symbols might never be used.
  322. This option allows for unused exported symbols to be dropped from
  323. the build. In turn, this provides the compiler more opportunities
  324. (especially when using LTO) for optimizing the code and reducing
  325. binary size. This might have some security advantages as well.
  326. If unsure, or if you need to build out-of-tree modules, say N.
  327. config UNUSED_KSYMS_WHITELIST
  328. string "Whitelist of symbols to keep in ksymtab"
  329. depends on TRIM_UNUSED_KSYMS
  330. help
  331. By default, all unused exported symbols will be un-exported from the
  332. build when TRIM_UNUSED_KSYMS is selected.
  333. UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept
  334. exported at all times, even in absence of in-tree users. The value to
  335. set here is the path to a text file containing the list of symbols,
  336. one per line. The path can be absolute, or relative to the kernel
  337. source or obj tree.
  338. config MODULES_TREE_LOOKUP
  339. def_bool y
  340. depends on PERF_EVENTS || TRACING || CFI_CLANG
  341. endif # MODULES