From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D435EB64D8 for ; Fri, 16 Jun 2023 08:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244634AbjFPIL2 (ORCPT ); Fri, 16 Jun 2023 04:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234405AbjFPIL1 (ORCPT ); Fri, 16 Jun 2023 04:11:27 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C20D1295C for ; Fri, 16 Jun 2023 01:11:25 -0700 (PDT) Received: from dggpemm500006.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QjBgt2FtXzqTQc; Fri, 16 Jun 2023 16:11:22 +0800 (CST) Received: from [10.174.178.55] (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 16 Jun 2023 16:11:23 +0800 Subject: Re: [PATCH] kallsyms: let kallsyms_on_each_match_symbol match symbols exactly To: Song Liu CC: Song Liu , "live-patching@vger.kernel.org" , Josh Poimboeuf , Jiri Kosina , "mbenes@suse.cz" , "pmladek@suse.com" , "joe.lawrence@redhat.com" , Kernel Team , "mcgrof@kernel.org" References: <20230615170048.2382735-1-song@kernel.org> <4c05c5eb-7a15-484f-8227-55ad95abc295@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: <85475c44-d9c4-d5ad-350e-bb5fd713ff26@huawei.com> Date: Fri, 16 Jun 2023 16:11:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On 2023/6/16 13:01, Song Liu wrote: > > >> On Jun 15, 2023, at 7:19 PM, Leizhen (ThunderTown) 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. > > Thanks, > Song > > > . > -- Regards, Zhen Lei