New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Add helpers to access traced function arguments #2234
Conversation
Master branch: da54ab1 |
Master branch: 866de40 |
cf42e11
to
68bf387
Compare
Master branch: 942df4d |
68bf387
to
2788be0
Compare
Master branch: db52f57 |
2788be0
to
4e731ff
Compare
Master branch: 222c98c |
4e731ff
to
86e66fe
Compare
As suggested by Andrii, adding variables for registers and ip address offsets, which makes the code more clear, rather than abusing single stack_size variable for everything. Also describing the stack layout in the comment. There is no function change. Suggested-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Andrii Nakryiko <andrii@kernel.org>
Adding following helpers for tracing programs: 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) The trampoline now stores number of arguments on ctx-8 address, so it's easy to verify argument index and find return value argument's position. Moving function ip address on the trampoline stack behind the number of functions arguments, so it's now stored on ctx-16 address if it's needed. All helpers above are inlined by verifier. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding tests for get_func_[arg|ret|arg_cnt] helpers. Using these helpers in fentry/fexit/fmod_ret programs. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Master branch: d5284de |
86e66fe
to
e31adc9
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=590285 expired. Closing PR. |
Pull request for series with
subject: bpf: Add helpers to access traced function arguments
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=590285