libbpf: Add support for fetching up to 8 arguments in kprobes
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 20 Jan 2023 20:08:50 +0000 (12:08 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 23 Jan 2023 19:52:59 +0000 (20:52 +0100)
commit3c59623d82947c8bfcc2fbf34c5eab02493b3b28
tree2ec88aba75b3daec12c656dcf6e8458a931d4b68
parent7525daeefc8c20902bac63f89603096c76808fe0
libbpf: Add support for fetching up to 8 arguments in kprobes

Add BPF_KPROBE() and PT_REGS_PARMx() support for up to 8 arguments, if
target architecture supports this. Currently all architectures are
limited to only 5 register-placed arguments, which is limiting even on
x86-64.

This patch adds generic macro machinery to support up to 8 arguments
both when explicitly fetching it from pt_regs through PT_REGS_PARMx()
macros, as well as more ergonomic access in BPF_KPROBE().

Also, for i386 architecture we now don't have to define fake PARM4 and
PARM5 definitions, they will be generically substituted, just like for
PARM6 through PARM8.

Subsequent patches will fill out architecture-specific definitions,
where appropriate.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Alan Maguire <alan.maguire@oracle.com> # arm64
Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> # s390x
Link: https://lore.kernel.org/bpf/20230120200914.3008030-2-andrii@kernel.org
tools/lib/bpf/bpf_tracing.h