lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c94bd56f8be79670542af53eaaf4bd749505b78b.camel@perches.com>
Date:   Fri, 28 Jan 2022 23:27:29 -0800
From:   Joe Perches <joe@...ches.com>
To:     Aaron Tomlin <atomlin@...hat.com>, mcgrof@...nel.org
Cc:     cl@...ux.com, pmladek@...e.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
Subject: Re: [RFC PATCH v3 03/13] module: Move livepatch support to a
 separate file

On Fri, 2022-01-28 at 20:39 +0000, 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
[]
> @@ -668,11 +668,22 @@ static inline bool is_livepatch_module(struct module *mod)
>  {
>  	return mod->klp;
>  }
> +
> +static inline bool set_livepatch_module(struct module *mod)
> +{
> +	mod->klp = true;
> +	return true;
> +}
>  #else /* !CONFIG_LIVEPATCH */
>  static inline bool is_livepatch_module(struct module *mod)
>  {
>  	return false;
>  }
> +
> +static inline bool set_livepatch_module(struct module *mod)
> +{
> +	return false;
> +}
>  #endif /* CONFIG_LIVEPATCH */

style trivia:

Generally, these static inlines can be written deduplicating
the function declaration and using IS_ENABLED or #if inside
the definition.

Something like:

static inline bool is_livepatch_module(struct module *mod)
{
	if (IS_ENABLED(CONFIG_LIVEPATCH)) {
		mod->klp = true;
		return true;
	}
	return false;
}

or

static inline bool is_livepatch_module(struct module *mod)
{
#ifdef CONFIG_LIVEPATCH
	mod->klp = true;
	return true;
#else
	return false;
#endif
}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ