Skip to content

Commit dd3a7ee

Browse files
nathanchancekees
authored andcommitted
hardening: Adjust dependencies in selection of MODVERSIONS
MODVERSIONS recently grew a dependency on !COMPILE_TEST so that Rust could be more easily tested. However, this introduces a Kconfig warning when building allmodconfig with a clang version that supports RANDSTRUCT natively because RANDSTRUCT_FULL and RANDSTRUCT_PERFORMANCE select MODVERSIONS when MODULES is enabled, bypassing the !COMPILE_TEST dependency: WARNING: unmet direct dependencies detected for MODVERSIONS Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y] Selected by [y]: - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y] Add the !COMPILE_TEST dependency to the selections to clear up the warning. Fixes: 1f9c4a9 ("Kbuild: make MODVERSIONS support depend on not being a compile test build") Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/20240928-fix-randstruct-modversions-kconfig-warning-v1-1-27d3edc8571e@kernel.org Signed-off-by: Kees Cook <[email protected]>
1 parent 886d518 commit dd3a7ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/Kconfig.hardening

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ choice
340340
config RANDSTRUCT_FULL
341341
bool "Fully randomize structure layout"
342342
depends on CC_HAS_RANDSTRUCT || GCC_PLUGINS
343-
select MODVERSIONS if MODULES
343+
select MODVERSIONS if MODULES && !COMPILE_TEST
344344
help
345345
Fully randomize the member layout of sensitive
346346
structures as much as possible, which may have both a
@@ -356,7 +356,7 @@ choice
356356
config RANDSTRUCT_PERFORMANCE
357357
bool "Limit randomization of structure layout to cache-lines"
358358
depends on GCC_PLUGINS
359-
select MODVERSIONS if MODULES
359+
select MODVERSIONS if MODULES && !COMPILE_TEST
360360
help
361361
Randomization of sensitive kernel structures will make a
362362
best effort at restricting randomization to cacheline-sized

0 commit comments

Comments
 (0)