Skip to content

Fix accessing syscall arguments

Ilya Leoshkevich bpf 4 versions – Applied

Status from this message: Applied to bpf-next with few adjustments in patches 8-10, thanks. I'll

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest10 patches 4 repliesApplied 10/10
  2. v414 patches 20 repliesSuperseded
  3. v311 patches 8 repliesApplied 11/11
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v210 patches8 repliesSuperseded

Changes in v5 from the cover letter

* Go back to v3.
* Do not touch arch headers.
* Use CO-RE struct flavors to access orig_x0 and orig_gpr2.
* Fail compilation if non-CO-RE macros are used to access the first syscall parameter on arm64 and s390.
* Fix accessing frame pointer on riscv.

Patches in v5 All 10 applied

#Subject and filesSizeRepliesApplied
1/10selftests/bpf: Fix an endianness issue in bpf_syscall_macro testtools/testing/selftests/bpf/progs/bpf_syscall_macro.c+4 -10 repliesApplied
2/10libbpf: Add PT_REGS_SYSCALL_REGS macrotools/lib/bpf/bpf_tracing.h+10 -00 repliesApplied
3/10selftests/bpf: Use PT_REGS_SYSCALL_REGS in bpf_syscall_macrotools/testing/selftests/bpf/progs/bpf_syscall_macro.c+1 -10 repliesApplied
4/10libbpf: Fix accessing syscall arguments on powerpctools/lib/bpf/bpf_tracing.h+2 -00 repliesApplied
5/10libbpf: Fix riscv register namestools/lib/bpf/bpf_tracing.h+2 -20 repliesApplied
6/10libbpf: Fix accessing syscall arguments on riscvtools/lib/bpf/bpf_tracing.h+2 -00 repliesApplied
7/10selftests/bpf: Skip test_bpf_syscall_macro:syscall_arg1 on arm64 and s390tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c tools/testing/selftests/bpf/progs/bpf_syscall_macro.c+7 -10 repliesApplied
8/10libbpf: Allow overriding PT_REGS_PARM1{_CORE}_SYSCALLtools/lib/bpf/bpf_tracing.h+4 -01 replyApplied
9/10libbpf: Fix accessing the first syscall argument on arm64tools/lib/bpf/bpf_tracing.h+10 -01 replyApplied
10/10libbpf: Fix accessing the first syscall argument on s390tools/lib/bpf/bpf_tracing.h+10 -01 replyApplied

Reviews trailers per patch

None of the 10 patches has a Reviewed-by or Acked-by.

PatchNaveen N. Rao
1/10
2/10
3/10
4/10T-b
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH bpf-next v5 00/10] Fix accessing syscall arguments

libbpf now has macros to access syscall arguments in an architecture-agnostic manner, but unfortunately they have a number of issues on non-Intel arches, which this series aims to fix.

v1: https://lore.kernel.org/bpf/[email protected]/
v1 -> v2:
* Put orig_gpr2 in place of args[1] on s390 (Vasily).
* Fix arm64, powerpc and riscv (Heiko).

v2: https://lore.kernel.org/bpf/[email protected]/
v2 -> v3:
* Undo args[1] change (Andrii).
* Rename PT_REGS_SYSCALL to PT_REGS_SYSCALL_REGS (Andrii).
* Split the riscv patch (Andrii).

v3: https://lore.kernel.org/bpf/[email protected]/
v3 -> v4:
* Undo arm64's and s390's user_pt_regs changes.
* Use struct pt_regs when vmlinux.h is available (Andrii).
* Use offsetofend for accessing orig_gpr2 and orig_x0 (Andrii).
* Move libbpf's copy of offsetofend to a new header.
* Fix riscv's __PT_FP_REG.
* Use PT_REGS_SYSCALL_REGS in test_probe_user.c.
* Test bpf_syscall_macro with userspace headers.
* Use Naveen's suggestions and code in patches 5 and 6.
* Add warnings to arm64's and s390's ptrace.h (Andrii).

v4: https://lore.kernel.org/bpf/[email protected]/
v4 -> v5:
* Go back to v3.
* Do not touch arch headers.
* Use CO-RE struct flavors to access orig_x0 and orig_gpr2.
* Fail compilation if non-CO-RE macros are used to access the first syscall parameter on arm64 and s390.
* Fix accessing frame pointer on riscv.

Ilya Leoshkevich (10):
selftests/bpf: Fix an endianness issue in bpf_syscall_macro test
libbpf: Add PT_REGS_SYSCALL_REGS macro
selftests/bpf: Use PT_REGS_SYSCALL_REGS in bpf_syscall_macro
libbpf: Fix accessing syscall arguments on powerpc
libbpf: Fix riscv register names
libbpf: Fix accessing syscall arguments on riscv selftests/bpf: Skip test_bpf_syscall_macro:syscall_arg1 on arm64 and

    s390

libbpf: Allow overriding PT_REGS_PARM1{_CORE}_SYSCALL
libbpf: Fix accessing the first syscall argument on arm64
libbpf: Fix accessing the first syscall argument on s390

 tools/lib/bpf/bpf_tracing.h                   | 42 ++++++++++++++++++-
 .../bpf/prog_tests/test_bpf_syscall_macro.c   |  4 ++
 .../selftests/bpf/progs/bpf_syscall_macro.c   |  9 +++-
 3 files changed, 51 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1