https://github.com/torvalds/linux
Revision 3cf6a32f3f2a45944dd5be5c6ac4deb46bcd3bee authored by Michael Petlan on 17 March 2022, 13:55:36 UTC, committed by Arnaldo Carvalho de Melo on 18 March 2022, 21:39:09 UTC
Before this patch, the symbol end address fixup to be called, needed two
conditions being met:

  if (prev->end == prev->start && prev->end != curr->start)

Where
  "prev->end == prev->start" means that prev is zero-long
                             (and thus needs a fixup)
and
  "prev->end != curr->start" means that fixup hasn't been applied yet

However, this logic is incorrect in the following situation:

*curr  = {rb_node = {__rb_parent_color = 278218928,
  rb_right = 0x0, rb_left = 0x0},
  start = 0xc000000000062354,
  end = 0xc000000000062354, namelen = 40, type = 2 '\002',
  binding = 0 '\000', idle = 0 '\000', ignore = 0 '\000',
  inlined = 0 '\000', arch_sym = 0 '\000', annotate2 = false,
  name = 0x1159739e "kprobe_optinsn_page\t[__builtin__kprobes]"}

*prev = {rb_node = {__rb_parent_color = 278219041,
  rb_right = 0x109548b0, rb_left = 0x109547c0},
  start = 0xc000000000062354,
  end = 0xc000000000062354, namelen = 12, type = 2 '\002',
  binding = 1 '\001', idle = 0 '\000', ignore = 0 '\000',
  inlined = 0 '\000', arch_sym = 0 '\000', annotate2 = false,
  name = 0x1095486e "optinsn_slot"}

In this case, prev->start == prev->end == curr->start == curr->end,
thus the condition above thinks that "we need a fixup due to zero
length of prev symbol, but it has been probably done, since the
prev->end == curr->start", which is wrong.

After the patch, the execution path proceeds to arch__symbols__fixup_end
function which fixes up the size of prev symbol by adding page_size to
its end offset.

Fixes: 3b01a413c196c910 ("perf symbols: Improve kallsyms symbol end addr calculation")
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 34e047a
History
Tip revision: 3cf6a32f3f2a45944dd5be5c6ac4deb46bcd3bee authored by Michael Petlan on 17 March 2022, 13:55:36 UTC
perf symbols: Fix symbol size calculation condition
Tip revision: 3cf6a32
File Mode Size
9p
adfs
affs
afs
autofs
befs
bfs
btrfs
cachefiles
ceph
cifs
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
erofs
exfat
exportfs
ext2
ext4
f2fs
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
iomap
isofs
jbd2
jffs2
jfs
kernfs
ksmbd
lockd
minix
netfs
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ntfs3
ocfs2
omfs
openpromfs
orangefs
overlayfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
smbfs_common
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
unicode
vboxsf
verity
xfs
zonefs
Kconfig -rw-r--r-- 9.6 KB
Kconfig.binfmt -rw-r--r-- 7.0 KB
Makefile -rw-r--r-- 4.6 KB
aio.c -rw-r--r-- 61.1 KB
anon_inodes.c -rw-r--r-- 8.1 KB
attr.c -rw-r--r-- 13.3 KB
bad_inode.c -rw-r--r-- 5.8 KB
binfmt_aout.c -rw-r--r-- 8.2 KB
binfmt_elf.c -rw-r--r-- 61.3 KB
binfmt_elf_fdpic.c -rw-r--r-- 43.6 KB
binfmt_flat.c -rw-r--r-- 28.5 KB
binfmt_misc.c -rw-r--r-- 17.4 KB
binfmt_script.c -rw-r--r-- 4.2 KB
buffer.c -rw-r--r-- 88.4 KB
char_dev.c -rw-r--r-- 16.5 KB
compat_binfmt_elf.c -rw-r--r-- 3.7 KB
coredump.c -rw-r--r-- 27.7 KB
d_path.c -rw-r--r-- 11.5 KB
dax.c -rw-r--r-- 46.6 KB
dcache.c -rw-r--r-- 86.0 KB
direct-io.c -rw-r--r-- 39.4 KB
drop_caches.c -rw-r--r-- 1.9 KB
eventfd.c -rw-r--r-- 12.0 KB
eventpoll.c -rw-r--r-- 64.1 KB
exec.c -rw-r--r-- 50.1 KB
fcntl.c -rw-r--r-- 23.8 KB
fhandle.c -rw-r--r-- 6.8 KB
file.c -rw-r--r-- 31.0 KB
file_table.c -rw-r--r-- 11.0 KB
filesystems.c -rw-r--r-- 6.5 KB
fs-writeback.c -rw-r--r-- 79.3 KB
fs_context.c -rw-r--r-- 17.7 KB
fs_parser.c -rw-r--r-- 10.7 KB
fs_pin.c -rw-r--r-- 1.9 KB
fs_struct.c -rw-r--r-- 3.4 KB
fs_types.c -rw-r--r-- 2.5 KB
fsopen.c -rw-r--r-- 11.0 KB
init.c -rw-r--r-- 6.1 KB
inode.c -rw-r--r-- 64.2 KB
internal.h -rw-r--r-- 5.2 KB
io-wq.c -rw-r--r-- 33.7 KB
io-wq.h -rw-r--r-- 5.1 KB
io_uring.c -rw-r--r-- 278.4 KB
ioctl.c -rw-r--r-- 24.0 KB
kernel_read_file.c -rw-r--r-- 4.4 KB
libfs.c -rw-r--r-- 40.0 KB
locks.c -rw-r--r-- 74.1 KB
mbcache.c -rw-r--r-- 12.0 KB
mount.h -rw-r--r-- 4.0 KB
mpage.c -rw-r--r-- 20.3 KB
namei.c -rw-r--r-- 133.7 KB
namespace.c -rw-r--r-- 112.5 KB
no-block.c -rw-r--r-- 478 bytes
nsfs.c -rw-r--r-- 6.6 KB
open.c -rw-r--r-- 34.7 KB
pipe.c -rw-r--r-- 36.0 KB
pnode.c -rw-r--r-- 15.1 KB
pnode.h -rw-r--r-- 2.0 KB
posix_acl.c -rw-r--r-- 23.8 KB
proc_namespace.c -rw-r--r-- 8.1 KB
read_write.c -rw-r--r-- 38.9 KB
readdir.c -rw-r--r-- 13.9 KB
remap_range.c -rw-r--r-- 13.8 KB
select.c -rw-r--r-- 34.7 KB
seq_file.c -rw-r--r-- 25.0 KB
signalfd.c -rw-r--r-- 8.7 KB
splice.c -rw-r--r-- 38.8 KB
stack.c -rw-r--r-- 2.5 KB
stat.c -rw-r--r-- 21.2 KB
statfs.c -rw-r--r-- 9.7 KB
super.c -rw-r--r-- 45.4 KB
sync.c -rw-r--r-- 10.1 KB
sysctls.c -rw-r--r-- 809 bytes
timerfd.c -rw-r--r-- 13.9 KB
userfaultfd.c -rw-r--r-- 54.6 KB
utimes.c -rw-r--r-- 7.6 KB
xattr.c -rw-r--r-- 27.4 KB

back to top