Re: [PATCH v2 3/3] tracing/kprobes: Use APIs that matches symbols without .XXX suffix

From: Song Liu
Date: Thu Aug 08 2024 - 11:18:24 EST




> On Aug 8, 2024, at 2:48 AM, Petr Mladek <pmladek@xxxxxxxx> wrote:
>
> On Wed 2024-08-07 19:46:31, Song Liu wrote:
>>
>>
>>> On Aug 7, 2024, at 7:58 AM, zhang warden <zhangwarden@xxxxxxxxx> wrote:
>>>
>>>
>>>> In my GCC built, we have suffixes like ".constprop.0", ".part.0", ".isra.0",
>>>> and ".isra.0.cold".
>>>
>>> A fresher's eye, I met sometime when try to build a livepatch module and found some mistake caused by ".constprop.0" ".part.0" which is generated by GCC.
>>>
>>> These section with such suffixes is special and sometime the symbol st_value is quite different. What is these kind of section (or symbol) use for?
>>
>>
>> IIUC, constprop means const propagation. For example, function
>> "foo(int a, int b)" that is called as "foo(a, 10)" will be come
>> "foo(int a)" with a hard-coded b = 10 inside.
>>
>> .part.0 is part of the function, as the other part is inlined in
>> the caller.
>
> Hmm, we should not remove the suffixes like .constprop*, .part*,
> .isra*. They implement a special optimized variant of the function.
> It is not longer the original full-featured one.
>
> This is a difference against adding a suffix for a static function.
> Such a symbol implements the original full-featured function.

Allow tracing without .llvm.<hash> suffixes may target a different
function with same name, i.e. func_a.llvm.1 vs. func_a.llvm.2. We
can probably detect and report this in the kernel. However, I would
rather we just disallow tracing without suffixes. I think Masami
also agrees with this.

Thanks,
Song