Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] bpf: resolve_btfids build failure with CONFIG_MODULES=n and LTO/GC --
commit caaeb9d0651743944c690c066494bb16509c01e9 Author: Petr Pavlu <[email protected]> module: Add stubs.c for CONFIG_MODULES=n module_put_and_kthread_exit() This commit introduces kernel/module/stubs.c to hold stub functions when CONFIG_MODULES is disabled. It moves the stub implementation for __module_put_and_kthread_exit() to this new file and removes the corresponding #ifdef from the BPF verifier's noreturn list. > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 72a3f5998dd27..be70f10e49682 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -20417,9 +20417,7 @@ BTF_ID(func, __ia32_sys_exit_group) > BTF_ID(func, __kunit_abort) > BTF_ID(func, kunit_try_catch_throw) > #endif > -#ifdef CONFIG_MODULES > BTF_ID(func, __module_put_and_kthread_exit) [Severity: Low] If CONFIG_MODULES=n and dead-code elimination (like CONFIG_LTO_CLANG or CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) is enabled, will this cause resolve_btfids to fail? Because the #ifdef is removed, this unconditionally requires the function to be present in the BTF. If there are no callers in the kernel, the linker might discard the stub function, causing a missing BTF ID and a fatal build error under CONFIG_WERROR. > -#endif > #ifdef CONFIG_X86_64 > BTF_ID(func, __x64_sys_exit) > BTF_ID(func, __x64_sys_exit_group) [ ... ] > diff --git a/kernel/module/stubs.c b/kernel/module/stubs.c > new file mode 100644 > index 0000000000000..1385c87e81695 > --- /dev/null > +++ b/kernel/module/stubs.c > @@ -0,0 +1,9 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include <linux/kthread.h> > +#include <linux/module.h> > + > +void __noreturn __module_put_and_kthread_exit(struct module *mod, long code) > +{ [Severity: Low] Does this stub need a __used attribute to prevent the linker from discarding it? If no code references module_put_and_kthread_exit() when CONFIG_MODULES=n, this function is silently discarded by the linker during dead code elimination, which leads to the resolve_btfids build failure mentioned above. > + kthread_exit(code); > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
