]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Make BPF-side of USDT support work on big-endian machines
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 7 Apr 2022 21:44:10 +0000 (23:44 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 8 Apr 2022 03:59:10 +0000 (20:59 -0700)
commit5e9ef5242b9dccd54ca4d52a5f94204a762462cf
tree5fbfede8553008d503ceb38367cbf286ff453318
parent9f74bf92cfc76c5d5a545aa690253c355a6bd487
libbpf: Make BPF-side of USDT support work on big-endian machines

BPF_USDT_ARG_REG_DEREF handling always reads 8 bytes, regardless of
the actual argument size. On little-endian the relevant argument bits
end up in the lower bits of val, and later on the code that handles
all the argument types expects them to be there.

On big-endian they end up in the upper bits of val, breaking that
expectation. Fix by right-shifting val on big-endian.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220407214411.257260-3-iii@linux.ibm.com
tools/lib/bpf/usdt.bpf.h