[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgJXEhiwn5B4Psxa@alley>
Date: Tue, 8 Feb 2022 12:42:10 +0100
From: Petr Mladek <pmladek@...e.com>
To: Aaron Tomlin <atomlin@...hat.com>
Cc: mcgrof@...nel.org, cl@...ux.com, mbenes@...e.cz,
akpm@...ux-foundation.org, jeyu@...nel.org,
linux-kernel@...r.kernel.org, linux-modules@...r.kernel.org,
live-patching@...r.kernel.org, atomlin@...mlin.com,
ghalat@...hat.com, allen.lkml@...il.com, void@...ifault.com,
joe@...ches.com
Subject: Re: [RFC PATCH v4 03/13] module: Move livepatch support to a
separate file
On Sun 2022-01-30 21:32:04, Aaron Tomlin wrote:
> No functional change.
>
> This patch migrates livepatch support (i.e. used during module
> add/or load and remove/or deletion) from core module code into
> kernel/module/livepatch.c. At the moment it contains code to
> persist Elf information about a given livepatch module, only.
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index f4338235ed2c..c7daac4d16ee 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -663,17 +663,23 @@ static inline bool module_requested_async_probing(struct module *module)
> return module && module->async_probe_requested;
> }
>
> -#ifdef CONFIG_LIVEPATCH
> static inline bool is_livepatch_module(struct module *mod)
> {
> - return mod->klp;
> + if (IS_ENABLED(CONFIG_LIVEPATCH)) {
> + if (mod->klp)
> + return true;
> + }
> + return false;
The following is easier to follow for me. But it is a matter of taste.
Feel free to use whatever you prefer.
return IS_ENABLED(CONFIG_LIVEPATCH) && mod->klp;
> }
> -#else /* !CONFIG_LIVEPATCH */
> -static inline bool is_livepatch_module(struct module *mod)
> +
> +static inline bool set_livepatch_module(struct module *mod)
> {
> + if (IS_ENABLED(CONFIG_LIVEPATCH)) {
> + mod->klp = true;
> + return true;
> + }
> return false;
This should go to internal.h.
Alternative is to move both is_livepatch_module() and
set_livepatch_module() into include/linux/livepatch.h.
I do not have strong opinion.
> }
> -#endif /* CONFIG_LIVEPATCH */
>
> bool is_module_sig_enforced(void);
> void set_module_sig_enforced(void);
Otherwise, it looks good to me.
Best Regards,
Petr
Powered by blists - more mailing lists