Merge branch 'bpf: Add helpers to access traced function arguments'
authorAlexei Starovoitov <ast@kernel.org>
Mon, 13 Dec 2021 17:26:50 +0000 (09:26 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 13 Dec 2021 17:41:36 +0000 (09:41 -0800)
commite94fac3829ddd3d9f21efa27d1512215b630782c
tree7ade7429fb7c8cbbc59ee6a8b5b347e8bd099e95
parent4b443bc1785f28df56fdbd6a107dc68ef7d5aa8e
parent006004b715569f742535f70f3f06b41d8135486c
Merge branch 'bpf: Add helpers to access traced function arguments'

Jiri Olsa says:

====================
Add 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)

v2 changes:
  - added acks
  - updated stack diagram
  - return -EOPNOTSUPP instead of -EINVAL in bpf_get_func_ret
  - removed gpl_only for all helpers
  - added verifier fix to allow proper arguments checks,
    Andrii asked for checking also 'int *b' argument in
    bpf_modify_return_test programs and it turned out that it's currently
    not supported by verifier - we can't read argument that is int pointer,
    so I had to add verifier change to allow that + adding verifier selftest
  - checking all arguments in bpf_modify_return_test test programs
  - moved helpers proto gets in tracing_prog_func_proto with attach type check

thanks,
jirka

[1] https://lore.kernel.org/bpf/20211118112455.475349-1-jolsa@kernel.org/
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>