| 8d355b56 | 28-Nov-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: fix kfunc inclusions with newer bpftool
bpftool now embeds the kfuncs definitions directly in the generated vmlinux.h
This is great, but because the selftests dir might be compiled w
selftests/hid: fix kfunc inclusions with newer bpftool
bpftool now embeds the kfuncs definitions directly in the generated vmlinux.h
This is great, but because the selftests dir might be compiled with HID_BPF disabled, we have no guarantees to be able to compile the sources with the generated kfuncs.
If we have the kfuncs, because we have the `__not_used` hack, the newly defined kfuncs do not match the ones from vmlinux.h and things go wrong.
Prevent vmlinux.h to define its kfuncs and also add the missing `__weak` symbols for our custom kfuncs definitions
Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| fe05c40c | 15-Oct-2024 |
Yun Lu <[email protected]> |
selftest: hid: add the missing tests directory
Commit 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh") has added the run-hid-tools-tests.sh script for it to be installed, but I for
selftest: hid: add the missing tests directory
Commit 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh") has added the run-hid-tools-tests.sh script for it to be installed, but I forgot to add the tests directory together.
If running the test case without the tests directory, will results in the following error message:
make -C tools/testing/selftests/ TARGETS=hid install \ INSTALL_PATH=$KSFT_INSTALL_PATH cd $KSFT_INSTALL_PATH ./run_kselftest.sh -t hid:hid-core.sh
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown. Plugin: helpconfig, Hook: pytest_cmdline_parse UsageError: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...] __main__.py: error: unrecognized arguments: --udevd inifile: None rootdir: /root/linux/kselftest_install/hid
In fact, the run-hid-tools-tests.sh script uses the scripts in the tests directory to run tests. The tests directory also needs to be added to be installed.
Fixes: ffb85d5c9e80 ("selftests: hid: import hid-tools hid-core tests") Cc: [email protected] Signed-off-by: Yun Lu <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| e14e0eae | 01-Oct-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add test for assigning a given device to hid-generic
We use a well known VID/PID on a driver that doesn't need to talk to the device, ensures we created the device against the target
selftests/hid: add test for assigning a given device to hid-generic
We use a well known VID/PID on a driver that doesn't need to talk to the device, ensures we created the device against the target driver, then load our program and ensure we have unbound to this driver and use hid-generic instead.
Reviewed-by: Peter Hutterer <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| 4fb41dfd | 01-Oct-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: cleanup C tests by adding a common struct uhid_device
Allows to have an abstract class uhid_device which handles all of the uhid part without having to mess up with individual fds.
s
selftests/hid: cleanup C tests by adding a common struct uhid_device
Allows to have an abstract class uhid_device which handles all of the uhid part without having to mess up with individual fds.
struct attach_prog_args is now never used in hid_bpf.c, so drop it as well
Acked-by: Shuah Khan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| 321f7798 | 27-Aug-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: Add HIDIOCREVOKE tests
Add 4 tests for the new revoke ioctl, for read/write/ioctl and poll.
Reviewed-by: Peter Hutterer <[email protected]> Link: https://patch.msgid.link/2024
selftests/hid: Add HIDIOCREVOKE tests
Add 4 tests for the new revoke ioctl, for read/write/ioctl and poll.
Reviewed-by: Peter Hutterer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| 8163892a | 27-Aug-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: Add initial hidraw tests skeleton
Largely inspired from hid_bpf.c for the fixture setup.
Create a couple of tests for hidraw: - create a uhid device and check if the fixture is worki
selftests/hid: Add initial hidraw tests skeleton
Largely inspired from hid_bpf.c for the fixture setup.
Create a couple of tests for hidraw: - create a uhid device and check if the fixture is working properly - inject one uhid event and read it through hidraw
These tests are not that useful for now, but will be once we start adding the ioctl and BPFs to revoke the hidraw node.
Reviewed-by: Peter Hutterer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| facdbdfe | 23-Jul-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add test for attaching multiple time the same struct_ops
Turns out that we would en up in a bad state if we attempt to attach twice the same HID-BPF struct_ops, so have a test for it.
selftests/hid: add test for attaching multiple time the same struct_ops
Turns out that we would en up in a bad state if we attempt to attach twice the same HID-BPF struct_ops, so have a test for it.
Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| f64c1a45 | 23-Jul-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: disable struct_ops auto-attach
Since commit 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton"), libbpf automatically calls bpf_map__attach_struct_ops() on every
selftests/hid: disable struct_ops auto-attach
Since commit 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton"), libbpf automatically calls bpf_map__attach_struct_ops() on every struct_ops it sees in the bpf object. The problem is that our test bpf object has many of them but only one should be manually loaded at a time, or we end up locking the syscall.
Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| fcdf830e | 01-Jul-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: ensure CKI can compile our new tests on old kernels
In the same way than commit ae7487d112cf ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose str
selftests/hid: ensure CKI can compile our new tests on old kernels
In the same way than commit ae7487d112cf ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose struct hid_bpf_ops when it's not available in vmlinux.h.
So unexpose an eventual struct hid_bpf_ops, include vmlinux.h, and re-export struct hid_bpf_ops.
Fixes: d7696738d66b ("selftests/hid: convert the hid_bpf selftests with struct_ops") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| d3e15189 | 26-Jun-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add an infinite loop test for hid_bpf_try_input_report
We don't want this call to allow an infinite loop in HID-BPF, so let's have some tests.
Link: https://patch.msgid.link/20240626
selftests/hid: add an infinite loop test for hid_bpf_try_input_report
We don't want this call to allow an infinite loop in HID-BPF, so let's have some tests.
Link: https://patch.msgid.link/[email protected] Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| fe8d561d | 26-Jun-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add wq test for hid_bpf_input_report()
Now that bpf_wq is available, we can write a test with it. Having hid_bpf_input_report() waiting for the device means that we can directly call
selftests/hid: add wq test for hid_bpf_input_report()
Now that bpf_wq is available, we can write a test with it. Having hid_bpf_input_report() waiting for the device means that we can directly call it, and we get that event when the device is ready.
Link: https://patch.msgid.link/[email protected] Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| 3ac83fcd | 26-Jun-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add tests for hid_hw_output_report HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the output_report to happen - second, we make sure that we can detect that a
selftests/hid: add tests for hid_hw_output_report HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the output_report to happen - second, we make sure that we can detect that a given hidraw client was actually doing the request, and for that client only, call ourself hid_bpf_hw_output_report(), returning a custom value - last, we ensure that we can not loop between hooks for hid_hw_output_report() and manual calls to hid_bpf_hw_output_report() from that same hook
Link: https://patch.msgid.link/[email protected] Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|
| 015a4a2a | 26-Jun-2024 |
Benjamin Tissoires <[email protected]> |
selftests/hid: add tests for hid_hw_raw_request HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the raw_request to happen - second, we make sure that we can detect that a give
selftests/hid: add tests for hid_hw_raw_request HID-BPF hooks
We add 3 new tests: - first, we make sure we can prevent the raw_request to happen - second, we make sure that we can detect that a given hidraw client was actually doing the request, and for that client only, call ourself hid_bpf_hw_request(), returning a custom value - last, we ensure that we can not loop between hooks for hid_hw_raw_request() and manual calls to hid_bpf_hw_request() from that hook
Link: https://patch.msgid.link/[email protected] Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
show more ...
|