Linux Modules
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aaron Tomlin" <atomlin@atomlin.com>
Cc: linux-modules@vger.kernel.org
Subject: Re: [PATCH v7 1/2] module: Extend module_blacklist parameter to built-in modules
Date: Fri, 24 Jul 2026 02:00:34 +0000	[thread overview]
Message-ID: <20260724020035.1EC9D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724014345.589326-2-atomlin@atomlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Double evaluation of `__initcall_id(fn)` within `__define_initcall_modname` causes a fatal compilation/linker error when `CONFIG_HAVE_ARCH_PREL32_RELOCATIONS` is enabled.
--

--- Patch [1]: [PATCH v7 1/2] module: Extend module_blacklist parameter to built-in modules ---
commit e69e6c4b3390b09453c5912322a9c34ef99cf6b5
Author: Aaron Tomlin <atomlin@atomlin.com>

module: Extend module_blacklist parameter to built-in modules

This commit extends the "module_blacklist=" command-line parameter to
intercept built-in modules during early boot. It introduces the
".initcall.modnames" section to map initcalls to module names, checking
this metadata before executing built-in initcalls.

> diff --git a/include/linux/init.h b/include/linux/init.h
> index 40331923b9f4a..46141c263ef25 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -252,6 +252,7 @@ extern struct module __this_module;
>  #endif
>  
>  #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
> +#define __initcall_fn_ptr(fn, id)	__initcall_stub(fn, __initcall_id(fn), id)
>  #define ____define_initcall(fn, __stub, __name, __sec)		\
>  	__define_initcall_stub(__stub, fn)			\
>  	asm(".section	\"" __sec "\", \"a\"		\n"	\
[ ... ]
> @@ -271,7 +273,24 @@ extern struct module __this_module;
>  		__initcall_name(initcall, __iid, id),		\
>  		__initcall_section(__sec, __iid))
>  
> -#define ___define_initcall(fn, id, __sec)			\
> +struct initcall_modname {
> +	initcall_t initcall_fn;
> +	const char *modname;
> +};
> +
> +#define __define_initcall_modname(fn, id)				\
> +	__define_initcall(fn, id)					\
> +	static const char __initstr_##fn[] __used __aligned(1)		\
> +		__section(".init.rodata") = KBUILD_MODNAME;		\
> +	static const struct initcall_modname __modname_##fn __used	\
> +		__section(".initcall.modnames") = {			\
> +			.initcall_fn = __initcall_fn_ptr(fn, id),	\
> +			.modname = __initstr_##fn			\
> +		};

[Severity: Low]
Does this double evaluation of __initcall_id(fn) break the build when
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS is enabled?

__define_initcall(fn, id) evaluates __initcall_id(fn) as part of its expansion.
__initcall_fn_ptr(fn, id) also evaluates __initcall_id(fn).

Since __initcall_id() relies on the __COUNTER__ preprocessor directive,
these two evaluations will consume different counter values. Could this
generate mismatched stub references, causing undefined reference errors
during the build for built-in modules?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724014345.589326-1-atomlin@atomlin.com?part=1

  reply	other threads:[~2026-07-24  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  1:43 [PATCH v7 0/2] module: Extend blacklist parameter to support built-in modules Aaron Tomlin
2026-07-24  1:43 ` [PATCH v7 1/2] module: Extend module_blacklist parameter to " Aaron Tomlin
2026-07-24  2:00   ` sashiko-bot [this message]
2026-07-24  2:35   ` Aaron Tomlin
2026-07-24  1:43 ` [PATCH v7 2/2] module: Rename module_blacklist to module_denylist Aaron Tomlin

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=20260724020035.1EC9D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=atomlin@atomlin.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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