diff options
| author | Yonghong Song <[email protected]> | 2022-06-06 23:26:10 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2022-06-07 10:20:42 -0700 |
| commit | b58b2b3a31228bd9aaed9b96e9452dafd0d46024 (patch) | |
| tree | 1cf5146d57229619708198747aa0af258f80ff2d /tools/perf/scripts/python/syscall-counts-by-pid.py | |
| parent | 776281652ddcd98bb292335ea3634da341c849b4 (diff) | |
libbpf: Fix an error in 64bit relocation value computation
Currently, the 64bit relocation value in the instruction
is computed as follows:
__u64 imm = insn[0].imm + ((__u64)insn[1].imm << 32)
Suppose insn[0].imm = -1 (0xffffffff) and insn[1].imm = 1.
With the above computation, insn[0].imm will first sign-extend
to 64bit -1 (0xffffffffFFFFFFFF) and then add 0x1FFFFFFFF,
producing incorrect value 0xFFFFFFFF. The correct value
should be 0x1FFFFFFFF.
Changing insn[0].imm to __u32 first will prevent 64bit sign
extension and fix the issue. Merging high and low 32bit values
also changed from '+' to '|' to be consistent with other
similar occurences in kernel and libbpf.
Acked-by: Andrii Nakryiko <[email protected]>
Acked-by: Dave Marchevsky <[email protected]>
Signed-off-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts-by-pid.py')
0 files changed, 0 insertions, 0 deletions