Re: Symbol too long for allsyms warnings on KSYM_NAME_LEN

From: Peter Zijlstra
Date: Thu Mar 27 2025 - 10:00:53 EST


On Thu, Mar 27, 2025 at 09:38:46AM +0100, Arnd Bergmann wrote:
> My randconfig builds sometimes (around one in every 700 configs) run
> into this warning on x86:
>
> Symbol __pfx_snnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7n too long for kallsyms (517 >= 512).
> Please increase KSYM_NAME_LEN both in kernel and kallsyms.c
>
> The check that gets triggered was added in commit c104c16073b
> ("Kunit to check the longest symbol length"), see
> https://lore.kernel.org/all/20241117195923.222145-1-sergio.collado@xxxxxxxxx/
>
> and the overlong identifier seems to be the result of objtool adding
> the six-byte "__pfx_" string to a symbol in elf_create_prefix_symbol()
> when CONFIG_FUNCTION_PADDING_CFI is set.
>
> I think the suggestion to "Please increase KSYM_NAME_LEN both in
> kernel and kallsyms.c" is misleading here and should probably be
> changed. I don't know if this something that objtool should work
> around, or something that needs to be adapted in the test.

Probably test needs to be fixed; objtool can't really do anything here,
it just take the existing symname and prefixes it.