Re: [RFC PATCH v4 07/13] module: Move extra signature support out of core code

From: Miroslav Benes
Date: Wed Feb 09 2022 - 09:28:58 EST


> diff --git a/include/linux/module.h b/include/linux/module.h
> index 520c0f4bb968..15ba2ebbca3e 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -720,8 +720,8 @@ static inline bool set_livepatch_module(struct module *mod)
> return false;
> }
>
> -bool is_module_sig_enforced(void);
> -void set_module_sig_enforced(void);
> +extern bool is_module_sig_enforced(void);
> +extern void set_module_sig_enforced(void);

Please, drop these extern modifiers in front of function declarations.
They are unnecessary. It applies to different patches of the set as well.

> #else /* !CONFIG_MODULES... */
>
> @@ -911,6 +911,7 @@ static inline bool module_sig_ok(struct module *module)
> {
> return true;
> }
> +#define sig_enforce false
> #endif /* CONFIG_MODULE_SIG */
>
> int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
> diff --git a/kernel/module/internal.h b/kernel/module/internal.h
> index de28d6bb7b5b..2ec2a1d9dd9f 100644
> --- a/kernel/module/internal.h
> +++ b/kernel/module/internal.h
> @@ -114,3 +114,12 @@ static struct module *mod_find(unsigned long addr)
> return NULL;
> }
> #endif /* CONFIG_MODULES_TREE_LOOKUP */
> +
> +#ifdef CONFIG_MODULE_SIG
> +extern int module_sig_check(struct load_info *info, int flags);
> +#else /* !CONFIG_MODULE_SIG */
> +static int module_sig_check(struct load_info *info, int flags)
> +{
> + return 0;
> +}

I think it should be

static inline int module_sig_check(struct load_info *info, int flags)

Thanks,
Miroslav