From: Luis Chamberlain <mcgrof@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Johan Hovold <johan@kernel.org>, Jessica Yu <jeyu@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
Nick Desaulniers <ndesaulniers@gooogle.com>,
Miguel Ojeda <ojeda@kernel.org>, Joe Perches <joe@perches.com>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2] module: Clarify documentation of module_param_call()
Date: Wed, 20 Sep 2023 14:10:57 -0700 [thread overview]
Message-ID: <ZQtf4TqRxaps8Opx@bombadil.infradead.org> (raw)
In-Reply-To: <20230913235407.gonna.817-kees@kernel.org>
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@kernel.org>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Jessica Yu <jeyu@kernel.org>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Nick Desaulniers <ndesaulniers@gooogle.com>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: Joe Perches <joe@perches.com>
> Cc: linux-modules@vger.kernel.org
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
> Signed-off-by: Kees Cook <keescook@chromium.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
prev parent reply other threads:[~2023-09-20 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 23:54 [PATCH v2] module: Clarify documentation of module_param_call() Kees Cook
2023-09-20 21:10 ` Luis Chamberlain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZQtf4TqRxaps8Opx@bombadil.infradead.org \
--to=mcgrof@kernel.org \
--cc=jeyu@kernel.org \
--cc=joe@perches.com \
--cc=johan@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=ndesaulniers@gooogle.com \
--cc=ojeda@kernel.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).