[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211204140700.396138-1-jolsa@kernel.org>
Date: Sat, 4 Dec 2021 15:06:57 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>
Subject: [PATCH bpf-next 0/3] bpf: Add helpers to access traced function arguments
hi,
adding new helpers to access traced function arguments that
came out of the trampoline batch changes [1].
Get n-th argument of the traced function:
long bpf_get_func_arg(void *ctx, u32 n, u64 *value)
Get return value of the traced function:
long bpf_get_func_ret(void *ctx, u64 *value)
Get arguments count of the traced funtion:
long bpf_get_func_arg_cnt(void *ctx)
changes from original post [1]:
- change helpers names to get_func_*
- change helpers to return error values instead of
direct values
- replaced stack_size usage with specific offset
variables in arch_prepare_bpf_trampoline
- add comment on stack layout
- add more tests
- allow bpf_get_func_ret in FENTRY programs
- use BPF_LSH instead of BPF_MUL
thanks,
jirka
[1] https://lore.kernel.org/bpf/20211118112455.475349-1-jolsa@kernel.org/
---
Jiri Olsa (3):
bpf, x64: Replace some stack_size usage with offset variables
bpf: Add get_func_[arg|ret|arg_cnt] helpers
selftests/bpf: Add tests for get_func_[arg|ret|arg_cnt] helpers
arch/x86/net/bpf_jit_comp.c | 55 +++++++++++++++++++++++++++++++++------------
include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++
kernel/bpf/verifier.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
kernel/trace/bpf_trace.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++-
tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++
tools/testing/selftests/bpf/prog_tests/get_func_args_test.c | 38 +++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/get_func_args_test.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 375 insertions(+), 17 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/get_func_args_test.c
create mode 100644 tools/testing/selftests/bpf/progs/get_func_args_test.c
Powered by blists - more mailing lists