В ядре Linux устранена следующая уязвимость:
drm/xe/guc_submit: исправлена гонка вокруг suspend_pending
В настоящее время в некоторых тестовых случаях мы можем запускать:
xe 0000:03:00.0: [drm] Не удалось выполнить утверждение `exec_queue_destroyed(q)`!
.... ВНИМАНИЕ: ЦП: 18 PID: 2640 в драйверах/gpu/drm/xe/xe_guc_submit.c:1826 xe_guc_sched_done_handler+0xa54/0xef0 [xe]
xe 0000:03:00.0: [drm] *ОШИБКА* GT1: DEREGISTER_DONE: Неожиданное состояние механизма 0x00a1, guc_id=57
Глядя на фрагмент соответствующего ftrace для этого идентификатора GuC, мы видим:
162.673311: xe_sched_msg_add: dev=0000:03:00.0, gt=1 guc_id=57, код операции=3
162.673317: xe_sched_msg_recv: dev=0000:03:00.0, gt=1 guc_id=57, код операции=3
162.673319: xe_exec_queue_scheduling_disable: dev=0000:03:00.0, 1:0x2, gt=1, ширина=1, guc_id=57, guc_state=0x29, flags=0x0
162.674089: xe_exec_queue_kill: dev=0000:03:00.0, 1:0x2, gt=1, ширина=1, guc_id=57, guc_state=0x29, flags=0x0
162.674108: xe_exec_queue_close: dev=0000:03:00.0, 1:0x2, gt=1, ширина=1, guc_id=57, guc_state=0xa9, flags=0x0
162.674488: xe_exec_queue_scheduling_done: dev=0000:03:00.0, 1:0x2, gt=1, ширина=1, guc_id=57, guc_state=0xa9, flags=0x0
162.678452: xe_exec_queue_deregister: dev=0000:03:00.0, 1:0x2, gt=1, ширина=1, guc_id=57, guc_state=0xa1, flags=0x0
Похоже, мы пытаемся приостановить очередь (код операции=3), установив
suspend_pending и запуск Disable_scheduling. Затем пользователь
закрывает очередь.
Однако закрытие также станет мощным сигналом
приостановить забор после уничтожения очереди, позже, когда ответ G2H на
Disable_scheduling возвращается, теперь мы очистили suspend_pending, когда
сигнализирует о блокировке приостановки, поэтому параметр Disable_scheduling теперь неверен.
пытается также отменить регистрацию очереди. Это приводит к предупреждениям, поскольку очередь
еще даже не отмечено для уничтожения. Мы также, кажется, запускаем
ошибки позже при попытке дважды отменить регистрацию одной и той же очереди.
Чтобы исправить эту настройку, измените порядок обработки ответа, чтобы гарантировать, что мы
не гоняйтесь с отключением_планирования, которое на самом деле не собиралось этого делать
выполнить отмену регистрации. Путь разрушения теперь также должен корректно
дождитесь любого pending_disable, прежде чем пометить его как уничтоженный.
(вишня выбрана из коммита f161809b362f027b6d72bd998e47f8f0bad60a2e)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: drm/xe/guc_submit: fix race around suspend_pending Currently in some testcases we can trigger: xe 0000:03:00.0: [drm] Assertion `exec_queue_destroyed(q)` failed! .... WARNING: CPU: 18 PID: 2640 at drivers/gpu/drm/xe/xe_guc_submit.c:1826 xe_guc_sched_done_handler+0xa54/0xef0 [xe] xe 0000:03:00.0: [drm] *ERROR* GT1: DEREGISTER_DONE: Unexpected engine state 0x00a1, guc_id=57 Looking at a snippet of corresponding ftrace for this GuC id we can see: 162.673311: xe_sched_msg_add: dev=0000:03:00.0, gt=1 guc_id=57, opcode=3 162.673317: xe_sched_msg_recv: dev=0000:03:00.0, gt=1 guc_id=57, opcode=3 162.673319: xe_exec_queue_scheduling_disable: dev=0000:03:00.0, 1:0x2, gt=1, width=1, guc_id=57, guc_state=0x29, flags=0x0 162.674089: xe_exec_queue_kill: dev=0000:03:00.0, 1:0x2, gt=1, width=1, guc_id=57, guc_state=0x29, flags=0x0 162.674108: xe_exec_queue_close: dev=0000:03:00.0, 1:0x2, gt=1, width=1, guc_id=57, guc_state=0xa9, flags=0x0 162.674488: xe_exec_queue_scheduling_done: dev=0000:03:00.0, 1:0x2, gt=1, width=1, guc_id=57, guc_state=0xa9, flags=0x0 162.678452: xe_exec_queue_deregister: dev=0000:03:00.0, 1:0x2, gt=1, width=1, guc_id=57, guc_state=0xa1, flags=0x0 It looks like we try to suspend the queue (opcode=3), setting suspend_pending and triggering a disable_scheduling. The user then closes the queue. However the close will also forcefully signal the suspend fence after killing the queue, later when the G2H response for disable_scheduling comes back we have now cleared suspend_pending when signalling the suspend fence, so the disable_scheduling now incorrectly tries to also deregister the queue. This leads to warnings since the queue has yet to even be marked for destruction. We also seem to trigger errors later with trying to double unregister the same queue. To fix this tweak the ordering when handling the response to ensure we don't race with a disable_scheduling that didn't actually intend to perform an unregister. The destruction path should now also correctly wait for any pending_disable before marking as destroyed. (cherry picked from commit f161809b362f027b6d72bd998e47f8f0bad60a2e)
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 1
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.8
|
6.12.4
|