netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH HID for-next v1 0/9] HID-BPF LLVM fixes, no more hacks
@ 2023-01-06 10:23 Benjamin Tissoires
  2023-01-06 10:23 ` [PATCH HID for-next v1 1/9] selftests: hid: add vmtest.sh Benjamin Tissoires
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Benjamin Tissoires @ 2023-01-06 10:23 UTC (permalink / raw)
  To: Greg KH, Jiri Kosina, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Dmitry Torokhov
  Cc: Tero Kristo, linux-kernel, linux-input, netdev, bpf,
	linux-kselftest, Benjamin Tissoires

Hi,

So this is the fix for the bug that actually prevented me to integrate
HID-BPF in v6.2.

While testing the code base with LLVM, I realized that clang was smarter
than I expected it to be, and it sometimes inlined a function or not
depending on the branch. This lead to segfaults because my current code
in linux-next is messing up the bpf programs refcounts assuming that I
had enough observability over the kernel.

So I came back to the drawing board and realized that what I was missing
was exactly a bpf_link, to represent the attachment of a bpf program to
a HID device. This is the bulk of the series, in patch 6/9.

The other patches are cleanups, tests, and also the addition of the
vmtests.sh script I run locally, largely inspired by the one in the bpf
selftests dir. This allows very fast development of HID-BPF, assuming we
have tests that cover the bugs :)

Cheers,
Benjamin


Benjamin Tissoires (9):
  selftests: hid: add vmtest.sh
  selftests: hid: allow to compile hid_bpf with LLVM
  selftests: hid: attach/detach 2 bpf programs, not just one
  selftests: hid: ensure the program is correctly pinned
  selftests: hid: prepare tests for HID_BPF API change
  HID: bpf: rework how programs are attached and stored in the kernel
  selftests: hid: enforce new attach API
  HID: bpf: clean up entrypoint
  HID: bpf: reorder BPF registration

 Documentation/hid/hid-bpf.rst                 |  12 +-
 drivers/hid/bpf/entrypoints/entrypoints.bpf.c |   9 -
 .../hid/bpf/entrypoints/entrypoints.lskel.h   | 188 ++++--------
 drivers/hid/bpf/hid_bpf_dispatch.c            |  28 +-
 drivers/hid/bpf/hid_bpf_dispatch.h            |   3 -
 drivers/hid/bpf/hid_bpf_jmp_table.c           | 116 +++----
 include/linux/hid_bpf.h                       |   7 +
 tools/testing/selftests/hid/.gitignore        |   1 +
 tools/testing/selftests/hid/Makefile          |  10 +-
 tools/testing/selftests/hid/config.common     | 241 +++++++++++++++
 tools/testing/selftests/hid/config.x86_64     |   4 +
 tools/testing/selftests/hid/hid_bpf.c         |  32 +-
 tools/testing/selftests/hid/progs/hid.c       |  13 +
 tools/testing/selftests/hid/vmtest.sh         | 284 ++++++++++++++++++
 14 files changed, 724 insertions(+), 224 deletions(-)
 create mode 100644 tools/testing/selftests/hid/config.common
 create mode 100644 tools/testing/selftests/hid/config.x86_64
 create mode 100755 tools/testing/selftests/hid/vmtest.sh

-- 
2.38.1


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

end of thread, other threads:[~2023-01-11  9:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 10:23 [PATCH HID for-next v1 0/9] HID-BPF LLVM fixes, no more hacks Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 1/9] selftests: hid: add vmtest.sh Benjamin Tissoires
2023-01-09 17:46   ` sdf
2023-01-09 17:56     ` sdf
2023-01-10  9:43       ` Benjamin Tissoires
2023-01-10 18:52         ` Stanislav Fomichev
2023-01-06 10:23 ` [PATCH HID for-next v1 2/9] selftests: hid: allow to compile hid_bpf with LLVM Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 3/9] selftests: hid: attach/detach 2 bpf programs, not just one Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 4/9] selftests: hid: ensure the program is correctly pinned Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 5/9] selftests: hid: prepare tests for HID_BPF API change Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 6/9] HID: bpf: rework how programs are attached and stored in the kernel Benjamin Tissoires
2023-01-11  6:10   ` Alexei Starovoitov
2023-01-11  9:47     ` Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 7/9] selftests: hid: enforce new attach API Benjamin Tissoires
2023-01-06 10:23 ` [PATCH HID for-next v1 8/9] HID: bpf: clean up entrypoint Benjamin Tissoires
2023-01-06 13:41   ` kernel test robot
2023-01-06 14:37     ` Benjamin Tissoires
2023-01-06 14:22   ` kernel test robot
2023-01-06 10:23 ` [PATCH HID for-next v1 9/9] HID: bpf: reorder BPF registration Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).