Skip to content

Commit 8d597ba

Browse files
petrpavlusamitolvanen
authored andcommitted
module: Fix the modversions and signing submenus
The module Kconfig file contains a set of options related to "Module versioning support" (depends on MODVERSIONS) and "Module signature verification" (depends on MODULE_SIG). The Kconfig tool automatically creates submenus when an entry for a symbol is followed by consecutive items that all depend on the symbol. However, this functionality doesn't work for the mentioned module options. The MODVERSIONS options are interleaved with ASM_MODVERSIONS, which has no 'depends on MODVERSIONS' but instead uses 'default HAVE_ASM_MODVERSIONS && MODVERSIONS'. Similarly, the MODULE_SIG options are interleaved by a comment warning not to forget signing modules with scripts/sign-file, which uses the condition 'depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL'. The result is that the options are confusingly shown when using a menuconfig tool, as follows: [*] Module versioning support Module versioning implementation (genksyms (from source code)) ---> [ ] Extended Module Versioning Support [*] Basic Module Versioning Support [*] Source checksum for all modules [*] Module signature verification [ ] Require modules to be validly signed [ ] Automatically sign all modules Hash algorithm to sign modules (SHA-256) ---> Fix the issue by using if/endif to group related options together in kernel/module/Kconfig, similarly to how the MODULE_DEBUG options are already grouped. Note that the signing-related options depend on 'MODULE_SIG || IMA_APPRAISE_MODSIG', with the exception of MODULE_SIG_FORCE, which is valid only for MODULE_SIG and is therefore kept separately. For consistency, do the same for the MODULE_COMPRESS entries. The options are then properly placed into submenus, as follows: [*] Module versioning support Module versioning implementation (genksyms (from source code)) ---> [ ] Extended Module Versioning Support [*] Basic Module Versioning Support [*] Source checksum for all modules [*] Module signature verification [ ] Require modules to be validly signed [ ] Automatically sign all modules Hash algorithm to sign modules (SHA-256) ---> Signed-off-by: Petr Pavlu <[email protected]> Reviewed-by: Daniel Gomez <[email protected]> Signed-off-by: Sami Tolvanen <[email protected]>
1 parent a7b4bc0 commit 8d597ba

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

kernel/module/Kconfig

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ config MODVERSIONS
169169
make them incompatible with the kernel you are running. If
170170
unsure, say N.
171171

172+
if MODVERSIONS
173+
172174
choice
173175
prompt "Module versioning implementation"
174-
depends on MODVERSIONS
175176
help
176177
Select the tool used to calculate symbol versions for modules.
177178

@@ -206,15 +207,14 @@ endchoice
206207

207208
config ASM_MODVERSIONS
208209
bool
209-
default HAVE_ASM_MODVERSIONS && MODVERSIONS
210+
default HAVE_ASM_MODVERSIONS
210211
help
211212
This enables module versioning for exported symbols also from
212213
assembly. This can be enabled only when the target architecture
213214
supports it.
214215

215216
config EXTENDED_MODVERSIONS
216217
bool "Extended Module Versioning Support"
217-
depends on MODVERSIONS
218218
help
219219
This enables extended MODVERSIONs support, allowing long symbol
220220
names to be versioned.
@@ -224,7 +224,6 @@ config EXTENDED_MODVERSIONS
224224

225225
config BASIC_MODVERSIONS
226226
bool "Basic Module Versioning Support"
227-
depends on MODVERSIONS
228227
default y
229228
help
230229
This enables basic MODVERSIONS support, allowing older tools or
@@ -237,6 +236,8 @@ config BASIC_MODVERSIONS
237236
This is enabled by default when MODVERSIONS are enabled.
238237
If unsure, say Y.
239238

239+
endif # MODVERSIONS
240+
240241
config MODULE_SRCVERSION_ALL
241242
bool "Source checksum for all modules"
242243
help
@@ -277,10 +278,11 @@ config MODULE_SIG_FORCE
277278
Reject unsigned modules or signed modules for which we don't have a
278279
key. Without this, such modules will simply taint the kernel.
279280

281+
if MODULE_SIG || IMA_APPRAISE_MODSIG
282+
280283
config MODULE_SIG_ALL
281284
bool "Automatically sign all modules"
282285
default y
283-
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
284286
help
285287
Sign all modules during make modules_install. Without this option,
286288
modules must be signed manually, using the scripts/sign-file tool.
@@ -290,7 +292,6 @@ comment "Do not forget to sign required modules with scripts/sign-file"
290292

291293
choice
292294
prompt "Hash algorithm to sign modules"
293-
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
294295
default MODULE_SIG_SHA512
295296
help
296297
This determines which sort of hashing algorithm will be used during
@@ -327,14 +328,15 @@ endchoice
327328

328329
config MODULE_SIG_HASH
329330
string
330-
depends on MODULE_SIG || IMA_APPRAISE_MODSIG
331331
default "sha256" if MODULE_SIG_SHA256
332332
default "sha384" if MODULE_SIG_SHA384
333333
default "sha512" if MODULE_SIG_SHA512
334334
default "sha3-256" if MODULE_SIG_SHA3_256
335335
default "sha3-384" if MODULE_SIG_SHA3_384
336336
default "sha3-512" if MODULE_SIG_SHA3_512
337337

338+
endif # MODULE_SIG || IMA_APPRAISE_MODSIG
339+
338340
config MODULE_COMPRESS
339341
bool "Module compression"
340342
help
@@ -350,9 +352,10 @@ config MODULE_COMPRESS
350352

351353
If unsure, say N.
352354

355+
if MODULE_COMPRESS
356+
353357
choice
354358
prompt "Module compression type"
355-
depends on MODULE_COMPRESS
356359
help
357360
Choose the supported algorithm for module compression.
358361

@@ -379,7 +382,6 @@ endchoice
379382
config MODULE_COMPRESS_ALL
380383
bool "Automatically compress all modules"
381384
default y
382-
depends on MODULE_COMPRESS
383385
help
384386
Compress all modules during 'make modules_install'.
385387

@@ -389,7 +391,6 @@ config MODULE_COMPRESS_ALL
389391

390392
config MODULE_DECOMPRESS
391393
bool "Support in-kernel module decompression"
392-
depends on MODULE_COMPRESS
393394
select ZLIB_INFLATE if MODULE_COMPRESS_GZIP
394395
select XZ_DEC if MODULE_COMPRESS_XZ
395396
select ZSTD_DECOMPRESS if MODULE_COMPRESS_ZSTD
@@ -400,6 +401,8 @@ config MODULE_DECOMPRESS
400401

401402
If unsure, say N.
402403

404+
endif # MODULE_COMPRESS
405+
403406
config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
404407
bool "Allow loading of modules with missing namespace imports"
405408
help

0 commit comments

Comments
 (0)