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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <zgifi763q2zdj2xn2535daboorumz4g64ospsukp4e6btmosir@xrbhtw777ytw>
Date: Tue, 13 May 2025 14:24:46 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>, 
	Petr Pavlu <petr.pavlu@...e.com>, Sami Tolvanen <samitolvanen@...gle.com>, 
	Daniel Gomez <da.gomez@...sung.com>, linux-modules@...r.kernel.org, 
	Peter Zijlstra <peterz@...radead.org>, Jason Baron <jbaron@...mai.com>, 
	Steven Rostedt <rostedt@...dmis.org>, Ard Biesheuvel <ardb@...nel.org>
Subject: Re: [PATCH v2] params: Add support for static keys

On Tue, May 13, 2025 at 09:07:32AM -0400, Kent Overstreet wrote:
> Static keys can now be a module parameter, e.g.
> 
> module_param_named(foo, foo.key, static_key_t, 0644)
> 
> bcachefs is now using this.
> 
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: Petr Pavlu <petr.pavlu@...e.com>
> Cc: Sami Tolvanen <samitolvanen@...gle.com>
> Cc: Daniel Gomez <da.gomez@...sung.com>
> Cc: linux-modules@...r.kernel.org
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Josh Poimboeuf <jpoimboe@...nel.org>
> Cc: Jason Baron <jbaron@...mai.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Ard Biesheuvel <ardb@...nel.org>
> Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
> ---
>  include/linux/jump_label.h  |  2 ++
>  include/linux/moduleparam.h |  7 +++++++
>  kernel/params.c             | 35 +++++++++++++++++++++++++++++++++++
>  3 files changed, 44 insertions(+)
> 
> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index fdb79dd1ebd8..0fc9b71db56f 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -107,6 +107,8 @@ struct static_key {
>  #endif	/* CONFIG_JUMP_LABEL */
>  };
>  
> +typedef struct static_key static_key_t;
> +
>  #endif /* __ASSEMBLY__ */
>  
>  #ifdef CONFIG_JUMP_LABEL
> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> index bfb85fd13e1f..11e8d5c57435 100644
> --- a/include/linux/moduleparam.h
> +++ b/include/linux/moduleparam.h
> @@ -122,6 +122,7 @@ struct kparam_array
>   *	charp: a character pointer
>   *	bool: a bool, values 0/1, y/n, Y/N.
>   *	invbool: the above, only sense-reversed (N = true).
> + *	static_key_t: same as bool, but updates a 'struct static_key'

The static_key_*() interfaces are deprecated because they're really easy
to use incorrectly.  I don't think we want to propagate that misuse to
modules.

It would be better to have type(s) based on static_key_false and/or
static_key_true, depending on whatever the default is.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ