All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v4 00/14] Fix accessing syscall arguments
@ 2022-02-08  5:16 Ilya Leoshkevich
  2022-02-08  5:16 ` [PATCH bpf-next v4 01/14] selftests/bpf: Fix an endianness issue in bpf_syscall_macro test Ilya Leoshkevich
                   ` (13 more replies)
  0 siblings, 14 replies; 35+ messages in thread
From: Ilya Leoshkevich @ 2022-02-08  5:16 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Alexander Gordeev, Catalin Marinas, Michael Ellerman,
	Paul Walmsley, Naveen N . Rao, Mark Rutland
  Cc: bpf, Ilya Leoshkevich

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/20220201234200.1836443-1-iii@linux.ibm.com/
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/20220204041955.1958263-1-iii@linux.ibm.com/
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/20220204145018.1983773-1-iii@linux.ibm.com/
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).

Tested on x86_64, s390x, arm64, ppc64el and riscv64 in QEMU.

+cc Mark.

Ilya Leoshkevich (14):
  selftests/bpf: Fix an endianness issue in bpf_syscall_macro test
  selftests/bpf: Fix a potential offsetofend redefinition in
    test_cls_redirect
  selftests/bpf: Compile bpf_syscall_macro test also with user headers
  libbpf: Fix a typo in bpf_tracing.h
  libbpf: Generalize overriding syscall parameter access macros
  libbpf: Add PT_REGS_SYSCALL_REGS macro
  selftests/bpf: Use PT_REGS_SYSCALL_REGS in bpf_syscall_macro
  libbpf: Use struct pt_regs when compiling with kernel headers
  libbpf: Fix riscv register names
  libbpf: Move data structure manipulation macros to
    bpf_common_helpers.h
  libbpf: Fix accessing the first syscall argument on s390
  s390: add a comment that warns that orig_gpr2 should not be moved
  libbpf: Fix accessing the first syscall argument on arm64
  arm64: add a comment that warns that orig_x0 should not be moved

 arch/arm64/include/asm/ptrace.h               |   4 +
 arch/s390/include/asm/ptrace.h                |   4 +
 tools/lib/bpf/Makefile                        |   2 +-
 tools/lib/bpf/bpf_common_helpers.h            |  30 +++++
 tools/lib/bpf/bpf_helpers.h                   |  15 +--
 tools/lib/bpf/bpf_tracing.h                   | 107 +++++++++++++++---
 tools/testing/selftests/bpf/bpf_util.h        |  10 +-
 ...acro.c => test_bpf_syscall_macro_common.h} |   8 +-
 .../test_bpf_syscall_macro_kernel.c           |  13 +++
 .../prog_tests/test_bpf_syscall_macro_user.c  |  13 +++
 tools/testing/selftests/bpf/progs/bpf_misc.h  |   4 -
 ...all_macro.c => bpf_syscall_macro_common.h} |  15 ++-
 .../bpf/progs/bpf_syscall_macro_kernel.c      |   4 +
 .../bpf/progs/bpf_syscall_macro_user.c        |  10 ++
 .../selftests/bpf/progs/test_cls_redirect.c   |   2 +
 .../selftests/bpf/progs/test_probe_user.c     |   8 +-
 16 files changed, 191 insertions(+), 58 deletions(-)
 create mode 100644 tools/lib/bpf/bpf_common_helpers.h
 rename tools/testing/selftests/bpf/prog_tests/{test_bpf_syscall_macro.c => test_bpf_syscall_macro_common.h} (89%)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro_kernel.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro_user.c
 rename tools/testing/selftests/bpf/progs/{bpf_syscall_macro.c => bpf_syscall_macro_common.h} (79%)
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_syscall_macro_kernel.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_syscall_macro_user.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2022-02-08 23:43 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08  5:16 [PATCH bpf-next v4 00/14] Fix accessing syscall arguments Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 01/14] selftests/bpf: Fix an endianness issue in bpf_syscall_macro test Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 02/14] selftests/bpf: Fix a potential offsetofend redefinition in test_cls_redirect Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 03/14] selftests/bpf: Compile bpf_syscall_macro test also with user headers Ilya Leoshkevich
2022-02-08 22:06   ` Andrii Nakryiko
2022-02-08 23:11     ` Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 04/14] libbpf: Fix a typo in bpf_tracing.h Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 05/14] libbpf: Generalize overriding syscall parameter access macros Ilya Leoshkevich
2022-02-08 22:05   ` Andrii Nakryiko
2022-02-08 23:08     ` Ilya Leoshkevich
2022-02-08 23:21       ` Andrii Nakryiko
2022-02-08 23:30         ` Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 06/14] libbpf: Add PT_REGS_SYSCALL_REGS macro Ilya Leoshkevich
2022-02-08 22:08   ` Andrii Nakryiko
2022-02-08 23:26     ` Ilya Leoshkevich
2022-02-08 23:43       ` Andrii Nakryiko
2022-02-08  5:16 ` [PATCH bpf-next v4 07/14] selftests/bpf: Use PT_REGS_SYSCALL_REGS in bpf_syscall_macro Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 08/14] libbpf: Use struct pt_regs when compiling with kernel headers Ilya Leoshkevich
2022-02-08 22:12   ` Andrii Nakryiko
2022-02-08 23:35     ` Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 09/14] libbpf: Fix riscv register names Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 10/14] libbpf: Move data structure manipulation macros to bpf_common_helpers.h Ilya Leoshkevich
2022-02-08 22:14   ` Andrii Nakryiko
2022-02-08 23:37     ` Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 11/14] libbpf: Fix accessing the first syscall argument on s390 Ilya Leoshkevich
2022-02-08 13:10   ` Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 12/14] s390: add a comment that warns that orig_gpr2 should not be moved Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 13/14] libbpf: Fix accessing the first syscall argument on arm64 Ilya Leoshkevich
2022-02-08  5:16 ` [PATCH bpf-next v4 14/14] arm64: add a comment that warns that orig_x0 should not be moved Ilya Leoshkevich
2022-02-08 19:25   ` Alexei Starovoitov
2022-02-08 19:46     ` Ilya Leoshkevich
2022-02-08 21:11       ` Alexei Starovoitov
2022-02-08 21:46         ` Ilya Leoshkevich
2022-02-08 22:23           ` Andrii Nakryiko
2022-02-08 23:39             ` Ilya Leoshkevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.