linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Alessandro Carminati <alessandro.carminati@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Nick Alcock <nick.alcock@oracle.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Daniel Bristot de Oliveira" <bristot@kernel.org>,
	Viktor Malik <vmalik@redhat.com>,
	Kris Van Hees <kris.van.hees@oracle.com>,
	Luis Chamberlain <mcgrof@kernel.org>, <eugene.loh@oracle.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-kbuild@vger.kernel.org>,
	<live-patching@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms
Date: Mon, 24 Jul 2023 12:30:43 +0200	[thread overview]
Message-ID: <6ce978c1-825f-c1fd-41e3-eba2324cfd56@intel.com> (raw)
In-Reply-To: <CAPp5cGRBW6WDm9ku3nsr0x=rhEOGAUx==BctCo+DJ+498Tz2Sw@mail.gmail.com>

From: Alessandro Carminati <alessandro.carminati@gmail.com>
Date: Fri, 21 Jul 2023 14:40:54 +0200

> Hello,
> 
> I apologize for being noisy today.
> 
> In an effort to be collaborative, I would like to share my thoughts on why I
> see duplicate symbols in fs/binfmt_elf.c.

[...]

> ~ $ nm -n built-in.a | grep set_brk -B100| egrep "set_brk|\.o:$"
> fs/binfmt_elf.o:
> 00000000000000d4 t set_brk
> fs/compat_binfmt_elf.o:
> 00000000000000d4 t set_brk
> ```
> 
> These two symbols come from fs/binfmt_elf.o and fs/compat_binfmt_elf.o, and
> they are just two symbols that happen to share the same name, as is common
> in the kernel.
> 
> at the same time, addr2line reports symbols to be generated from the same file.
> 
> ```
> ~ $ llvm-addr2line-14 -fe vmlinux ffff8000082f1d2c ffff8000082f4454
> set_brk
> /home/alessandro/src/lka64/linux-6.4/fs/binfmt_elf.c:114
> set_brk
> /home/alessandro/src/lka64/linux-6.4/fs/binfmt_elf.c:114
> ~ $
> ~ $ addr2line -fe vmlinux ffff8000082f1d2c ffff8000082f4454
> set_brk
> /home/alessandro/src/lka64/linux-6.4/fs/binfmt_elf.c:114
> set_brk
> /home/alessandro/src/lka64/linux-6.4/fs/binfmt_elf.c:114
> ```
> looking at the source code:
> https://elixir.bootlin.com/linux/v6.4/source/fs/compat_binfmt_elf.c#L144
> the cause of this behavior, which is unexpected but correct.

Oh man, that's some deep investigation!
Let me go back to my old tree I was sending RFC from and check that
particular case there...

$ grep set_brk test_ksyms
ffffffff814b46c0 t fs/binfmt_elf.c:set_brk
ffffffff814b7040 t fs/compat_binfmt_elf.c:set_brk

Looks a bit better :D

> 
> The rationale is that using source file + line number iproduces better kallsyms
> table, but it is still do not produce unique names.
> 
> BR
> Alessandro
>> As a final note, please understand that my patch was not intended to undermine
>> anyone's work. I simply encountered a problem that I wanted to help solve.
>> Attached to this message is my code, in case anyone wants to replicate it.
>> I would appreciate being kept in the loop, as I genuinely want to assist in
>> fixing this problem.

Thanks,
Olek

  reply	other threads:[~2023-07-24 10:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 15:03 [PATCH v2] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms Alessandro Carminati
2023-07-17 14:52 ` Steven Rostedt
2023-07-17 16:50   ` Luis Chamberlain
2023-07-18  1:01     ` Masami Hiramatsu
2023-07-18 16:06   ` Alessandro Carminati
2023-07-18 16:55     ` Steven Rostedt
2023-07-21  9:21       ` Alessandro Carminati
2023-07-21 12:40         ` Alessandro Carminati
2023-07-24 10:30           ` Alexander Lobakin [this message]
2023-08-24 15:35           ` Francis Laniel
2023-08-25 10:15             ` Alessandro Carminati
2023-08-25 12:31               ` Masami Hiramatsu
2023-07-19 16:08     ` Masami Hiramatsu
2023-07-19 11:12   ` Nick Alcock
2023-07-19 15:12     ` Alexander Lobakin
2023-07-20 13:00       ` Nick Alcock
2023-07-20 17:00         ` Alexander Lobakin
2023-07-21  1:09         ` Masami Hiramatsu
2023-07-21  1:39           ` Kris Van Hees

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=6ce978c1-825f-c1fd-41e3-eba2324cfd56@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=alessandro.carminati@gmail.com \
    --cc=bristot@kernel.org \
    --cc=eugene.loh@oracle.com \
    --cc=jpoimboe@kernel.org \
    --cc=kris.van.hees@oracle.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nick.alcock@oracle.com \
    --cc=nicolas@fjasle.eu \
    --cc=rostedt@goodmis.org \
    --cc=vmalik@redhat.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;
as well as URLs for NNTP newsgroup(s).