libbpf: Provide CO-RE variants of PT_REGS macros
authorAndrii Nakryiko <andriin@fb.com>
Fri, 13 Mar 2020 17:23:35 +0000 (10:23 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 13 Mar 2020 22:30:53 +0000 (23:30 +0100)
commitb8ebce86ffe655ac15a841bba2d645105ffe3d38
tree342c3e6a8f11df30291dafd552e2427846c67971
parentd121e1d34b72c4975ff0340901d926c0aaf98174
libbpf: Provide CO-RE variants of PT_REGS macros

Syscall raw tracepoints have struct pt_regs pointer as tracepoint's first
argument. After that, reading any of pt_regs fields requires bpf_probe_read(),
even for tp_btf programs. Due to that, PT_REGS_PARMx macros are not usable as
is. This patch adds CO-RE variants of those macros that use BPF_CORE_READ() to
read necessary fields. This provides relocatable architecture-agnostic pt_regs
field accesses.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200313172336.1879637-4-andriin@fb.com
tools/lib/bpf/bpf_tracing.h