Re: [RFC PATCH v4 03/13] module: Move livepatch support to a separate file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux