libbpf: complete riscv arch spec in bpf_tracing.h
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Pu Lehui
Tested-byQuoted 22 lines · Andrii Nakryiko
Add PARM6 through PARM8 definitions for RISC V (riscv) arch. Leave the link for ABI doc for future reference.
Signed-off-by Andrii Nakryiko <[email protected]>--- tools/lib/bpf/bpf_tracing.h | 7 +++++++ 1 file changed, 7 insertions(+)tools/lib/bpf/bpf_tracing.h +4
-0@@ -268,12 +268,19 @@ struct pt_regs___arm64 {#elif defined(bpf_target_riscv) +/* +* https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#risc-v-calling-conventions +*/ +#define __PT_REGS_CAST (x) ((const struct user_regs_struct *)(x))#define __PT_PARM1_REG a0
tools/lib/bpf/bpf_tracing.h struct pt_regs___arm64 { · line 286
Quoted 10 lines
tools/lib/bpf/bpf_tracing.h +3
-0#define __PT_PARM2_REG a1#define __PT_PARM3_REG a2#define __PT_PARM4_REG a3#define __PT_PARM5_REG a4 +#define __PT_PARM6_REG a5 +#define __PT_PARM7_REG a6 +#define __PT_PARM8_REG a7#define __PT_RET_REG ra#define __PT_FP_REG s0#define __PT_RC_REG a0
Hi Andrii,
Looks fine and tests passed as follow:
#233 uprobe_autoattach:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
#19 bpf_syscall_macro:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
Best Regards,
Lehui
A message that is not in the archive (sent off-list or not yet received): [email protected]
Pu Lehui
Tested-byRe: [PATCH bpf-next 21/25] libbpf: define riscv syscall regs spec in bpf_tracing.h
Quoted 25 lines · Andrii Nakryiko
Define explicit table of registers used for syscall argument passing.
Signed-off-by Andrii Nakryiko <[email protected]>--- tools/lib/bpf/bpf_tracing.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)tools/lib/bpf/bpf_tracing.h +10
-0@@ -359,13 +359,21 @@ struct pt_regs___arm64 {#define __PT_PARM6_REG a5#define __PT_PARM7_REG a6#define __PT_PARM8_REG a7 + +/* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ +#define PT_REGS_SYSCALL_REGS (ctx) ctx +#define __PT_PARM1_SYSCALL_REG __PT_PARM1_REG +#define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG +#define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG +#define __PT_PARM4_SYSCALL_REG __PT_PARM4_REG +#define __PT_PARM5_SYSCALL_REG __PT_PARM5_REG +#define __PT_PARM6_SYSCALL_REG __PT_PARM6_REG +
tools/lib/bpf/bpf_tracing.h struct pt_regs___arm64 { · line 379
Quoted 10 lines
tools/lib/bpf/bpf_tracing.h +0
-2#define __PT_RET_REG ra#define __PT_FP_REG s0#define __PT_RC_REG a0#define __PT_SP_REG sp#define __PT_IP_REG pc -/* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ -#define PT_REGS_SYSCALL_REGS (ctx) ctx#elif defined(bpf_target_arc)
Alan Maguire
Tested-byRe: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
In reply to a message not in the archiveQuoted 32 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for tracing arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can be passed to a function in registers (so relevant to kprobes and uprobes), but before this patch set libbpf's macros in
bpf_tracing.honly supported up to 5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows. This includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different. For a lot of architectures syscall argument passing through registers differs from function call sequence at least a little. For i386 it differs *a lot*. This patch set addresses this issue across all currently supported architectures and hopefully fixes existing issues. syscall(2) manpage defines that either 6 or 7 arguments can be supported, depending on architecture, so libbpf defines 6 or 7 registers per architecture to be used to fetch syscall arguments.
Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set. They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of argument fetching of kernel functions and user-space functions are identical), but it allows BPF users to have less confusing BPF-side code when working with uprobes.For both sets of changes selftests are extended to test these new register definitions to architecture-defined limits. Unfortunately I don't have ability to test it on all architectures, and BPF CI only tests 3 architecture (x86-64, arm64, and s390x), so it would be greatly appreciated if CC'ed people can help review and test changes on architectures they are familiar with (and maybe have direct access to for testing). Thank you.
Quoted 9 lines
Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>
This is fantastic, a huge step forward!
For the series (tested on aarch64):
One question - I couldn't parse the s390x documentation (or find anything else) which stated the function calling conventions for that platform. Currently we support 5 register function call args for s390x - is that the right number?
Quoted 35 lines
Andrii Nakryiko (25):
libbpf: add support for fetching up to 8 arguments in kprobes
libbpf: add 6th argument support for x86-64 inbpf_tracing.h
libbpf: fix arm and arm64 specs inbpf_tracing.h
libbpf: complete mips spec inbpf_tracing.h
libbpf: complete powerpc spec inbpf_tracing.h
libbpf: complete sparc spec inbpf_tracing.h
libbpf: complete riscv arch spec inbpf_tracing.h
libbpf: fix and complete ARC spec inbpf_tracing.h
libbpf: complete LoongArch (loongarch) spec inbpf_tracing.h
libbpf: addBPF_UPROBEandBPF_URETPROBEmacro aliases selftests/bpf: validate arch-specific argument registers limits
libbpf: improve syscall tracing support inbpf_tracing.h
libbpf: define x86-64 syscall regs spec inbpf_tracing.h
libbpf: define i386 syscall regs spec inbpf_tracing.h
libbpf: define s390x syscall regs spec inbpf_tracing.h
libbpf: define arm syscall regs spec inbpf_tracing.h
libbpf: define arm64 syscall regs spec inbpf_tracing.h
libbpf: define mips syscall regs spec inbpf_tracing.h
libbpf: define powerpc syscall regs spec inbpf_tracing.h
libbpf: define sparc syscall regs spec inbpf_tracing.h
libbpf: define riscv syscall regs spec inbpf_tracing.h
libbpf: define arc syscall regs spec inbpf_tracing.h
libbpf: define loongarch syscall regs spec inbpf_tracing.hselftests/bpf: add 6-argument syscall tracing test
libbpf: clean up now not needed __PT_PARM{1-6}_SYSCALL_REG defaultstools/lib/bpf/bpf_tracing.h | 301 +++++++++++++++--- .../bpf/prog_tests/test_bpf_syscall_macro.c | 18 +- .../bpf/prog_tests/uprobe_autoattach.c | 33 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 25 ++ .../selftests/bpf/progs/bpf_syscall_macro.c | 26 ++ .../bpf/progs/test_uprobe_autoattach.c | 48 ++- 6 files changed, 405 insertions(+), 46 deletions(-)
Re: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
Quoted 66 lines · Alan Maguire
Quoted 53 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for tracing
arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can be
passed to a function in registers (so relevant to kprobes and uprobes), but
before this patch set libbpf's macros inbpf_tracing.honly supported up to
5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows. This
includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different.
For a lot of architectures syscall argument passing through registers differs
from function call sequence at least a little. For i386 it differs *a lot*.
This patch set addresses this issue across all currently supported architectures and hopefully fixes existing issues. syscall(2) manpage defines
that either 6 or 7 arguments can be supported, depending on architecture, so
libbpf defines 6 or 7 registers per architecture to be used to fetch syscall
arguments.Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set.
They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of argument
fetching of kernel functions and user-space functions are identical), but it
allows BPF users to have less confusing BPF-side code when working with
uprobes.For both sets of changes selftests are extended to test these new register
definitions to architecture-defined limits. Unfortunately I don't have ability
to test it on all architectures, and BPF CI only tests 3 architecture (x86-64,
arm64, and s390x), so it would be greatly appreciated if CC'ed people can help
review and test changes on architectures they are familiar with (and maybe
have direct access to for testing). Thank you.Quoted 9 lines
Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>This is fantastic, a huge step forward!
Quoted 8 lines
For the series (tested on aarch64):
Tested-by Alan Maguire <[email protected]>
One question - I couldn't parse the s390x documentation (or find anything else) which stated the function calling conventions for that platform. Currently we support 5 register function call args for s390x - is that the right number?
Hi,
you can find the s390x ABI documentation here:
https://github.com/IBM/s390x-abi/releases/download/v1.6/lzsabi_s390x.pdf
It's indeed 5 registers for normal calls: %r2-%r6.
The other arguments are passed on stack (*(long *)(%r15 + 160), etc).
For syscalls it's 6: %r2-%r7. That is specified in man 2 syscall.
Best regards,
Ilya
Ilya Leoshkevich
Tested-byRe: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
In reply to a message not in the archiveQuoted 89 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for tracing
arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can be
passed to a function in registers (so relevant to kprobes and uprobes), but
before this patch set libbpf's macros inbpf_tracing.honly supported up to
5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows. This
includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different.
For a lot of architectures syscall argument passing through registers differs
from function call sequence at least a little. For i386 it differs *a lot*.
This patch set addresses this issue across all currently supported architectures and hopefully fixes existing issues. syscall(2) manpage defines
that either 6 or 7 arguments can be supported, depending on architecture, so
libbpf defines 6 or 7 registers per architecture to be used to fetch syscall
arguments.Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set.
They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of argument
fetching of kernel functions and user-space functions are identical), but it
allows BPF users to have less confusing BPF-side code when working with
uprobes.For both sets of changes selftests are extended to test these new register
definitions to architecture-defined limits. Unfortunately I don't have ability
to test it on all architectures, and BPF CI only tests 3 architecture (x86-64,
arm64, and s390x), so it would be greatly appreciated if CC'ed people can help
review and test changes on architectures they are familiar with (and maybe
have direct access to for testing). Thank you.Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>Andrii Nakryiko (25):
libbpf: add support for fetching up to 8 arguments in kprobes
libbpf: add 6th argument support for x86-64 inbpf_tracing.h
libbpf: fix arm and arm64 specs inbpf_tracing.h
libbpf: complete mips spec inbpf_tracing.h
libbpf: complete powerpc spec inbpf_tracing.h
libbpf: complete sparc spec inbpf_tracing.h
libbpf: complete riscv arch spec inbpf_tracing.h
libbpf: fix and complete ARC spec inbpf_tracing.h
libbpf: complete LoongArch (loongarch) spec inbpf_tracing.h
libbpf: addBPF_UPROBEandBPF_URETPROBEmacro aliases selftests/bpf: validate arch-specific argument registers limits
libbpf: improve syscall tracing support inbpf_tracing.h
libbpf: define x86-64 syscall regs spec inbpf_tracing.h
libbpf: define i386 syscall regs spec inbpf_tracing.h
libbpf: define s390x syscall regs spec inbpf_tracing.h
libbpf: define arm syscall regs spec inbpf_tracing.h
libbpf: define arm64 syscall regs spec inbpf_tracing.h
libbpf: define mips syscall regs spec inbpf_tracing.h
libbpf: define powerpc syscall regs spec inbpf_tracing.h
libbpf: define sparc syscall regs spec inbpf_tracing.h
libbpf: define riscv syscall regs spec inbpf_tracing.h
libbpf: define arc syscall regs spec inbpf_tracing.h
libbpf: define loongarch syscall regs spec inbpf_tracing.hselftests/bpf: add 6-argument syscall tracing test
libbpf: clean up now not needed __PT_PARM{1-6}_SYSCALL_REG defaults
Quoted 9 lines
tools/lib/bpf/bpf_tracing.h | 301 +++++++++++++++- --
.../bpf/prog_tests/test_bpf_syscall_macro.c | 18 +- .../bpf/prog_tests/uprobe_autoattach.c | 33 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 25 ++ .../selftests/bpf/progs/bpf_syscall_macro.c | 26 ++ .../bpf/progs/test_uprobe_autoattach.c | 48 ++-6 files changed, 405 insertions(+), 46 deletions(-)
With the following fixup for 24/25:
(quoted diff) +0 -0
b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c index c07c5c52d5fc..75ccdef9bc78 100644
tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +4 -0
@@ -88,15 +88,33 @@ __u64 mmap_flags;__u64 mmap_fd;__u64 mmap_offset; +#if defined(bpf_target_s390) +SEC("ksyscall/old_mmap") +#else SEC("ksyscall/mmap") +#endif int BPF_KSYSCALL(mmap_enter, void *addr, size_t length, int prot, int
flags,
int fd, off_t offset)
{
pid_t pid = bpf_get_current_pid_tgid() >> 32;+#if defined(bpf_target_s390)
+ unsigned long args[6] = {0};
+#endif
if (pid != filter_pid)
return 0;+#if defined(bpf_target_s390)
+ /* For __ARCH_WANT_SYS_OLD_MMAP, parse mmap_arg_struct. */
+ bpf_probe_read_user(args, sizeof(args), addr);
+ addr = (void *)args[0];
+ length = (size_t)args[1];
+ prot = (int)args[2];
+ flags = (int)args[3];
+ fd = (int)args[4];
+ offset = (off_t)args[5];
+#endif
+
mmap_addr = (__u64)addr;
mmap_length = length;
mmap_prot = prot;# ./test_progs -t syscall_macro #19 bpf_syscall_macro:OK
Re: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
Quoted 156 lines · Ilya Leoshkevich
Quoted 108 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for tracing
arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can
be
passed to a function in registers (so relevant to kprobes and uprobes), but
before this patch set libbpf's macros inbpf_tracing.honly supported
up to
5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows. This
includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different.
For a lot of architectures syscall argument passing through registers
differs
from function call sequence at least a little. For i386 it differs *a
lot*.
This patch set addresses this issue across all currently supported architectures and hopefully fixes existing issues. syscall(2) manpage
defines
that either 6 or 7 arguments can be supported, depending on architecture, so
libbpf defines 6 or 7 registers per architecture to be used to fetch
syscall
arguments.Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set.
They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of argument
fetching of kernel functions and user-space functions are identical),
but it
allows BPF users to have less confusing BPF-side code when working with
uprobes.For both sets of changes selftests are extended to test these new register
definitions to architecture-defined limits. Unfortunately I don't have ability
to test it on all architectures, and BPF CI only tests 3 architecture
(x86-64,
arm64, and s390x), so it would be greatly appreciated if CC'ed people
can help
review and test changes on architectures they are familiar with (and
maybe
have direct access to for testing). Thank you.Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>Andrii Nakryiko (25):
libbpf: add support for fetching up to 8 arguments in kprobes
libbpf: add 6th argument support for x86-64 inbpf_tracing.h
libbpf: fix arm and arm64 specs inbpf_tracing.h
libbpf: complete mips spec inbpf_tracing.h
libbpf: complete powerpc spec inbpf_tracing.h
libbpf: complete sparc spec inbpf_tracing.h
libbpf: complete riscv arch spec inbpf_tracing.h
libbpf: fix and complete ARC spec inbpf_tracing.h
libbpf: complete LoongArch (loongarch) spec inbpf_tracing.h
libbpf: addBPF_UPROBEandBPF_URETPROBEmacro aliases selftests/bpf: validate arch-specific argument registers limits
libbpf: improve syscall tracing support inbpf_tracing.h
libbpf: define x86-64 syscall regs spec inbpf_tracing.h
libbpf: define i386 syscall regs spec inbpf_tracing.h
libbpf: define s390x syscall regs spec inbpf_tracing.h
libbpf: define arm syscall regs spec inbpf_tracing.h
libbpf: define arm64 syscall regs spec inbpf_tracing.h
libbpf: define mips syscall regs spec inbpf_tracing.h
libbpf: define powerpc syscall regs spec inbpf_tracing.h
libbpf: define sparc syscall regs spec inbpf_tracing.h
libbpf: define riscv syscall regs spec inbpf_tracing.h
libbpf: define arc syscall regs spec inbpf_tracing.h
libbpf: define loongarch syscall regs spec inbpf_tracing.hselftests/bpf: add 6-argument syscall tracing test
libbpf: clean up now not needed __PT_PARM{1-6}_SYSCALL_REG defaultstools/lib/bpf/bpf_tracing.h | 301
+++++++++++++++-
--
.../bpf/prog_tests/test_bpf_syscall_macro.c | 18 +- .../bpf/prog_tests/uprobe_autoattach.c | 33 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 25 ++ .../selftests/bpf/progs/bpf_syscall_macro.c | 26 ++ .../bpf/progs/test_uprobe_autoattach.c | 48 ++-Quoted 2 lines
6 files changed, 405 insertions(+), 46 deletions(-)With the following fixup for 24/25:
tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +0
-0@@ -88,15 +88,33 @@ __u64 mmap_flags; __u64 mmap_fd; __u64 mmap_offset;tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +3
-0+#if defined(bpf_target_s390) +SEC ("ksyscall/old_mmap" ) +#elseSEC("ksyscall/mmap")
+#endif
int BPF_KSYSCALL(mmap_enter, void *addr,size_tlength, int prot, int
flags,
int fd,off_toffset)
{
pid_tpid =bpf_get_current_pid_tgid()>> 32;tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +3
-0+#if defined(bpf_target_s390) + unsigned long args[6] = {0}; +#endif
if (pid !=filter_pid)
return 0;tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +11
-0+#if defined(bpf_target_s390) + /* For __ARCH_WANT_SYS_OLD_MMAP, parse mmap_arg_struct. */ + bpf_probe_read_user(args, sizeof(args), addr); + addr = (void *)args[0]; + length = (size_t)args[1]; + prot = (int)args[2]; + flags = (int)args[3]; + fd = (int)args[4]; + offset = (off_t)args[5]; +#endif +
mmap_addr= (__u64)addr;
mmap_length= length;
mmap_prot= prot;
Quoted 4 lines
# ./test_progs -t syscall_macro #19 bpf_syscall_macro:OK
While the above fixup works, I realized that it's ugly. It's better to admit that mmap and old_mmap are different syscalls and create a different probe, even if it means duplicating pid filtering code:
(quoted diff) +0 -0
b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c index c07c5c52d5fc..2420cad54d36 100644
tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +2 -0
@@ -88,6 +88,29 @@ __u64 mmap_flags;__u64 mmap_fd;__u64 mmap_offset; +#if defined(bpf_target_s390) +/* Attach to old_mmap on architectures with __ARCH_WANT_SYS_OLD_MMAP.
*/
+SEC("ksyscall/old_mmap")
+int BPF_KSYSCALL(old_mmap_enter, void *arg)
+{
+ pid_t pid = bpf_get_current_pid_tgid() >> 32;
+ unsigned long a[6] = {0};
+
+ if (pid != filter_pid)
+ return 0;
+
+ /* Parse mmap_arg_struct. */ + bpf_probe_read_user(a, sizeof(a), arg); + mmap_addr = (__u64)(void *)a[0]; + mmap_length = (size_t)a[1]; + mmap_prot = (int)a[2]; + mmap_flags = (int)a[3]; + mmap_fd = (int)a[4]; + mmap_offset = (off_t)a[5];
+
+ return 0;
+}
+#else
SEC("ksyscall/mmap")
int BPF_KSYSCALL(mmap_enter, void *addr, size_t length, int prot, int
flags,
int fd, off_t offset)
@@ -106,5 +129,6 @@ int BPF_KSYSCALL(mmap_enter, void *addr, size_t length, int prot, int flags,
return 0;
}
+#endif
char _license[] SEC("license") = "GPL";
Re: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
Quoted 121 lines · Ilya Leoshkevich
Quoted 120 lines · Ilya Leoshkevich
Quoted 115 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for
tracing
arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can
be
passed to a function in registers (so relevant to kprobes and uprobes), but
before this patch set libbpf's macros inbpf_tracing.honly supported
up to
5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows.
This
includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different.
For a lot of architectures syscall argument passing through registers
differs
from function call sequence at least a little. For i386 it differs
*a
lot*.
This patch set addresses this issue across all currently supported
architectures and hopefully fixes existing issues. syscall(2) manpage
defines
that either 6 or 7 arguments can be supported, depending on architecture, so
libbpf defines 6 or 7 registers per architecture to be used to fetch
syscall
arguments.Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set.
They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of
argument
fetching of kernel functions and user-space functions are identical),
but it
allows BPF users to have less confusing BPF-side code when working
with
uprobes.For both sets of changes selftests are extended to test these new register
definitions to architecture-defined limits. Unfortunately I don't have ability
to test it on all architectures, and BPF CI only tests 3 architecture
(x86-64,
arm64, and s390x), so it would be greatly appreciated if CC'ed people
can help
review and test changes on architectures they are familiar with (and
maybe
have direct access to for testing). Thank you.Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>Andrii Nakryiko (25):
libbpf: add support for fetching up to 8 arguments in kprobes
libbpf: add 6th argument support for x86-64 inbpf_tracing.h
libbpf: fix arm and arm64 specs inbpf_tracing.h
libbpf: complete mips spec inbpf_tracing.h
libbpf: complete powerpc spec inbpf_tracing.h
libbpf: complete sparc spec inbpf_tracing.h
libbpf: complete riscv arch spec inbpf_tracing.h
libbpf: fix and complete ARC spec inbpf_tracing.h
libbpf: complete LoongArch (loongarch) spec inbpf_tracing.h
libbpf: addBPF_UPROBEandBPF_URETPROBEmacro aliases selftests/bpf: validate arch-specific argument registers limits
libbpf: improve syscall tracing support inbpf_tracing.h
libbpf: define x86-64 syscall regs spec inbpf_tracing.h
libbpf: define i386 syscall regs spec inbpf_tracing.h
libbpf: define s390x syscall regs spec inbpf_tracing.h
libbpf: define arm syscall regs spec inbpf_tracing.h
libbpf: define arm64 syscall regs spec inbpf_tracing.h
libbpf: define mips syscall regs spec inbpf_tracing.h
libbpf: define powerpc syscall regs spec inbpf_tracing.h
libbpf: define sparc syscall regs spec inbpf_tracing.h
libbpf: define riscv syscall regs spec inbpf_tracing.h
libbpf: define arc syscall regs spec inbpf_tracing.h
libbpf: define loongarch syscall regs spec inbpf_tracing.hselftests/bpf: add 6-argument syscall tracing test
libbpf: clean up now not needed __PT_PARM{1-6}_SYSCALL_REG defaultstools/lib/bpf/bpf_tracing.h | 301
+++++++++++++++-
--
.../bpf/prog_tests/test_bpf_syscall_macro.c | 18 +- .../bpf/prog_tests/uprobe_autoattach.c | 33 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 25 ++ .../selftests/bpf/progs/bpf_syscall_macro.c | 26 ++ .../bpf/progs/test_uprobe_autoattach.c | 48 ++-Quoted 2 lines
6 files changed, 405 insertions(+), 46 deletions(-)With the following fixup for 24/25:
[...]
Quoted 6 lines
Quoted 1 line
While the above fixup works, I realized that it's ugly. It's better to
admit that mmap andold_mmapare different syscalls and create a different probe, even if it means duplicating pid filtering code:
[...]
Sorry, I'm being dense. Both fixups defeat the purpose of having this test, because they don't use all 6 register arguments. We need to choose a different syscall; I believe splice() fits the bill. The other alternatives that I rejected were:
- clone() - argument order is messy;
- recvfrom() - s390x uses socketcall instead;
- ipc() - doesn't seem to be available on aarch64.
The following worked for me:
diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c b/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c index e18dd82eb801..2900c5e9a016 100644
tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c +5 -3
@@ -1,20 +1,22 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright 2022 Sony Group Corporation */ +#define _GNU_SOURCE +#include <fcntl.h> #include <sys/prctl.h> -#include <sys/mman.h> #include <test_progs.h> #include "bpf_syscall_macro.skel.h" void test_bpf_syscall_macro (void ) {struct bpf_syscall_macro *skel =NULL ; -int err, page_size =getpagesize (); +int err;int exp_arg1 =1001 ;unsigned long exp_arg2 =12 ;unsigned long exp_arg3 =13 ;unsigned long exp_arg4 =14 ;unsigned long exp_arg5 =15 ; -void *r; +loff_t off_in, off_out; +ssize_t r;/* check whether it can open program */ skel =bpf_syscall_macro__open ();
@@ -71,18 +73,17 @@ void test_bpf_syscall_macro(void) ASSERT_EQ(skel->bss->arg4_syscall, exp_arg4,
"BPF_KPROBE_SYSCALL_arg4");
ASSERT_EQ(skel->bss->arg5_syscall, exp_arg5,
"BPF_KPROBE_SYSCALL_arg5");
- r = mmap((void *)0x12340000, 3 * page_size, PROT_READ |PROT_WRITE,
- MAP_PRIVATE, -42, 5 * page_size);
+ r = splice(-42, &off_in, 42, &off_out, 0x12340000,SPLICE_F_NONBLOCK);
err = -errno;
- ASSERT_EQ(r, MAP_FAILED, "mmap_res");
- ASSERT_EQ(err, -EBADF, "mmap_err");
+ ASSERT_EQ(r, -1, "splice_res");
+ ASSERT_EQ(err, -EBADF, "splice_err");
- ASSERT_EQ(skel->bss->mmap_addr, 0x12340000, "mmap_arg1");
- ASSERT_EQ(skel->bss->mmap_length, 3 * page_size, "mmap_arg2");
- ASSERT_EQ(skel->bss->mmap_prot, PROT_READ | PROT_WRITE,
"mmap_arg3");
- ASSERT_EQ(skel->bss->mmap_flags, MAP_PRIVATE, "mmap_arg4");
- ASSERT_EQ(skel->bss->mmap_fd, -42, "mmap_arg5");
- ASSERT_EQ(skel->bss->mmap_offset, 5 * page_size, "mmap_arg6");
+ ASSERT_EQ(skel->bss->splice_fd_in, -42, "splice_arg1");
+ ASSERT_EQ(skel->bss->splice_off_in, (__u64)&off_in,
"splice_arg2");
+ ASSERT_EQ(skel->bss->splice_fd_out, 42, "splice_arg3");
+ ASSERT_EQ(skel->bss->splice_off_out, (__u64)&off_out,
"splice_arg4");
+ ASSERT_EQ(skel->bss->splice_len, 0x12340000, "splice_arg5");
+ ASSERT_EQ(skel->bss->splice_flags, SPLICE_F_NONBLOCK,
"splice_arg6");
cleanup:
bpf_syscall_macro__destroy(skel);
(quoted diff) +0 -0
b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c index c07c5c52d5fc..1a476d8ed354 100644
tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +0 -0
@@ -81,28 +81,28 @@ int BPF_KSYSCALL(prctl_enter, int option, unsigned
long arg2,
return 0;
}
-__u64 mmap_addr;
-__u64 mmap_length;
-__u64 mmap_prot;
-__u64 mmap_flags;
-__u64 mmap_fd;
-__u64 mmap_offset;
-
-SEC("ksyscall/mmap")
-int BPF_KSYSCALL(mmap_enter, void *addr, size_t length, int prot, int flags,
- int fd, off_t offset)
+__u64 splice_fd_in;
+__u64 splice_off_in;
+__u64 splice_fd_out;
+__u64 splice_off_out;
+__u64 splice_len;
+__u64 splice_flags;
+
+SEC("ksyscall/splice")
+int BPF_KSYSCALL(splice_enter, int fd_in, loff_t *off_in, int fd_out,
+ loff_t *off_out, size_t len, unsigned int flags)
{
pid_t pid = bpf_get_current_pid_tgid() >> 32;
if (pid != filter_pid)
return 0;
- mmap_addr = (__u64)addr;
- mmap_length = length;
- mmap_prot = prot;
- mmap_flags = flags;
- mmap_fd = fd;
- mmap_offset = offset;
+ splice_fd_in = fd_in;
+ splice_off_in = (__u64)off_in;
+ splice_fd_out = fd_out;
+ splice_off_out = (__u64)off_out;
+ splice_len = len;
+ splice_flags = flags;
return 0;
}
Signature · 4 lines
2.39.0 Best regards, Ilya
Re: [PATCH bpf-next 00/25] libbpf: extend [ku]probe and syscall argument tracing support
Quoted 133 lines · Ilya Leoshkevich
Quoted 121 lines · Ilya Leoshkevich
Quoted 120 lines · Ilya Leoshkevich
Quoted 107 lines · Andrii Nakryiko
This patch set fixes and extends libbpf's
bpf_tracing.hsupport for
tracing
arguments of kprobes/uprobes, and syscall as a special case.Depending on the architecture, anywhere between 3 and 8 arguments can
be
passed to a function in registers (so relevant to kprobes and uprobes), but
before this patch set libbpf's macros inbpf_tracing.honly supported
up to
5 arguments, which is limiting in practice. This patch set extendsbpf_tracing.hto support up to 8 arguments, if architecture allows.
This
includes explicitPT_REGS_PARMx()macro family, as well asBPF_KPROBE()macro.Now, with tracing syscall arguments situation is sometimes quite different.
For a lot of architectures syscall argument passing through registers
differs
from function call sequence at least a little. For i386 it differs
*a
lot*.
This patch set addresses this issue across all currently supported
architectures and hopefully fixes existing issues. syscall(2) manpage
defines
that either 6 or 7 arguments can be supported, depending on architecture, so
libbpf defines 6 or 7 registers per architecture to be used to fetch
syscall
arguments.Also,
BPF_UPROBEandBPF_URETPROBEare introduced as part of this patch set.
They are aliases forBPF_KPROBEandBPF_KRETPROBE(as mechanics of
argument
fetching of kernel functions and user-space functions are identical),
but it
allows BPF users to have less confusing BPF-side code when working
with
uprobes.For both sets of changes selftests are extended to test these new register
definitions to architecture-defined limits. Unfortunately I don't have ability
to test it on all architectures, and BPF CI only tests 3 architecture
(x86-64,
arm64, and s390x), so it would be greatly appreciated if CC'ed people
can help
review and test changes on architectures they are familiar with (and
maybe
have direct access to for testing). Thank you.Cc Alan Maguire <[email protected]>Cc Ilya Leoshkevich <[email protected]>Cc Pu Lehui <[email protected]>Cc Hengqi Chen <[email protected]>Cc Vladimir Isaev <[email protected]>Cc Björn Töpel <[email protected]>Cc Kenta Tada <[email protected]>Cc Florent Revest <[email protected]>Andrii Nakryiko (25):
libbpf: add support for fetching up to 8 arguments in kprobes
libbpf: add 6th argument support for x86-64 inbpf_tracing.h
libbpf: fix arm and arm64 specs inbpf_tracing.h
libbpf: complete mips spec inbpf_tracing.h
libbpf: complete powerpc spec inbpf_tracing.h
libbpf: complete sparc spec inbpf_tracing.h
libbpf: complete riscv arch spec inbpf_tracing.h
libbpf: fix and complete ARC spec inbpf_tracing.h
libbpf: complete LoongArch (loongarch) spec inbpf_tracing.h
libbpf: addBPF_UPROBEandBPF_URETPROBEmacro aliases selftests/bpf: validate arch-specific argument registers limits
libbpf: improve syscall tracing support inbpf_tracing.h
libbpf: define x86-64 syscall regs spec inbpf_tracing.h
libbpf: define i386 syscall regs spec inbpf_tracing.h
libbpf: define s390x syscall regs spec inbpf_tracing.h
libbpf: define arm syscall regs spec inbpf_tracing.h
libbpf: define arm64 syscall regs spec inbpf_tracing.h
libbpf: define mips syscall regs spec inbpf_tracing.h
libbpf: define powerpc syscall regs spec inbpf_tracing.h
libbpf: define sparc syscall regs spec inbpf_tracing.h
libbpf: define riscv syscall regs spec inbpf_tracing.h
libbpf: define arc syscall regs spec inbpf_tracing.h
libbpf: define loongarch syscall regs spec inbpf_tracing.hselftests/bpf: add 6-argument syscall tracing test
libbpf: clean up now not needed __PT_PARM{1-6}_SYSCALL_REG
defaultsQuoted 10 lines
tools/lib/bpf/bpf_tracing.h | 301 +++++++++++++++- -- .../bpf/prog_tests/test_bpf_syscall_macro.c | 18 +- .../bpf/prog_tests/uprobe_autoattach.c | 33 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 25 ++ .../selftests/bpf/progs/bpf_syscall_macro.c | 26 ++ .../bpf/progs/test_uprobe_autoattach.c | 48 ++- 6 files changed, 405 insertions(+), 46 deletions(-)With the following fixup for 24/25:
[...]
Quoted 6 lines
Quoted 1 line
While the above fixup works, I realized that it's ugly. It's better to
admit that mmap andold_mmapare different syscalls and create a different probe, even if it means duplicating pid filtering code:
Quoted 5 lines
[...]
Sorry, I'm being dense. Both fixups defeat the purpose of having this test, because they don't use all 6 register arguments. We need to choose a different syscall; I believe
splice()fits the bill. The other
nice, thanks for digging that up :) I've applied your suggested changes (and added Suggested-by tag), thanks! Let's hope v2 will make it to patchworks and we'll get BPF CI to test all this properly.
Quoted 133 lines
alternatives that I rejected were:
-
clone()- argument order is messy;
-recvfrom()- s390x uses socketcall instead;
-ipc()- doesn't seem to be available on aarch64.The following worked for me:
diff --git
a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.cb/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.cindexe18dd82eb801..2900c5e9a016100644tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c +10
-13@@ -1,20 +1,22 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright 2022 Sony Group Corporation */ +#define _GNU_SOURCE +#include <fcntl.h> #include <sys/prctl.h> -#include <sys/mman.h> #include <test_progs.h> #include "bpf_syscall_macro.skel.h" void test_bpf_syscall_macro (void ) {struct bpf_syscall_macro *skel =NULL ; -int err, page_size =getpagesize (); +int err;int exp_arg1 =1001 ;unsigned long exp_arg2 =12 ;unsigned long exp_arg3 =13 ;unsigned long exp_arg4 =14 ;unsigned long exp_arg5 =15 ; -void *r; +loff_t off_in, off_out; +ssize_t r;/* check whether it can open program */ skel =bpf_syscall_macro__open ();@@ -71,18 +73,17 @@ void test_bpf_syscall_macro(void)ASSERT_EQ (skel->bss->arg4_syscall, exp_arg4,"BPF_KPROBE_SYSCALL_arg4" );ASSERT_EQ (skel->bss->arg5_syscall, exp_arg5,"BPF_KPROBE_SYSCALL_arg5" ); - r =mmap ((void *)0x12340000 ,3 * page_size,PROT_READ |PROT_WRITE , -MAP_PRIVATE ,-42 ,5 * page_size); + r =splice (-42 , &off_in,42 , &off_out,0x12340000 ,SPLICE_F_NONBLOCK ); err = -errno; -ASSERT_EQ (r,MAP_FAILED ,"mmap_res" ); -ASSERT_EQ (err, -EBADF ,"mmap_err" ); +ASSERT_EQ (r,-1 ,"splice_res" ); +ASSERT_EQ (err, -EBADF ,"splice_err" ); -ASSERT_EQ (skel->bss->mmap_addr,0x12340000 ,"mmap_arg1" ); -ASSERT_EQ (skel->bss->mmap_length,3 * page_size,"mmap_arg2" ); -ASSERT_EQ (skel->bss->mmap_prot,PROT_READ |PROT_WRITE , "mmap_arg3"); -ASSERT_EQ (skel->bss->mmap_flags,MAP_PRIVATE ,"mmap_arg4" ); -ASSERT_EQ (skel->bss->mmap_fd,-42 ,"mmap_arg5" ); -ASSERT_EQ (skel->bss->mmap_offset,5 * page_size,"mmap_arg6" ); +ASSERT_EQ (skel->bss->splice_fd_in,-42 ,"splice_arg1" ); + ASSERT_EQ(skel->bss->splice_off_in, (__u64)&off_in,"
splice_arg2");tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c +2
-0+ASSERT_EQ (skel->bss->splice_fd_out,42 ,"splice_arg3" ); + ASSERT_EQ(skel->bss->splice_off_out, (__u64)&off_out,"
splice_arg4");tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c +2
-0+ASSERT_EQ (skel->bss->splice_len,0x12340000 ,"splice_arg5" ); + ASSERT_EQ(skel->bss->splice_flags, SPLICE_F_NONBLOCK,"
splice_arg6");cleanup:
bpf_syscall_macro__destroy(skel);tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +16
-16@@ -81,28 +81,28 @@ int BPF_KSYSCALL(prctl_enter, int option, unsignedlong arg2, return 0; } -__u64 mmap_addr; -__u64 mmap_length; -__u64 mmap_prot; -__u64 mmap_flags; -__u64 mmap_fd; -__u64 mmap_offset; - -SEC("ksyscall/mmap") -int BPF_KSYSCALL (mmap_enter ,void *addr,size_t length,int prot,int flags, -int fd,off_t offset) +__u64 splice_fd_in; +__u64 splice_off_in; +__u64 splice_fd_out; +__u64 splice_off_out; +__u64 splice_len; +__u64 splice_flags; + +SEC("ksyscall/splice") +int BPF_KSYSCALL (splice_enter ,int fd_in,loff_t *off_in,int fd_out, +loff_t *off_out,size_t len,unsigned int flags) {pid_t pid =bpf_get_current_pid_tgid () >>32 ;if (pid != filter_pid)return 0 ; - mmap_addr = (__u64 )addr; - mmap_length = length; - mmap_prot = prot; - mmap_flags = flags; - mmap_fd = fd; - mmap_offset = offset; + splice_fd_in = fd_in; + splice_off_in = (__u64 )off_in; + splice_fd_out = fd_out; + splice_off_out = (__u64 )off_out; + splice_len = len; + splice_flags = flags;return 0;}
--
2.39.0Best regards,
Ilya
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ilya Leoshkevich
Acked-byRe: [PATCH bpf-next 15/25] libbpf: define s390x syscall regs spec in bpf_tracing.h
Quoted 16 lines · Andrii Nakryiko
Define explicit table of registers used for syscall argument passing. Note that we need custom overrides for PT_REGS_PARM1_[CORE_]SYSCALL macros due to the need to use BPF CO-RE and custom local
pt_regsdefinitions to fetchorig_gpr2, storing 1st argument.Signed-off-by Andrii Nakryiko <[email protected]>---
tools/lib/bpf/bpf_tracing.h | 17 +++++++++++++++--1 file changed, 15 insertions(+), 2 deletions(-)tools/lib/bpf/bpf_tracing.h +0
-0@@ -157,6 +157,10 @@
Quoted 8 lines
#elifdefined(bpf_target_s390)
+/*
+ *
https://en.wikipedia.org/wiki/Calling_convention#IBM_System/360_and_successors
+ */
+
Here is the more official ABI spec:
https://github.com/IBM/s390x-abi/releases/download/v1.6/lzsabi_s390x.pdf
Quoted 27 lines
struct
pt_regs___s390{
unsigned longorig_gpr2;
};tools/lib/bpf/bpf_tracing.h +11
-0@@ -168,13 +172,22 @@ struct pt_regs___s390 { #define __PT_PARM3_REG gprs[4] #define __PT_PARM4_REG gprs[5] #define __PT_PARM5_REG gprs[6] + +#define __PT_PARM1_SYSCALL_REG orig_gpr2 +#define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG +#define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG +#define __PT_PARM4_SYSCALL_REG __PT_PARM4_REG +#define __PT_PARM5_SYSCALL_REG __PT_PARM5_REG +#define __PT_PARM6_SYSCALL_REG gprs[7] +#define PT_REGS_PARM1_SYSCALL (x) PT_REGS_PARM1_CORE_SYSCALL(x) +#define PT_REGS_PARM1_CORE_SYSCALL (x) \ + BPF_CORE_READ((const struct pt_regs___s390 *)(x), __PT_PARM1_SYSCALL_REG) + #define __PT_RET_REG gprs[14] #define __PT_FP_REG gprs[11] /* Works only with
CONFIG_FRAME_POINTER*/
#define__PT_RC_REGgprs[2]
#define__PT_SP_REGgprs[15]
#define__PT_IP_REGpsw.addrtools/lib/bpf/bpf_tracing.h +0
-2-#define PT_REGS_PARM1_SYSCALL (x) PT_REGS_PARM1_CORE_SYSCALL(x) -#define PT_REGS_PARM1_CORE_SYSCALL (x) BPF_CORE_READ((const struct
Quoted 4 lines
pt_regs___s390*)(x),orig_gpr2)
#elifdefined(bpf_target_arm)
Re: [PATCH bpf-next 15/25] libbpf: define s390x syscall regs spec in bpf_tracing.h
Quoted 29 lines · Ilya Leoshkevich
Quoted 21 lines · Andrii Nakryiko
Define explicit table of registers used for syscall argument passing. Note that we need custom overrides for PT_REGS_PARM1_[CORE_]SYSCALL macros due to the need to use BPF CO-RE and custom local
pt_regsdefinitions to fetchorig_gpr2, storing 1st argument.Signed-off-by Andrii Nakryiko <[email protected]>--- tools/lib/bpf/bpf_tracing.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)tools/lib/bpf/bpf_tracing.h +2
-0@@ -157,6 +157,10 @@#elif defined(bpf_target_s390) +/* +* Here is the more official ABI spec:
thanks, updated link in the comment (btw, I was surprised how hard it was sometimes to find such official ABI specs)
Quoted 33 lines
Quoted 29 lines
struct pt_regs___s390 { unsigned long orig_gpr2;};
tools/lib/bpf/bpf_tracing.h +11
-0@@ -168,13 +172,22 @@ struct pt_regs___s390 {#define __PT_PARM3_REG gprs[4]#define __PT_PARM4_REG gprs[5]#define __PT_PARM5_REG gprs[6] + +#define __PT_PARM1_SYSCALL_REG orig_gpr2 +#define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG +#define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG +#define __PT_PARM4_SYSCALL_REG __PT_PARM4_REG +#define __PT_PARM5_SYSCALL_REG __PT_PARM5_REG +#define __PT_PARM6_SYSCALL_REG gprs[7] +#define PT_REGS_PARM1_SYSCALL (x) PT_REGS_PARM1_CORE_SYSCALL(x) +#define PT_REGS_PARM1_CORE_SYSCALL (x) \ + BPF_CORE_READ((const struct pt_regs___s390 *)(x), __PT_PARM1_SYSCALL_REG) +#define __PT_RET_REG gprs[14]#define __PT_FP_REG gprs[11]/* Works only with
CONFIG_FRAME_POINTER*/
#define__PT_RC_REGgprs[2]
#define__PT_SP_REGgprs[15]
#define__PT_IP_REGpsw.addrtools/lib/bpf/bpf_tracing.h +0
-2-#define PT_REGS_PARM1_SYSCALL (x) PT_REGS_PARM1_CORE_SYSCALL(x) -#define PT_REGS_PARM1_CORE_SYSCALL (x) BPF_CORE_READ((const struct
pt_regs___s390*)(x),orig_gpr2)Quoted 2 lines
#elif
defined(bpf_target_arm)Acked-by Ilya Leoshkevich <[email protected]>