xref: /linux/kernel/module/Kconfig (revision 169a58ad824d896b9e291a27193342616e651b82)
173b4fc92SChristophe Leroy# SPDX-License-Identifier: GPL-2.0-only
273b4fc92SChristophe Leroymenuconfig MODULES
373b4fc92SChristophe Leroy	bool "Enable loadable module support"
473b4fc92SChristophe Leroy	modules
573b4fc92SChristophe Leroy	help
673b4fc92SChristophe Leroy	  Kernel modules are small pieces of compiled code which can
773b4fc92SChristophe Leroy	  be inserted in the running kernel, rather than being
873b4fc92SChristophe Leroy	  permanently built into the kernel.  You use the "modprobe"
973b4fc92SChristophe Leroy	  tool to add (and sometimes remove) them.  If you say Y here,
1073b4fc92SChristophe Leroy	  many parts of the kernel can be built as modules (by
1173b4fc92SChristophe Leroy	  answering M instead of Y where indicated): this is most
1273b4fc92SChristophe Leroy	  useful for infrequently used options which are not required
1373b4fc92SChristophe Leroy	  for booting.  For more information, see the man pages for
1473b4fc92SChristophe Leroy	  modprobe, lsmod, modinfo, insmod and rmmod.
1573b4fc92SChristophe Leroy
1673b4fc92SChristophe Leroy	  If you say Y here, you will need to run "make
1773b4fc92SChristophe Leroy	  modules_install" to put the modules under /lib/modules/
1873b4fc92SChristophe Leroy	  where modprobe can find them (you may need to be root to do
1973b4fc92SChristophe Leroy	  this).
2073b4fc92SChristophe Leroy
2173b4fc92SChristophe Leroy	  If unsure, say Y.
2273b4fc92SChristophe Leroy
2373b4fc92SChristophe Leroyif MODULES
2473b4fc92SChristophe Leroy
2573b4fc92SChristophe Leroyconfig MODULE_FORCE_LOAD
2673b4fc92SChristophe Leroy	bool "Forced module loading"
2773b4fc92SChristophe Leroy	default n
2873b4fc92SChristophe Leroy	help
2973b4fc92SChristophe Leroy	  Allow loading of modules without version information (ie. modprobe
3073b4fc92SChristophe Leroy	  --force).  Forced module loading sets the 'F' (forced) taint flag and
3173b4fc92SChristophe Leroy	  is usually a really bad idea.
3273b4fc92SChristophe Leroy
3373b4fc92SChristophe Leroyconfig MODULE_UNLOAD
3473b4fc92SChristophe Leroy	bool "Module unloading"
3573b4fc92SChristophe Leroy	help
3673b4fc92SChristophe Leroy	  Without this option you will not be able to unload any
3773b4fc92SChristophe Leroy	  modules (note that some modules may not be unloadable
3873b4fc92SChristophe Leroy	  anyway), which makes your kernel smaller, faster
3973b4fc92SChristophe Leroy	  and simpler.  If unsure, say Y.
4073b4fc92SChristophe Leroy
4173b4fc92SChristophe Leroyconfig MODULE_FORCE_UNLOAD
4273b4fc92SChristophe Leroy	bool "Forced module unloading"
4373b4fc92SChristophe Leroy	depends on MODULE_UNLOAD
4473b4fc92SChristophe Leroy	help
4573b4fc92SChristophe Leroy	  This option allows you to force a module to unload, even if the
4673b4fc92SChristophe Leroy	  kernel believes it is unsafe: the kernel will remove the module
4773b4fc92SChristophe Leroy	  without waiting for anyone to stop using it (using the -f option to
4873b4fc92SChristophe Leroy	  rmmod).  This is mainly for kernel developers and desperate users.
4973b4fc92SChristophe Leroy	  If unsure, say N.
5073b4fc92SChristophe Leroy
5173b4fc92SChristophe Leroyconfig MODULE_UNLOAD_TAINT_TRACKING
5273b4fc92SChristophe Leroy	bool "Tainted module unload tracking"
5373b4fc92SChristophe Leroy	depends on MODULE_UNLOAD
5473b4fc92SChristophe Leroy	default n
5573b4fc92SChristophe Leroy	help
5673b4fc92SChristophe Leroy	  This option allows you to maintain a record of each unloaded
5773b4fc92SChristophe Leroy	  module that tainted the kernel. In addition to displaying a
5873b4fc92SChristophe Leroy	  list of linked (or loaded) modules e.g. on detection of a bad
5973b4fc92SChristophe Leroy	  page (see bad_page()), the aforementioned details are also
6073b4fc92SChristophe Leroy	  shown. If unsure, say N.
6173b4fc92SChristophe Leroy
6273b4fc92SChristophe Leroyconfig MODVERSIONS
6373b4fc92SChristophe Leroy	bool "Module versioning support"
6473b4fc92SChristophe Leroy	help
6573b4fc92SChristophe Leroy	  Usually, you have to use modules compiled with your kernel.
6673b4fc92SChristophe Leroy	  Saying Y here makes it sometimes possible to use modules
6773b4fc92SChristophe Leroy	  compiled for different kernels, by adding enough information
6873b4fc92SChristophe Leroy	  to the modules to (hopefully) spot any changes which would
6973b4fc92SChristophe Leroy	  make them incompatible with the kernel you are running.  If
7073b4fc92SChristophe Leroy	  unsure, say N.
7173b4fc92SChristophe Leroy
7273b4fc92SChristophe Leroyconfig ASM_MODVERSIONS
7373b4fc92SChristophe Leroy	bool
7473b4fc92SChristophe Leroy	default HAVE_ASM_MODVERSIONS && MODVERSIONS
7573b4fc92SChristophe Leroy	help
7673b4fc92SChristophe Leroy	  This enables module versioning for exported symbols also from
7773b4fc92SChristophe Leroy	  assembly. This can be enabled only when the target architecture
7873b4fc92SChristophe Leroy	  supports it.
7973b4fc92SChristophe Leroy
8073b4fc92SChristophe Leroyconfig MODULE_SRCVERSION_ALL
8173b4fc92SChristophe Leroy	bool "Source checksum for all modules"
8273b4fc92SChristophe Leroy	help
8373b4fc92SChristophe Leroy	  Modules which contain a MODULE_VERSION get an extra "srcversion"
8473b4fc92SChristophe Leroy	  field inserted into their modinfo section, which contains a
8573b4fc92SChristophe Leroy	  sum of the source files which made it.  This helps maintainers
8673b4fc92SChristophe Leroy	  see exactly which source was used to build a module (since
8773b4fc92SChristophe Leroy	  others sometimes change the module source without updating
8873b4fc92SChristophe Leroy	  the version).  With this option, such a "srcversion" field
8973b4fc92SChristophe Leroy	  will be created for all modules.  If unsure, say N.
9073b4fc92SChristophe Leroy
9173b4fc92SChristophe Leroyconfig MODULE_SIG
9273b4fc92SChristophe Leroy	bool "Module signature verification"
9373b4fc92SChristophe Leroy	select MODULE_SIG_FORMAT
9473b4fc92SChristophe Leroy	help
9573b4fc92SChristophe Leroy	  Check modules for valid signatures upon load: the signature
9673b4fc92SChristophe Leroy	  is simply appended to the module. For more information see
9773b4fc92SChristophe Leroy	  <file:Documentation/admin-guide/module-signing.rst>.
9873b4fc92SChristophe Leroy
9973b4fc92SChristophe Leroy	  Note that this option adds the OpenSSL development packages as a
10073b4fc92SChristophe Leroy	  kernel build dependency so that the signing tool can use its crypto
10173b4fc92SChristophe Leroy	  library.
10273b4fc92SChristophe Leroy
10373b4fc92SChristophe Leroy	  You should enable this option if you wish to use either
10473b4fc92SChristophe Leroy	  CONFIG_SECURITY_LOCKDOWN_LSM or lockdown functionality imposed via
10573b4fc92SChristophe Leroy	  another LSM - otherwise unsigned modules will be loadable regardless
10673b4fc92SChristophe Leroy	  of the lockdown policy.
10773b4fc92SChristophe Leroy
10873b4fc92SChristophe Leroy	  !!!WARNING!!!  If you enable this option, you MUST make sure that the
10973b4fc92SChristophe Leroy	  module DOES NOT get stripped after being signed.  This includes the
11073b4fc92SChristophe Leroy	  debuginfo strip done by some packagers (such as rpmbuild) and
11173b4fc92SChristophe Leroy	  inclusion into an initramfs that wants the module size reduced.
11273b4fc92SChristophe Leroy
11373b4fc92SChristophe Leroyconfig MODULE_SIG_FORCE
11473b4fc92SChristophe Leroy	bool "Require modules to be validly signed"
11573b4fc92SChristophe Leroy	depends on MODULE_SIG
11673b4fc92SChristophe Leroy	help
11773b4fc92SChristophe Leroy	  Reject unsigned modules or signed modules for which we don't have a
11873b4fc92SChristophe Leroy	  key.  Without this, such modules will simply taint the kernel.
11973b4fc92SChristophe Leroy
12073b4fc92SChristophe Leroyconfig MODULE_SIG_ALL
12173b4fc92SChristophe Leroy	bool "Automatically sign all modules"
12273b4fc92SChristophe Leroy	default y
12373b4fc92SChristophe Leroy	depends on MODULE_SIG || IMA_APPRAISE_MODSIG
12473b4fc92SChristophe Leroy	help
12573b4fc92SChristophe Leroy	  Sign all modules during make modules_install. Without this option,
12673b4fc92SChristophe Leroy	  modules must be signed manually, using the scripts/sign-file tool.
12773b4fc92SChristophe Leroy
12873b4fc92SChristophe Leroycomment "Do not forget to sign required modules with scripts/sign-file"
12973b4fc92SChristophe Leroy	depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
13073b4fc92SChristophe Leroy
13173b4fc92SChristophe Leroychoice
13273b4fc92SChristophe Leroy	prompt "Which hash algorithm should modules be signed with?"
13373b4fc92SChristophe Leroy	depends on MODULE_SIG || IMA_APPRAISE_MODSIG
13473b4fc92SChristophe Leroy	help
13573b4fc92SChristophe Leroy	  This determines which sort of hashing algorithm will be used during
13673b4fc92SChristophe Leroy	  signature generation.  This algorithm _must_ be built into the kernel
13773b4fc92SChristophe Leroy	  directly so that signature verification can take place.  It is not
13873b4fc92SChristophe Leroy	  possible to load a signed module containing the algorithm to check
13973b4fc92SChristophe Leroy	  the signature on that module.
14073b4fc92SChristophe Leroy
14173b4fc92SChristophe Leroyconfig MODULE_SIG_SHA1
14273b4fc92SChristophe Leroy	bool "Sign modules with SHA-1"
14373b4fc92SChristophe Leroy	select CRYPTO_SHA1
14473b4fc92SChristophe Leroy
14573b4fc92SChristophe Leroyconfig MODULE_SIG_SHA224
14673b4fc92SChristophe Leroy	bool "Sign modules with SHA-224"
14773b4fc92SChristophe Leroy	select CRYPTO_SHA256
14873b4fc92SChristophe Leroy
14973b4fc92SChristophe Leroyconfig MODULE_SIG_SHA256
15073b4fc92SChristophe Leroy	bool "Sign modules with SHA-256"
15173b4fc92SChristophe Leroy	select CRYPTO_SHA256
15273b4fc92SChristophe Leroy
15373b4fc92SChristophe Leroyconfig MODULE_SIG_SHA384
15473b4fc92SChristophe Leroy	bool "Sign modules with SHA-384"
15573b4fc92SChristophe Leroy	select CRYPTO_SHA512
15673b4fc92SChristophe Leroy
15773b4fc92SChristophe Leroyconfig MODULE_SIG_SHA512
15873b4fc92SChristophe Leroy	bool "Sign modules with SHA-512"
15973b4fc92SChristophe Leroy	select CRYPTO_SHA512
16073b4fc92SChristophe Leroy
16173b4fc92SChristophe Leroyendchoice
16273b4fc92SChristophe Leroy
16373b4fc92SChristophe Leroyconfig MODULE_SIG_HASH
16473b4fc92SChristophe Leroy	string
16573b4fc92SChristophe Leroy	depends on MODULE_SIG || IMA_APPRAISE_MODSIG
16673b4fc92SChristophe Leroy	default "sha1" if MODULE_SIG_SHA1
16773b4fc92SChristophe Leroy	default "sha224" if MODULE_SIG_SHA224
16873b4fc92SChristophe Leroy	default "sha256" if MODULE_SIG_SHA256
16973b4fc92SChristophe Leroy	default "sha384" if MODULE_SIG_SHA384
17073b4fc92SChristophe Leroy	default "sha512" if MODULE_SIG_SHA512
17173b4fc92SChristophe Leroy
17273b4fc92SChristophe Leroychoice
17373b4fc92SChristophe Leroy	prompt "Module compression mode"
17473b4fc92SChristophe Leroy	help
17573b4fc92SChristophe Leroy	  This option allows you to choose the algorithm which will be used to
17673b4fc92SChristophe Leroy	  compress modules when 'make modules_install' is run. (or, you can
17773b4fc92SChristophe Leroy	  choose to not compress modules at all.)
17873b4fc92SChristophe Leroy
17973b4fc92SChristophe Leroy	  External modules will also be compressed in the same way during the
18073b4fc92SChristophe Leroy	  installation.
18173b4fc92SChristophe Leroy
18273b4fc92SChristophe Leroy	  For modules inside an initrd or initramfs, it's more efficient to
18373b4fc92SChristophe Leroy	  compress the whole initrd or initramfs instead.
18473b4fc92SChristophe Leroy
18573b4fc92SChristophe Leroy	  This is fully compatible with signed modules.
18673b4fc92SChristophe Leroy
18773b4fc92SChristophe Leroy	  Please note that the tool used to load modules needs to support the
18873b4fc92SChristophe Leroy	  corresponding algorithm. module-init-tools MAY support gzip, and kmod
18973b4fc92SChristophe Leroy	  MAY support gzip, xz and zstd.
19073b4fc92SChristophe Leroy
19173b4fc92SChristophe Leroy	  Your build system needs to provide the appropriate compression tool
19273b4fc92SChristophe Leroy	  to compress the modules.
19373b4fc92SChristophe Leroy
19473b4fc92SChristophe Leroy	  If in doubt, select 'None'.
19573b4fc92SChristophe Leroy
19673b4fc92SChristophe Leroyconfig MODULE_COMPRESS_NONE
19773b4fc92SChristophe Leroy	bool "None"
19873b4fc92SChristophe Leroy	help
19973b4fc92SChristophe Leroy	  Do not compress modules. The installed modules are suffixed
20073b4fc92SChristophe Leroy	  with .ko.
20173b4fc92SChristophe Leroy
20273b4fc92SChristophe Leroyconfig MODULE_COMPRESS_GZIP
20373b4fc92SChristophe Leroy	bool "GZIP"
20473b4fc92SChristophe Leroy	help
20573b4fc92SChristophe Leroy	  Compress modules with GZIP. The installed modules are suffixed
20673b4fc92SChristophe Leroy	  with .ko.gz.
20773b4fc92SChristophe Leroy
20873b4fc92SChristophe Leroyconfig MODULE_COMPRESS_XZ
20973b4fc92SChristophe Leroy	bool "XZ"
21073b4fc92SChristophe Leroy	help
21173b4fc92SChristophe Leroy	  Compress modules with XZ. The installed modules are suffixed
21273b4fc92SChristophe Leroy	  with .ko.xz.
21373b4fc92SChristophe Leroy
21473b4fc92SChristophe Leroyconfig MODULE_COMPRESS_ZSTD
21573b4fc92SChristophe Leroy	bool "ZSTD"
21673b4fc92SChristophe Leroy	help
21773b4fc92SChristophe Leroy	  Compress modules with ZSTD. The installed modules are suffixed
21873b4fc92SChristophe Leroy	  with .ko.zst.
21973b4fc92SChristophe Leroy
22073b4fc92SChristophe Leroyendchoice
22173b4fc92SChristophe Leroy
22273b4fc92SChristophe Leroyconfig MODULE_DECOMPRESS
22373b4fc92SChristophe Leroy	bool "Support in-kernel module decompression"
224*169a58adSStephen Boyd	depends on MODULE_COMPRESS_GZIP || MODULE_COMPRESS_XZ || MODULE_COMPRESS_ZSTD
22573b4fc92SChristophe Leroy	select ZLIB_INFLATE if MODULE_COMPRESS_GZIP
22673b4fc92SChristophe Leroy	select XZ_DEC if MODULE_COMPRESS_XZ
227*169a58adSStephen Boyd	select ZSTD_DECOMPRESS if MODULE_COMPRESS_ZSTD
22873b4fc92SChristophe Leroy	help
22973b4fc92SChristophe Leroy
23073b4fc92SChristophe Leroy	  Support for decompressing kernel modules by the kernel itself
23173b4fc92SChristophe Leroy	  instead of relying on userspace to perform this task. Useful when
23273b4fc92SChristophe Leroy	  load pinning security policy is enabled.
23373b4fc92SChristophe Leroy
23473b4fc92SChristophe Leroy	  If unsure, say N.
23573b4fc92SChristophe Leroy
23673b4fc92SChristophe Leroyconfig MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
23773b4fc92SChristophe Leroy	bool "Allow loading of modules with missing namespace imports"
23873b4fc92SChristophe Leroy	help
23973b4fc92SChristophe Leroy	  Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in
24073b4fc92SChristophe Leroy	  a namespace. A module that makes use of a symbol exported with such a
24173b4fc92SChristophe Leroy	  namespace is required to import the namespace via MODULE_IMPORT_NS().
24273b4fc92SChristophe Leroy	  There is no technical reason to enforce correct namespace imports,
24373b4fc92SChristophe Leroy	  but it creates consistency between symbols defining namespaces and
24473b4fc92SChristophe Leroy	  users importing namespaces they make use of. This option relaxes this
24573b4fc92SChristophe Leroy	  requirement and lifts the enforcement when loading a module.
24673b4fc92SChristophe Leroy
24773b4fc92SChristophe Leroy	  If unsure, say N.
24873b4fc92SChristophe Leroy
24973b4fc92SChristophe Leroyconfig MODPROBE_PATH
25073b4fc92SChristophe Leroy	string "Path to modprobe binary"
25173b4fc92SChristophe Leroy	default "/sbin/modprobe"
25273b4fc92SChristophe Leroy	help
25373b4fc92SChristophe Leroy	  When kernel code requests a module, it does so by calling
25473b4fc92SChristophe Leroy	  the "modprobe" userspace utility. This option allows you to
25573b4fc92SChristophe Leroy	  set the path where that binary is found. This can be changed
25673b4fc92SChristophe Leroy	  at runtime via the sysctl file
25773b4fc92SChristophe Leroy	  /proc/sys/kernel/modprobe. Setting this to the empty string
25873b4fc92SChristophe Leroy	  removes the kernel's ability to request modules (but
25973b4fc92SChristophe Leroy	  userspace can still load modules explicitly).
26073b4fc92SChristophe Leroy
26173b4fc92SChristophe Leroyconfig TRIM_UNUSED_KSYMS
26273b4fc92SChristophe Leroy	bool "Trim unused exported kernel symbols" if EXPERT
26373b4fc92SChristophe Leroy	depends on !COMPILE_TEST
26473b4fc92SChristophe Leroy	help
26573b4fc92SChristophe Leroy	  The kernel and some modules make many symbols available for
26673b4fc92SChristophe Leroy	  other modules to use via EXPORT_SYMBOL() and variants. Depending
26773b4fc92SChristophe Leroy	  on the set of modules being selected in your kernel configuration,
26873b4fc92SChristophe Leroy	  many of those exported symbols might never be used.
26973b4fc92SChristophe Leroy
27073b4fc92SChristophe Leroy	  This option allows for unused exported symbols to be dropped from
27173b4fc92SChristophe Leroy	  the build. In turn, this provides the compiler more opportunities
27273b4fc92SChristophe Leroy	  (especially when using LTO) for optimizing the code and reducing
27373b4fc92SChristophe Leroy	  binary size.  This might have some security advantages as well.
27473b4fc92SChristophe Leroy
27573b4fc92SChristophe Leroy	  If unsure, or if you need to build out-of-tree modules, say N.
27673b4fc92SChristophe Leroy
27773b4fc92SChristophe Leroyconfig UNUSED_KSYMS_WHITELIST
27873b4fc92SChristophe Leroy	string "Whitelist of symbols to keep in ksymtab"
27973b4fc92SChristophe Leroy	depends on TRIM_UNUSED_KSYMS
28073b4fc92SChristophe Leroy	help
28173b4fc92SChristophe Leroy	  By default, all unused exported symbols will be un-exported from the
28273b4fc92SChristophe Leroy	  build when TRIM_UNUSED_KSYMS is selected.
28373b4fc92SChristophe Leroy
28473b4fc92SChristophe Leroy	  UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept
28573b4fc92SChristophe Leroy	  exported at all times, even in absence of in-tree users. The value to
28673b4fc92SChristophe Leroy	  set here is the path to a text file containing the list of symbols,
28773b4fc92SChristophe Leroy	  one per line. The path can be absolute, or relative to the kernel
28873b4fc92SChristophe Leroy	  source tree.
28973b4fc92SChristophe Leroy
29073b4fc92SChristophe Leroyconfig MODULES_TREE_LOOKUP
29173b4fc92SChristophe Leroy	def_bool y
29273b4fc92SChristophe Leroy	depends on PERF_EVENTS || TRACING || CFI_CLANG
29373b4fc92SChristophe Leroy
29473b4fc92SChristophe Leroyendif # MODULES
295