Re: [PATCH 5.4 57/60] modpost: fix section mismatch check for exported init/exit sections

Nick Desaulniers
2022-06-28T19:15:30Z

On Mon, Jun 27, 2022 at 10:03 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 6/27/22 04:22, Greg Kroah-Hartman wrote:
> > From: Masahiro Yamada <masahiroy@kernel.org>
> >
> > commit 28438794aba47a27e922857d27b31b74e8559143 upstream.
> >
> > Since commit f02e8a6596b7 ("module: Sort exported symbols"),
> > EXPORT_SYMBOL* is placed in the individual section ___ksymtab(_gpl)+<sym>
> > (3 leading underscores instead of 2).
> >
> > Since then, modpost cannot detect the bad combination of EXPORT_SYMBOL
> > and __init/__exit.
> >
> > Fix the .fromsec field.
> >
> > Fixes: f02e8a6596b7 ("module: Sort exported symbols")
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> This commit causes the following warning to show up on my kernel builds
> used for testing 5.4 stable candidates:
>
> WARNING: vmlinux.o(___ksymtab+drm_fb_helper_modinit+0x0): Section
> mismatch in reference from the variable __ksymtab_drm_fb_helper_modinit
> to the function .init.text:drm_fb_helper_modinit()
> The symbol drm_fb_helper_modinit is exported and annotated __init
> Fix this by removing the __init annotation of drm_fb_helper_modinit or
> drop the export.

Thanks for the report. Looks like the patch is "working as intended."

It looks like drm_fb_helper_modinit was deleted outright in
commit bf22c9ec39da ("drm: remove drm_fb_helper_modinit")
in v5.12-rc1.

Florian, can you test if that cherry-picks cleanly and resolves the
issue for you?

Maybe let's check with Christoph if it's ok to backport bf22c9ec39da
to stable 5.10 and 5.4?

>
> The kernel configuration to reproduce this is located here (this is 5.10
> but works in 5.4 as well):
>
> https://gist.github.com/2c3e8edd5ceb089c8040db724073d941
>
> Same applies to the 5.10, 5.15 and 5.18 stable queues FWIW.
> --
> Florian

--
Thanks,
~Nick Desaulniers