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
File Mode Size
internal
acompress.h -rw-r--r-- 8.9 KB
aead.h -rw-r--r-- 18.4 KB
aes.h -rw-r--r-- 2.5 KB
akcipher.h -rw-r--r-- 12.9 KB
algapi.h -rw-r--r-- 7.2 KB
arc4.h -rw-r--r-- 484 bytes
asym_tpm_subtype.h -rw-r--r-- 521 bytes
authenc.h -rw-r--r-- 635 bytes
b128ops.h -rw-r--r-- 2.4 KB
blake2b.h -rw-r--r-- 1.6 KB
blake2s.h -rw-r--r-- 2.6 KB
blowfish.h -rw-r--r-- 415 bytes
cast5.h -rw-r--r-- 590 bytes
cast6.h -rw-r--r-- 607 bytes
cast_common.h -rw-r--r-- 232 bytes
chacha.h -rw-r--r-- 3.3 KB
chacha20poly1305.h -rw-r--r-- 1.7 KB
cryptd.h -rw-r--r-- 2.0 KB
ctr.h -rw-r--r-- 1.4 KB
curve25519.h -rw-r--r-- 2.0 KB
des.h -rw-r--r-- 1.7 KB
dh.h -rw-r--r-- 2.5 KB
drbg.h -rw-r--r-- 9.0 KB
ecc_curve.h -rw-r--r-- 1.3 KB
ecdh.h -rw-r--r-- 2.4 KB
engine.h -rw-r--r-- 4.4 KB
gcm.h -rw-r--r-- 867 bytes
gf128mul.h -rw-r--r-- 9.4 KB
ghash.h -rw-r--r-- 388 bytes
hash.h -rw-r--r-- 34.0 KB
hash_info.h -rw-r--r-- 998 bytes
hmac.h -rw-r--r-- 173 bytes
if_alg.h -rw-r--r-- 6.6 KB
kdf_sp800108.h -rw-r--r-- 2.1 KB
kpp.h -rw-r--r-- 9.9 KB
md5.h -rw-r--r-- 497 bytes
nhpoly1305.h -rw-r--r-- 2.2 KB
null.h -rw-r--r-- 346 bytes
padlock.h -rw-r--r-- 438 bytes
pcrypt.h -rw-r--r-- 821 bytes
pkcs7.h -rw-r--r-- 1.2 KB
poly1305.h -rw-r--r-- 2.4 KB
public_key.h -rw-r--r-- 2.4 KB
rng.h -rw-r--r-- 6.6 KB
scatterwalk.h -rw-r--r-- 2.9 KB
serpent.h -rw-r--r-- 696 bytes
sha1.h -rw-r--r-- 1.2 KB
sha1_base.h -rw-r--r-- 2.5 KB
sha2.h -rw-r--r-- 3.8 KB
sha256_base.h -rw-r--r-- 2.6 KB
sha3.h -rw-r--r-- 879 bytes
sha512_base.h -rw-r--r-- 3.2 KB
skcipher.h -rw-r--r-- 20.0 KB
sm2.h -rw-r--r-- 749 bytes
sm3.h -rw-r--r-- 897 bytes
sm3_base.h -rw-r--r-- 2.5 KB
sm4.h -rw-r--r-- 1.1 KB
streebog.h -rw-r--r-- 949 bytes
twofish.h -rw-r--r-- 743 bytes
xts.h -rw-r--r-- 1.1 KB

back to top