Some of the tests are using x86_64 ABI-specific syscall entry points (such as __x64_sys_nanosleep and __x64_sys_getpgid). Update them to use architecture-dependent syscall entry names. Also update fexit_sleep test to not use BPF_PROG() so that it is clear that the syscall parameters aren't being accessed in the bpf prog. Note that none of the bpf progs in these tests are actually accessing any of the syscall parameters. The only exception is perfbuf_bench, which passes on the bpf prog context into bpf_perf_event_output() as a pointer to pt_regs, but that looks to be mostly ignored. Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/e35f7051f03e269b623a68b139d8ed131325f7b7.1643973917.git.naveen.n.rao@linux.vnet.ibm.com
63 lines
1.1 KiB
C
63 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2020 Facebook
|
|
|
|
#include <linux/bpf.h>
|
|
#include <asm/unistd.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
#include "bpf_misc.h"
|
|
|
|
char _license[] SEC("license") = "GPL";
|
|
|
|
long hits = 0;
|
|
|
|
SEC("tp/syscalls/sys_enter_getpgid")
|
|
int bench_trigger_tp(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|
|
|
|
SEC("raw_tp/sys_enter")
|
|
int BPF_PROG(bench_trigger_raw_tp, struct pt_regs *regs, long id)
|
|
{
|
|
if (id == __NR_getpgid)
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|
|
|
|
SEC("kprobe/" SYS_PREFIX "sys_getpgid")
|
|
int bench_trigger_kprobe(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|
|
|
|
SEC("fentry/" SYS_PREFIX "sys_getpgid")
|
|
int bench_trigger_fentry(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|
|
|
|
SEC("fentry.s/" SYS_PREFIX "sys_getpgid")
|
|
int bench_trigger_fentry_sleep(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|
|
|
|
SEC("fmod_ret/" SYS_PREFIX "sys_getpgid")
|
|
int bench_trigger_fmodret(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return -22;
|
|
}
|
|
|
|
SEC("uprobe/self/uprobe_target")
|
|
int bench_trigger_uprobe(void *ctx)
|
|
{
|
|
__sync_add_and_fetch(&hits, 1);
|
|
return 0;
|
|
}
|