public inbox for live-patching@vger.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Song Liu <song@kernel.org>
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	 jpoimboe@kernel.org, jikos@kernel.org, pmladek@suse.com,
	 joe.lawrence@redhat.com, nathan@kernel.org, morbo@google.com,
	 justinstitt@google.com, mcgrof@kernel.org,
	thunder.leizhen@huawei.com,  kees@kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG
Date: Fri, 7 Jun 2024 15:06:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.21.2406071458531.29080@pobox.suse.cz> (raw)
In-Reply-To: <20240605032120.3179157-1-song@kernel.org>

Hi,

On Tue, 4 Jun 2024, Song Liu wrote:

> With CONFIG_LTO_CLANG, the compiler may postfix symbols with .llvm.<hash>
> to avoid symbol duplication. scripts/kallsyms.c sorted the symbols
> without these postfixes. The default symbol lookup also removes these
> postfixes before comparing symbols.
> 
> On the other hand, livepatch need to look up symbols with the full names.
> However, calling kallsyms_on_each_match_symbol with full name (with the
> postfix) cannot find the symbol(s). As a result, we cannot livepatch
> kernel functions with .llvm.<hash> postfix or kernel functions that use
> relocation information to symbols with .llvm.<hash> postfixes.
> 
> Fix this by calling kallsyms_on_each_match_symbol without the postfix;
> and then match the full name (with postfix) in klp_match_callback.
> 
> Signed-off-by: Song Liu <song@kernel.org>
> ---
>  include/linux/kallsyms.h | 13 +++++++++++++
>  kernel/kallsyms.c        | 21 ++++++++++++++++-----
>  kernel/livepatch/core.c  | 32 +++++++++++++++++++++++++++++++-
>  3 files changed, 60 insertions(+), 6 deletions(-)

I do not like much that something which seems to be kallsyms-internal is 
leaked out. You need to export cleanup_symbol_name() and there is now a 
lot of code outside. I would feel much more comfortable if it is all 
hidden from kallsyms users and kept there. Would it be possible?

Moreover, isn't there a similar problem for ftrace, kprobes, ebpf,...?

Thank you,
Miroslav

  reply	other threads:[~2024-06-07 13:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  3:21 [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG Song Liu
2024-06-07 13:06 ` Miroslav Benes [this message]
2024-06-07 16:53   ` Song Liu
2024-06-28 12:23     ` Miroslav Benes
2024-06-28 17:36       ` Luis Chamberlain
2024-06-28 19:31         ` Sami Tolvanen
2024-07-01 13:13         ` Petr Mladek
2024-07-03  5:56           ` Josh Poimboeuf
2024-07-03 15:30             ` Luis Chamberlain
2024-07-04  9:02               ` Petr Mladek
2024-07-08 21:33                 ` Luis Chamberlain
2024-07-09  0:07                   ` Sami Tolvanen
2024-07-09 16:42                     ` Song Liu
2024-07-09 17:06                     ` Matthew Maurer

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=alpine.LSU.2.21.2406071458531.29080@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@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