Skip to content

Commit

Permalink
benchmark: Adjust BPF hook point for getpid
Browse files Browse the repository at this point in the history
On my kernel __x64_sys_getpid() is not available in BTF vmlinux.
The function __do_sys_getpid() is to use that instead.

Tested on kernels:
 - 6.4.10-200.fc38.x86_64
 - 6.5.0-rc5-net-next

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
  • Loading branch information
netoptimizer committed Sep 18, 2023
1 parent 8a8fef6 commit 793eca0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benchmark/probes/benchmark.bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include <bpf/bpf_tracing.h>

#if defined(__TARGET_ARCH_x86)
#define FENTRY_SEC() SEC("fentry/__x64_sys_getpid")
#define FENTRY_SEC() SEC("fentry/__do_sys_getpid")
#elif defined(__TARGET_ARCH_arm64)
#define FENTRY_SEC() SEC("fentry/__arm64_sys_getpid")
#else
#error Unknown target for this architecture
#endif

#if defined(__TARGET_ARCH_x86)
#define KPROBE_SEC() SEC("kprobe/__x64_sys_getpid")
#define KPROBE_SEC() SEC("kprobe/__do_sys_getpid")
#elif defined(__TARGET_ARCH_arm64)
#define KPROBE_SEC() SEC("kprobe/__arm64_sys_getpid")
#else
Expand Down

0 comments on commit 793eca0

Please sign in to comment.