linux/tools/testing/selftests/hid
Trung Nguyen b6eb022890 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>
2026-07-01 20:36:12 +02:00
..
progs selftests/hid: Cover hid_bpf_get_data() size overflow 2026-07-01 09:55:36 +02:00
tests selftests/hid: multitouch: test a large ContactCountMaximum 2026-07-01 20:36:12 +02:00
.gitignore selftests/hid: Add host-tools to .gitignore 2024-12-10 12:46:54 +01:00
config bpfilter: remove bpfilter 2024-01-04 10:23:10 -08:00
config.common selftests: net: Enable legacy netfilter legacy options. 2025-07-25 18:38:55 +02:00
config.x86_64 selftests: hid: add vmtest.sh 2023-01-18 22:08:38 +01:00
hid_bpf.c selftests/hid: Cover hid_bpf_get_data() size overflow 2026-07-01 09:55:36 +02:00
hid_common.h selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
hid-apple.sh selftests: hid: import hid-tools hid-apple tests 2023-04-12 17:13:38 +02:00
hid-core.sh selftests: hid: import hid-tools hid-core tests 2023-04-12 17:13:37 +02:00
hid-gamepad.sh selftests: hid: import hid-tools hid-gamepad tests 2023-04-12 17:13:37 +02:00
hid-ite.sh selftests: hid: import hid-tools hid-ite tests 2023-04-12 17:13:38 +02:00
hid-keyboard.sh selftests: hid: import hid-tools hid-keyboards tests 2023-04-12 17:13:37 +02:00
hid-mouse.sh selftests: hid: import hid-tools hid-mouse tests 2023-04-12 17:13:37 +02:00
hid-multitouch.sh selftests: hid: import hid-tools hid-multitouch and hid-tablets tests 2023-04-12 17:13:37 +02:00
hid-sony.sh selftests: hid: import hid-tools hid-sony and hid-playstation tests 2023-04-12 17:13:38 +02:00
hid-tablet.sh selftests: hid: import hid-tools hid-multitouch and hid-tablets tests 2023-04-12 17:13:37 +02:00
hid-usb_crash.sh selftests: hid: import hid-tools usb-crash tests 2023-04-12 17:13:38 +02:00
hid-wacom.sh selftests: hid: import hid-tools wacom tests 2023-04-12 17:13:38 +02:00
hidraw.c selftests/hid: hidraw: forge wrong ioctls and tests them 2025-09-17 11:37:23 +02:00
Makefile selftests/hid: Cover hid_bpf_get_data() size overflow 2026-07-01 09:55:36 +02:00
run-hid-tools-tests.sh selftests: hid: fix typo and exit code 2024-11-28 14:43:49 +01:00
settings selftests: hid: import hid-tools hid-multitouch and hid-tablets tests 2023-04-12 17:13:37 +02:00
vmtest.sh selftests/hid: update vmtest.sh for virtme-ng 2025-09-17 11:35:39 +02:00