Input: evdev - sanitize event type index when fetching event masks
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 06a16293f71927f756dcf37558a79c0b05a91641 · < 4034ef247a9dde3f56660b01f0c3280dac6b1274| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Input: evdev - sanitize event type index when fetching event masks
The user-supplied event type index passed to EVIOCGMASK / EVIOCSMASK ioctls is used to index the static counts array in evdev_get_mask_cnt() and client evmasks array in evdev_get_mask().
While the event type is architecturally bounded by EV_CNT, speculative execution may mispredict bounds checks and perform out-of-bounds loads.
Sanitize the event type index in evdev_get_mask_cnt() branchlessly using array_index_mask_nospec(). This clamps the index to 0 for safe array access and forces the returned count to 0 speculatively when the index is out of bounds.
We do not need additional array_index_nospec() calls in evdev_get_mask() because evdev_get_mask_cnt() speculatively forces the count (and resulting xfer_size) to 0 for out-of-bounds types, preventing any speculative memory access to client evmasks array.
From the CVE record · Linux
The Linux kernel's evdev event-mask ioctls use a user-supplied event type to index arrays. A local caller able to use EVIOCGMASK or EVIOCSMASK can supply an out-of-bounds type that may cause speculative out-of-bounds loads if a bounds check is mispredicted. No user interaction is described.
Engineers running the Linux kernel should check whether their kernel includes the evdev event-type index fix; affected versions are not specified.