All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Petr Pavlu" <petr.pavlu@suse.com>
Cc: bpf@vger.kernel.org, linux-modules@vger.kernel.org,
	"Petr Pavlu" <petr.pavlu@suse.com>
Subject: Re: [PATCH v2] module: Add stubs.c for CONFIG_MODULES=n module_put_and_kthread_exit()
Date: Fri, 02 Oct 2026 09:14:51 +0000	[thread overview]
Message-ID: <20261002091451.D4FBC1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261002-module-stubs-v2-1-a0d8c6ad1738@suse.com>

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 <petr.pavlu@suse.com>

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/20261002-module-stubs-v2-1-a0d8c6ad1738@suse.com?part=1

  reply	other threads:[~2026-10-02  9:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  8:40 [PATCH v2] module: Add stubs.c for CONFIG_MODULES=n module_put_and_kthread_exit() Petr Pavlu
2026-10-02  9:14 ` sashiko-bot [this message]
2026-10-02 11:58   ` Petr Pavlu
2026-10-04 12:49 ` 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=20261002091451.D4FBC1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=petr.pavlu@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.