On 10/2/26 11:14 AM, [email protected] wrote:
> 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.

This is a valid issue. I think a simple solution would be to mark
__module_put_and_kthread_exit() as __retain.

-- Petr

Reply via email to