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