From: Song Liu <songliubraving@meta.com>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: "Luis Chamberlain" <mcgrof@kernel.org>,
"Matthew Maurer" <mmaurer@google.com>,
"Petr Mladek" <pmladek@suse.com>, "Gary Guo" <gary@garyguo.net>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Michal Suchánek" <msuchanek@suse.de>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Andreas Hindborg" <nmi@metaspace.dk>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Miroslav Benes" <mbenes@suse.cz>, "Song Liu" <song@kernel.org>,
"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Jiri Kosina" <jikos@kernel.org>,
"Joe Lawrence" <joe.lawrence@redhat.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"morbo@google.com" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
Leizhen <thunder.leizhen@huawei.com>,
"kees@kernel.org" <kees@kernel.org>,
"Kernel Team" <kernel-team@meta.com>
Subject: Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG
Date: Tue, 9 Jul 2024 16:42:56 +0000 [thread overview]
Message-ID: <11313BE0-1CE7-48CF-A71A-320A883FE14E@fb.com> (raw)
In-Reply-To: <CABCJKucSUA_fc1eWecWAZ3z8J-T=s5zsZunJHF2VgB=9V5c3tA@mail.gmail.com>
> On Jul 9, 2024, at 8:07 AM, Sami Tolvanen <samitolvanen@google.com> wrote:
[...]
>
>>> I am a bit scared because using hashed symbol names in backtraces, gdb,
>>> ... would be a nightmare. Hashes are not human readable and
>>> they would complicate the life a lot. And using different names
>>> in different interfaces would complicate the life either.
>>
>> All great points.
>>
>> The scope of the Rust issue is self contained to modversion_info,
>> whereas for CONFIG_LTO_CLANG issue commit 8b8e6b5d3b013b0
>> ("kallsyms: strip ThinLTO hashes from static functions") describes
>> the issue with userspace tools (it doesn't explain which ones)
>> which don't expect the function name to change. This seems to happen
>> to static routines so I can only suspect this isn't an issue with
>> modversioning as the only symbols that would be used there wouldn't be
>> static.
>>
>> Sami, what was the exact userspace issue with CONFIG_LTO_CLANG and these
>> long symbols?
>
> The issue with LTO wasn't symbol length. IIRC the compiler renaming
> symbols with ThinLTO caused issues for folks using dynamic kprobes,
> and I seem to recall it also breaking systrace in Android, at which
> point we decided to strip the postfix in kallsyms to avoid breaking
> anything else.
Trying to understand all the requirements and constraints. IIUC, we
can mostly agree:
(1) A way to match a symbol exactly is crucial for users like live
patching.
(2) Original symbol name is useful for backtrace, etc. (IOW hash
alone is not enough)
With these two requirements/constraints, we need
original symbol name + something
for duplicate symbols. "Something" here could be a path name
(xxx_driver_xxx_yyy_c), or a hash, or sympos.
At the moment, (1) is not met with CONFIG_LTO_CLANG. The original
patch tries to fix this, but the solution seems not optimal. I will
send another version that allows kallsyms match exactly or without
suffix.
This work shouldn't cause any problem for Rust, as Rust also need
original symbol name + "something". If we finally decide "something"
should be some format of hash, we can change all users (live patch,
etc.) to use hash, which might be better than sympos. Note: I am
not trying to say "something" should be hash.
OTOH, there is also an open question: Shall we allow tracing with
only original symbol name (without specifying _something_). I think
this a separate question and we don't have to answer it here.
Does this make sense?
Thanks,
Song
next prev parent reply other threads:[~2024-07-09 16:43 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
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 [this message]
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=11313BE0-1CE7-48CF-A71A-320A883FE14E@fb.com \
--to=songliubraving@meta.com \
--cc=gary@garyguo.net \
--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=lucas.demarchi@intel.com \
--cc=masahiroy@kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=mmaurer@google.com \
--cc=morbo@google.com \
--cc=msuchanek@suse.de \
--cc=nathan@kernel.org \
--cc=nmi@metaspace.dk \
--cc=pmladek@suse.com \
--cc=samitolvanen@google.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