Re: [PATCH 6.12.y] bpf: Fix BPF_INTERNAL namespace import

From: Greg KH
Date: Mon May 05 2025 - 04:55:25 EST


On Sat, May 03, 2025 at 04:50:31PM +0800, Xi Ruoyao wrote:
> The commit cdd30ebb1b9f ("module: Convert symbol namespace to string
> literal") makes the grammar of MODULE_IMPORT_NS and EXPORT_SYMBOL_NS
> different between the stable branches and the mainline. But when
> the commit 955f9ede52b8 ("bpf: Add namespace to BPF internal symbols")
> was backported from mainline, only EXPORT_SYMBOL_NS instances are
> adapted, leaving the MODULE_IMPORT_NS instance with the "new" grammar
> and causing the module fails to build:
>
> ERROR: modpost: module bpf_preload uses symbol bpf_link_get_from_fd from namespace BPF_INTERNAL, but does not import it.
> ERROR: modpost: module bpf_preload uses symbol kern_sys_bpf from namespace BPF_INTERNAL, but does not import it.
>
> Reported-by: Mingcong Bai <jeffbai@xxxxxxx>
> Reported-by: Alex Davis <alex47794@xxxxxxxxx>
> Closes: https://lore.kernel.org/all/CADiockBKBQTVqjA5G+RJ9LBwnEnZ8o0odYnL=LBZ_7QN=_SZ7A@xxxxxxxxxxxxxx/
> Fixes: 955f9ede52b8 ("bpf: Add namespace to BPF internal symbols")
> Signed-off-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
> ---
> kernel/bpf/preload/bpf_preload_kern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/preload/bpf_preload_kern.c b/kernel/bpf/preload/bpf_preload_kern.c
> index 56a81df7a9d7..fdad0eb308fe 100644
> --- a/kernel/bpf/preload/bpf_preload_kern.c
> +++ b/kernel/bpf/preload/bpf_preload_kern.c
> @@ -89,5 +89,5 @@ static void __exit fini(void)
> }
> late_initcall(load);
> module_exit(fini);
> -MODULE_IMPORT_NS("BPF_INTERNAL");
> +MODULE_IMPORT_NS(BPF_INTERNAL);
> MODULE_LICENSE("GPL");

Ick, sorry about that, I thought I had fixed this all up. Odd it never
showed up in anyone's build testing, I wonder why.

I'll go do a quick release with just this fix in it now to get this
resolved, thanks!

greg k-h