В ядре Linux устранена следующая уязвимость:
Ввод: uinput — исправить зависимость циклической блокировки с помощью ff-core
Может быть вызвано предупреждение о зависимости циклической блокировки lockdep
воспроизводимо при использовании геймпада с принудительной обратной связью с uinput (для
Например, играем в ELDEN RING под Wine на Flydigi Vader 5.
контроллер):
ff->мьютекс -> udev->мьютекс -> input_mutex -> dev->мьютекс -> ff->мьютекс
Цикл вызван четырьмя путями получения блокировки:
1. Загрузка ff: input_ff_upload() удерживает ff->мьютекс и вызывает
uinput_dev_upload_effect() -> uinput_request_submit() ->
uinput_request_send(), который получает udev->mutex.
2. создание устройства: uinput_ioctl_handler() удерживает udev->мьютекс и вызывает
uinput_create_device() -> input_register_device(), который получает
входной_мьютекс.
3. Регистр устройства: input_register_device() содержит input_mutex и
вызывает kbd_connect() -> input_register_handle(), который получает
dev->мьютекс.
4.
Релиз evdev: evdev_release() вызывает input_flush_device() под
dev->mutex, который вызывает input_ff_flush(), захватывающий ff->mutex. Исправьте это, введя новую спин-блокировку state_lock для защиты
udev->state и доступ udev->dev в uinput_request_send() вместо
получение udev->mutex. Функция должна только атомарно проверять
состояние устройства и поставить входное событие в очередь в кольцевой буфер через
uinput_dev_event() — обе операции безопасны при спин-блокировке
(ktime_get_ts64() и Wake_up_interruptible() не спят).
Это
разрывает связь ff->mutex -> udev->mutex, поскольку спин-блокировка является листом в
порядок блокировок и не может образовывать циклы с мьютексами. Чтобы сохранить видимость переходов состояний для uinput_request_send(), защитите
записывает в udev->state в uinput_create_device() и
uinput_destroy_device() с той же спин-блокировкой state_lock. Кроме того, переместите init_completion(&request->done) из
uinput_request_send() в uinput_request_submit() раньше
uinput_request_reserve_slot().
Как только слот будет выделен,
uinput_flush_requests() может вызвать функцию Complete() для него в любое время из
путь уничтожения, поэтому завершение должно быть инициализировано до
запрос становится видимым. Блокировка порядка после исправления:
ff->mutex -> state_lock (спин-блокировка, лист)
udev->mutex -> state_lock (спин-блокировка, лист)
udev->mutex -> input_mutex -> dev->mutex -> ff->mutex (без заднего края)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: Input: uinput - fix circular locking dependency with ff-core A lockdep circular locking dependency warning can be triggered reproducibly when using a force-feedback gamepad with uinput (for example, playing ELDEN RING under Wine with a Flydigi Vader 5 controller): ff->mutex -> udev->mutex -> input_mutex -> dev->mutex -> ff->mutex The cycle is caused by four lock acquisition paths: 1. ff upload: input_ff_upload() holds ff->mutex and calls uinput_dev_upload_effect() -> uinput_request_submit() -> uinput_request_send(), which acquires udev->mutex. 2. device create: uinput_ioctl_handler() holds udev->mutex and calls uinput_create_device() -> input_register_device(), which acquires input_mutex. 3. device register: input_register_device() holds input_mutex and calls kbd_connect() -> input_register_handle(), which acquires dev->mutex. 4. evdev release: evdev_release() calls input_flush_device() under dev->mutex, which calls input_ff_flush() acquiring ff->mutex. Fix this by introducing a new state_lock spinlock to protect udev->state and udev->dev access in uinput_request_send() instead of acquiring udev->mutex. The function only needs to atomically check device state and queue an input event into the ring buffer via uinput_dev_event() -- both operations are safe under a spinlock (ktime_get_ts64() and wake_up_interruptible() do not sleep). This breaks the ff->mutex -> udev->mutex link since a spinlock is a leaf in the lock ordering and cannot form cycles with mutexes. To keep state transitions visible to uinput_request_send(), protect writes to udev->state in uinput_create_device() and uinput_destroy_device() with the same state_lock spinlock. Additionally, move init_completion(&request->done) from uinput_request_send() to uinput_request_submit() before uinput_request_reserve_slot(). Once the slot is allocated, uinput_flush_requests() may call complete() on it at any time from the destroy path, so the completion must be initialised before the request becomes visible. Lock ordering after the fix: ff->mutex -> state_lock (spinlock, leaf) udev->mutex -> state_lock (spinlock, leaf) udev->mutex -> input_mutex -> dev->mutex -> ff->mutex (no back-edge)
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 15
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
2.6.19.1
|
5.10.253
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.203
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.169
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.135
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.82
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.23
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
6.19.13
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:2.6.19:-:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc6:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc7:*:*:*:*:*:*
|
— | — |