Skip to content

Commit 1ae719a

Browse files
coibysamitolvanen
authored andcommitted
module: Only declare set_module_sig_enforced when CONFIG_MODULE_SIG=y
Currently if set_module_sig_enforced is called with CONFIG_MODULE_SIG=n e.g. [1], it can lead to a linking error, ld: security/integrity/ima/ima_appraise.o: in function `ima_appraise_measurement': security/integrity/ima/ima_appraise.c:587:(.text+0xbbb): undefined reference to `set_module_sig_enforced' This happens because the actual implementation of set_module_sig_enforced comes from CONFIG_MODULE_SIG but both the function declaration and the empty stub definition are tied to CONFIG_MODULES. So bind set_module_sig_enforced to CONFIG_MODULE_SIG instead. This allows (future) users to call set_module_sig_enforced directly without the "if IS_ENABLED(CONFIG_MODULE_SIG)" safeguard. Note this issue hasn't caused a real problem because all current callers of set_module_sig_enforced e.g. security/integrity/ima/ima_efi.c use "if IS_ENABLED(CONFIG_MODULE_SIG)" safeguard. [1] https://lore.kernel.org/lkml/20250928030358.3873311-1-coxu@redhat.com/ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202510030029.VRKgik99-lkp@intel.com/ Reviewed-by: Aaron Tomlin <atomlin@atomlin.com> Reviewed-by: Daniel Gomez <da.gomez@samsung.com> Signed-off-by: Coiby Xu <coxu@redhat.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
1 parent 68e8555 commit 1ae719a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

include/linux/module.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,6 @@ static inline bool is_livepatch_module(struct module *mod)
764764
#endif
765765
}
766766

767-
void set_module_sig_enforced(void);
768-
769767
void module_for_each_mod(int(*func)(struct module *mod, void *data), void *data);
770768

771769
#else /* !CONFIG_MODULES... */
@@ -860,10 +858,6 @@ static inline bool module_requested_async_probing(struct module *module)
860858
}
861859

862860

863-
static inline void set_module_sig_enforced(void)
864-
{
865-
}
866-
867861
/* Dereference module function descriptor */
868862
static inline
869863
void *dereference_module_function_descriptor(struct module *mod, void *ptr)
@@ -919,6 +913,8 @@ static inline bool retpoline_module_ok(bool has_retpoline)
919913
#ifdef CONFIG_MODULE_SIG
920914
bool is_module_sig_enforced(void);
921915

916+
void set_module_sig_enforced(void);
917+
922918
static inline bool module_sig_ok(struct module *module)
923919
{
924920
return module->sig_ok;
@@ -929,6 +925,10 @@ static inline bool is_module_sig_enforced(void)
929925
return false;
930926
}
931927

928+
static inline void set_module_sig_enforced(void)
929+
{
930+
}
931+
932932
static inline bool module_sig_ok(struct module *module)
933933
{
934934
return true;

0 commit comments

Comments
 (0)