| b6eb0228 | 01-Jul-2026 |
Trung Nguyen <trungnh@cystack.net> |
selftests/hid: multitouch: test a large ContactCountMaximum
Add a regression test for the out-of-bounds bit operations on struct mt_device.mt_io_flags.
A HID multitouch device can advertise a Conta
selftests/hid: multitouch: test a large ContactCountMaximum
Add a regression test for the out-of-bounds bit operations on struct mt_device.mt_io_flags.
A HID multitouch device can advertise a ContactCountMaximum far larger than the number of contacts a single report describes, up to 255. The driver used to keep the per-slot active state in the bits of a single unsigned long and index set_bit()/clear_bit() by the slot number, so such a device drove those operations out of bounds. The sticky-fingers release timer made it fatal: mt_release_contacts() cleared one bit per slot and overwrote the adjacent members of struct mt_device.
The new device advertises a ContactCountMaximum of 250 while exposing only a few finger collections (a large contact count cannot be expressed with one finger collection per contact within the HID descriptor size limit). The test sends a single contact and lets the 100ms sticky-fingers timer release it. A kernel without the fix panics in mt_release_contacts(); a fixed kernel reports the release cleanly.
Signed-off-by: Trung Nguyen <trungnh@cystack.net> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| eebbef7c | 23-Jun-2026 |
Yiyang Chen <chenyy23@mails.tsinghua.edu.cn> |
selftests/hid: Cover hid_bpf_get_data() size overflow
Add a HID-BPF regression check for hid_bpf_get_data() requests whose size would overflow when added to the offset.
The new rdesc fixup callback
selftests/hid: Cover hid_bpf_get_data() size overflow
Add a HID-BPF regression check for hid_bpf_get_data() requests whose size would overflow when added to the offset.
The new rdesc fixup callback asks for offset 2 and size ~0ULL, then records whether the helper returns NULL. A vulnerable kernel returns a non-NULL pointer because the runtime check wraps the addition. A fixed kernel rejects the request. The callback records the helper result without dereferencing any returned pointer.
The callback reports the helper result through BSS and returns 0 intentionally. hid_rdesc_fixup return values are consumed as report descriptor fixup results, so a positive test-result value would be interpreted as a replacement report descriptor size.
Also add KHDR_INCLUDES to the HID selftest build so hid_bpf.c sees the current kernel UAPI HID definitions on systems whose installed headers do not provide enum hid_report_type.
Fixes: 658ee5a64fcf ("HID: bpf: allocate data memory for device_event BPF programs") Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| 5d4c6c13 | 13-Mar-2026 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: fix compilation when bpf_wq and hid_device are not exported
This can happen in situations when CONFIG_HID_SUPPORT is set to no, or some complex situations where struct bpf_wq is not e
selftests/hid: fix compilation when bpf_wq and hid_device are not exported
This can happen in situations when CONFIG_HID_SUPPORT is set to no, or some complex situations where struct bpf_wq is not exported.
So do the usual dance of hiding them before including vmlinux.h, and then redefining them and make use of CO-RE to have the correct offsets.
Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202603111558.KLCIxsZB-lkp@intel.com/ Fixes: fe8d561db3e8 ("selftests/hid: add wq test for hid_bpf_input_report()") Cc: stable@vger.kernel.org Acked-by: Jiri Kosina <jkosina@suse.com> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| f287ba59 | 22-Dec-2025 |
Peter Hutterer <peter.hutterer@who-t.net> |
selftests/hid: add a test for the Digitizer/Button Type pressurepad
We have to resort to a bit of a hack: python-libevdev gets the properties from libevdev at module init time. If libevdev hasn't be
selftests/hid: add a test for the Digitizer/Button Type pressurepad
We have to resort to a bit of a hack: python-libevdev gets the properties from libevdev at module init time. If libevdev hasn't been rebuilt with the new property it won't be automatically populated. So we hack around this by constructing the property manually.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| 4f36fdab | 22-Dec-2025 |
Peter Hutterer <peter.hutterer@who-t.net> |
selftests/hid: use a enum class for the different button types
Instead of multiple spellings of a string-provided argument, let's make this a tad more type-safe and use an enum here.
And while we d
selftests/hid: use a enum class for the different button types
Instead of multiple spellings of a string-provided argument, let's make this a tad more type-safe and use an enum here.
And while we do this fix the two wrong devices: - elan_04f3_313a (HP ZBook Fury 15) is discrete button pad - dell_044e_1220 (Dell Precision 7740) is a discrete button pad
Equivalent hid-tools commit https://gitlab.freedesktop.org/libevdev/hid-tools/-/commit/8300a55bf4213c6a252cab8cb5b34c9ddb191625
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| 1d6628f7 | 22-Dec-2025 |
Peter Hutterer <peter.hutterer@who-t.net> |
selftests/hid: require hidtools 0.12
Not all our tests really require it but since it's likely pip-installed anyway it's trivial to require the new version, just in case we want to start cleaning up
selftests/hid: require hidtools 0.12
Not all our tests really require it but since it's likely pip-installed anyway it's trivial to require the new version, just in case we want to start cleaning up other bits.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|
| 8c62074f | 12-Sep-2025 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: hidraw: forge wrong ioctls and tests them
We also need coverage for when the malicious user is not using the proper ioctls definitions and tries to work around the driver.
Most of th
selftests/hid: hidraw: forge wrong ioctls and tests them
We also need coverage for when the malicious user is not using the proper ioctls definitions and tries to work around the driver.
Most of the scaffholding has been generated by claude-4-sonnet and then carefully reviewed.
Suggested-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
show more ...
|
| 1aee3a44 | 09-Jul-2025 |
Benjamin Tissoires <bentiss@kernel.org> |
selftests/hid: sync python tests to hid-tools 0.10
hid-tools 0.10 fixes one inconvenience introduced by commit 6a9e76f75c1a ("HID: multitouch: Disable touchpad on firmware level while not in use")
selftests/hid: sync python tests to hid-tools 0.10
hid-tools 0.10 fixes one inconvenience introduced by commit 6a9e76f75c1a ("HID: multitouch: Disable touchpad on firmware level while not in use")
This change added a new callback when a hid-nultitouch device is opened or closed to put the underlying device into a given operating mode. However, in the test cases, that means that while the single threaded test is run, it opens the device but has to react to the device while the open() is still running. hid-tools now implements a minimal thread to circumvent this.
This makes the HID kernel tests in sync with hid-tools 0.10.
This has the net effect of running the full HID python testsuite in 6 minutes instead of 1 hour.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Link: https://patch.msgid.link/20250709-wip-fix-ci-v1-3-b7df4c271cf8@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
show more ...
|