[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZQtf4TqRxaps8Opx@bombadil.infradead.org>
Date: Wed, 20 Sep 2023 14:10:57 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Johan Hovold <johan@...nel.org>, Jessica Yu <jeyu@...nel.org>,
Sagi Grimberg <sagi@...mberg.me>,
Nick Desaulniers <ndesaulniers@...ogle.com>,
Miguel Ojeda <ojeda@...nel.org>, Joe Perches <joe@...ches.com>,
linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] module: Clarify documentation of module_param_call()
On Wed, Sep 13, 2023 at 04:54:14PM -0700, Kees Cook wrote:
> Commit 9bbb9e5a3310 ("param: use ops in struct kernel_param, rather than
> get and set fns directly") added the comment that module_param_call()
> was deprecated, during a large scale refactoring to bring sanity to type
> casting back then. In 2017 following more cleanups, it became useful
> again as it wraps a common pattern of creating an ops struct for a
> given get/set pair:
>
> b2f270e87473 ("module: Prepare to convert all module_param_call() prototypes")
> ece1996a21ee ("module: Do not paper over type mismatches in module_param_call()")
>
> static const struct kernel_param_ops __param_ops_##name = \
> { .flags = 0, .set = _set, .get = _get }; \
> __module_param_call(MODULE_PARAM_PREFIX, \
> name, &__param_ops_##name, arg, perm, -1, 0)
>
> __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
>
> Many users of module_param_cb() appear to be almost universally
> open-coding the same thing that module_param_call() does now. Don't
> discourage[1] people from using module_param_call(): clarify the comment
> to show that module_param_cb() is useful if you repeatedly use the same
> pair of get/set functions.
>
> [1] https://lore.kernel.org/lkml/202308301546.5C789E5EC@keescook/
>
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: Johan Hovold <johan@...nel.org>
> Cc: Jessica Yu <jeyu@...nel.org>
> Cc: Sagi Grimberg <sagi@...mberg.me>
> Cc: Nick Desaulniers <ndesaulniers@...ogle.com>
> Cc: Miguel Ojeda <ojeda@...nel.org>
> Cc: Joe Perches <joe@...ches.com>
> Cc: linux-modules@...r.kernel.org
> Reviewed-by: Miguel Ojeda <ojeda@...nel.org>
> Signed-off-by: Kees Cook <keescook@...omium.org>
Applied and pushed to modules-next, thanks
> ---
> Luis, I note that include/linux/moduleparam.h isn't in the MAINTAINERS
> file pattern. Perhaps you want to use include/linux/module*.h?
Sent patch! Thanks!
Luis
Powered by blists - more mailing lists