Live Patching
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
Cc: Song Liu <songliubraving@meta.com>, Song Liu <song@kernel.org>,
	"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>, "mbenes@suse.cz" <mbenes@suse.cz>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"joe.lawrence@redhat.com" <joe.lawrence@redhat.com>,
	Kernel Team <kernel-team@meta.com>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>
Subject: Re: [PATCH] kallsyms: let kallsyms_on_each_match_symbol match symbols exactly
Date: Fri, 16 Jun 2023 17:40:39 +0000	[thread overview]
Message-ID: <A013DCEA-E35C-406B-8EBE-E7AE431B124D@fb.com> (raw)
In-Reply-To: <6eb17ba3-0a20-b6da-2466-016c559d79f3@huawei.com>



> On Jun 16, 2023, at 1:52 AM, Leizhen (ThunderTown) <thunder.leizhen@huawei.com> wrote:
> 
> 
> 
> On 2023/6/16 16:43, Leizhen (ThunderTown) wrote:
>> 
>> 
>> On 2023/6/16 16:11, Leizhen (ThunderTown) wrote:
>>> 
>>> 
>>> On 2023/6/16 13:01, Song Liu wrote:
>>>> 
>>>> 
>>>>> On Jun 15, 2023, at 7:19 PM, Leizhen (ThunderTown) <thunder.leizhen@huawei.com> wrote:
>>>>> 
>>>>> On 2023/6/16 1:00, Song Liu wrote:
>>>>>> With CONFIG_LTO_CLANG, kallsyms.c:cleanup_symbol_name() removes symbols
>>>>>> suffixes during comparison. This is problematic for livepatch, as
>>>>>> kallsyms_on_each_match_symbol may find multiple matches for the same
>>>>>> symbol, and fail with:
>>>>>> 
>>>>>> livepatch: unresolvable ambiguity for symbol 'xxx' in object 'yyy'
>>>>> 
>>>>> Did you forget to specify 'old_sympos'? When there are multiple symbols with
>>>>> the same name, we need to specify the sequence number of the symbols to be
>>>>> matched.
>>>> 
>>>> 
>>>> old_sympos is indeed 0 here. However, the issue with CONFIG_LTO_CLANG 
>>>> is different. Here is an example:
>>>> 
>>>> $ grep bpf_verifier_vlog /proc/kallsyms
>>>> ffffffff81549f60 t bpf_verifier_vlog
>>>> ffffffff8268b430 d bpf_verifier_vlog._entry
>>>> ffffffff8282a958 d bpf_verifier_vlog._entry_ptr
>>>> ffffffff82e12a1f d bpf_verifier_vlog.__already_done
>>>> 
>>>> kallsyms_on_each_match_symbol matches "bpf_verifier_vlog" to all of 
>>>> these because of cleanup_symbol_name(). IOW, we only have one 
>>>> function called bpf_verifier_vlog, but kallsyms_on_each_match_symbol() 
>>>> matches it to bpf_verifier_vlog.*. 
>>>> 
>>>> Does this make sense?
>>> 
>>> Sorry. I mistakenly thought you were operating a static function.
>>> 
>>> These suffixes are not mentioned in the comments in the function
>>> cleanup_symbol_name(). So I didn't notice it.
>> We can keep these three suffixes on the kallsyms tool end.
> 
> And modify cleanup_symbol_name() not to cleanup these three suffixes.

I think livepatch should match symbols exactly anyway, so it is not 
necessary to expose more details in cleanup_symbol_name()?

Thanks,
Song


  reply	other threads:[~2023-06-16 17:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 17:00 [PATCH] kallsyms: let kallsyms_on_each_match_symbol match symbols exactly Song Liu
2023-06-16  2:19 ` Leizhen (ThunderTown)
2023-06-16  5:01   ` Song Liu
2023-06-16  8:11     ` Leizhen (ThunderTown)
2023-06-16  8:43       ` Leizhen (ThunderTown)
2023-06-16  8:52         ` Leizhen (ThunderTown)
2023-06-16 17:40           ` Song Liu [this message]
2023-06-16  9:31 ` Leizhen (ThunderTown)
2023-06-16 17:37   ` Song Liu
2023-06-19  3:32     ` Leizhen (ThunderTown)
2023-06-19  5:05       ` Song Liu
2023-06-19 11:32         ` Petr Mladek
2023-06-20 22:36           ` Song Liu
2023-06-21  8:52             ` Petr Mladek
2023-06-21 19:18               ` Song Liu
2023-06-21 22:34                 ` Yonghong Song
2023-06-22 13:35                   ` Petr Mladek
2023-06-22 16:10                     ` Yonghong Song
     [not found]                       ` <4616610E-180A-4417-8592-B864F6298C7F@fb.com>
2023-06-22 20:45                         ` Yonghong Song
2023-06-23 17:43                       ` Nick Desaulniers
2023-06-25 19:06                         ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A013DCEA-E35C-406B-8EBE-E7AE431B124D@fb.com \
    --to=songliubraving@meta.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mcgrof@kernel.org \
    --cc=pmladek@suse.com \
    --cc=song@kernel.org \
    --cc=thunder.leizhen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox