• Andrii Nakryiko's avatar
    libbpf: Add support for fetching up to 8 arguments in kprobes · 3c59623d
    Andrii Nakryiko authored
    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: default avatarAndrii Nakryiko <andrii@kernel.org>
    Signed-off-by: default avatarDaniel 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
    3c59623d
bpf_tracing.h 29.9 KB