lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6Axj1LaK3D09KuevQo2Otg7U0toDEPjop1dEnrUFtzAA@mail.gmail.com>
Date: Mon, 5 Aug 2024 10:46:20 -0700
From: Song Liu <song@...nel.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org, jpoimboe@...nel.org, jikos@...nel.org, 
	mbenes@...e.cz, pmladek@...e.com, joe.lawrence@...hat.com, nathan@...nel.org, 
	morbo@...gle.com, justinstitt@...gle.com, mcgrof@...nel.org, 
	thunder.leizhen@...wei.com, kees@...nel.org, kernel-team@...a.com, 
	mmaurer@...gle.com, samitolvanen@...gle.com, rostedt@...dmis.org
Subject: Re: [PATCH v2 2/3] kallsyms: Add APIs to match symbol without .XXXX suffix.

Hi Masami,

On Mon, Aug 5, 2024 at 6:45 AM Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
> On Fri,  2 Aug 2024 14:08:34 -0700
> Song Liu <song@...nel.org> wrote:
>
> > With CONFIG_LTO_CLANG=y, the compiler may add suffix to function names
> > to avoid duplication. This causes confusion with users of kallsyms.
> > On one hand, users like livepatch are required to match the symbols
> > exactly. On the other hand, users like kprobe would like to match to
> > original function names.
> >
> > Solve this by splitting kallsyms APIs. Specifically, existing APIs now
> > should match the symbols exactly. Add two APIs that match only the part
> > without .XXXX suffix. Specifically, the following two APIs are added.
> >
> > 1. kallsyms_lookup_name_without_suffix()
> > 2. kallsyms_on_each_match_symbol_without_suffix()
> >
> > These APIs will be used by kprobe.
> >
> > Also cleanup some code and update kallsyms_selftests accordingly.
> >
> > Signed-off-by: Song Liu <song@...nel.org>
>
> Looks good to me, but I have a nitpick.
>
>
> > --- a/kernel/kallsyms.c
> > +++ b/kernel/kallsyms.c
> > @@ -164,30 +164,27 @@ static void cleanup_symbol_name(char *s)
> >  {
> >       char *res;
> >
> > -     if (!IS_ENABLED(CONFIG_LTO_CLANG))
> > -             return;
> > -
> >       /*
> >        * LLVM appends various suffixes for local functions and variables that
> >        * must be promoted to global scope as part of LTO.  This can break
> >        * hooking of static functions with kprobes. '.' is not a valid
> > -      * character in an identifier in C. Suffixes only in LLVM LTO observed:
> > -      * - foo.llvm.[0-9a-f]+
> > +      * character in an identifier in C, so we can just remove the
> > +      * suffix.
> >        */
> > -     res = strstr(s, ".llvm.");
> > +     res = strstr(s, ".");
>
> nit: "strchr(s, '.')" ?
>
> Anyway,
>
> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

Thanks for your kind review!

If we have another version, I will fold this change (and the one in
kallsyms_selftest.c) in.

Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ