Re: [PATCH v2] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alessandro Carminati <alessandro.carminati@xxxxxxxxx>
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



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux