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 <[email protected]>

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/[email protected]?part=1

Reply via email to