> diff --git a/include/linux/module.h b/include/linux/module.h
> index 96cc98568eea5..4c7bd7f9f8898 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h

[ ... ]

> diff --git a/kernel/Makefile b/kernel/Makefile
> index 1e1a31673577d..08a94594975d2 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile

[ ... ]

> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index d62c0f74cff5e..193610e20a4a8 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c

[ ... ]

> diff --git a/kernel/module/Makefile b/kernel/module/Makefile
> index 50ffcc413b545..72fd2972eacfd 100644
> --- a/kernel/module/Makefile
> +++ b/kernel/module/Makefile

[ ... ]

> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index d0e1e0bd2ad06..a8bf803afa813 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c

[ ... ]

> diff --git a/kernel/module/stubs.c b/kernel/module/stubs.c
> new file mode 100644
> index 0000000000000..81e66c02260c8
> --- /dev/null
> +++ b/kernel/module/stubs.c
> @@ -0,0 +1,11 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +
> +#include <linux/kthread.h>
> +#include <linux/module.h>
> +#include "internal.h"

This isn't a bug, but does stubs.c need "internal.h" here, or would
<linux/kthread.h> plus <linux/module.h> be enough?

kthread_exit() comes from <linux/kthread.h>, and struct module,
__noreturn, and EXPORT_SYMBOL come from <linux/module.h>. The file
doesn't appear to use anything that internal.h provides.

This makes stubs.c the only consumer of that header outside
CONFIG_MODULES=y, which future internal.h changes would have to keep
working.

> +
> +void __noreturn __module_put_and_kthread_exit(struct module *mod, long code)
> +{
> +     kthread_exit(code);
> +}
> +EXPORT_SYMBOL(__module_put_and_kthread_exit);

This isn't a bug, but since stubs.o only exists for CONFIG_MODULES=n, is
the EXPORT_SYMBOL() reachable by any module, or can it be dropped?

No loadable module can resolve this export when CONFIG_MODULES=n. The
macro still expands (producing an .export_symbol entry that
COMMON_DISCARDS drops at link, plus __ADDRESSABLE()), so it's harmless
but has no consumer.

kernel/time/posix-stubs.c, cited in the commit message as the model,
exports nothing.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35733170542

Reply via email to