libbpf-tools: fix misuse of bpf_get_current_pid_tgid
authorHengqi Chen <chenhengqi@outlook.com>
Fri, 21 May 2021 01:17:14 +0000 (09:17 +0800)
committeryonghong-song <ys114321@gmail.com>
Tue, 25 May 2021 23:04:05 +0000 (16:04 -0700)
commitb1ebd4f6002fbbd826fdc9f6a142c86383a45249
tree8a7f330b0a6cc02001bb10587c6bb87aa4212394
parent528be5e2767a5bc56f1118f885925b4cf7e08d44
libbpf-tools: fix misuse of bpf_get_current_pid_tgid

bpf_get_current_pid_tgid() returns process ID in the upper 32bits,
and thread ID in lower 32 bits (both from userspace's perspective).
biosnoop and gethostlatency misuse this function.
biosnoop takes the thread ID as process ID which is not expected.
gethostlatency uses the process ID as a unique key for BPF map,
which may result in event loss or data corruption.
This commit fixes these problems.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
libbpf-tools/biosnoop.bpf.c
libbpf-tools/gethostlatency.bpf.c
libbpf-tools/gethostlatency.c