В ядре Linux устранена следующая уязвимость:
drm/xe/dma-buf: обработка пустых гонок bo и UAF
Похоже, здесь происходят неприятные гонки при запуске
крючок validate_mappings:
1) Мы выполняем xe_bo_alloc(), за которым следует присоединение, перед фактическим полным bo. Шаг инициализации в xe_dma_buf_init_obj(). Однако бо видно на
список вложений после прикрепления.
Это плохо, поскольку водитель-экспортер,
скажем, amdgpu может в любой момент перезвонить нашему хуку validate_mappings,
с пустым/фиктивным bo, что приводит к потенциальным ошибкам/сбоям.
2) Аналогично 1) но здесь мы получаем UAF, когда значение validate_mappings
срабатывает крючок. Например, мы дошли до xe_bo_init_locked().
но это в каком-то смысле не получается. Но здесь бо освободится по ошибке, но
он у нас все еще прикреплен из dma-buf pov, так что если
validate_mappings теперь срабатывает, и бо, к которому мы обращаемся, исчезло и
мы запускаем UAF и другие ошибки/сбои.
Чтобы это исправить, переместите шаг прикрепления до тех пор, пока у нас не будет полностью
настроить объект буфера. Обратите внимание, что bo не публикуется в пользовательском пространстве.
на потом, так что не уверен, что такое комментарий "Не публиковать бо"
пока у нас не будет действительного прикрепления», имеется в виду. У нас есть как минимум два разных клиента, сообщающих о достижении NULL PTR.
deref в evict_flags при импорте чего-либо из amdgpu, а затем
запуск потока выселения.
Частота попаданий также довольно низкая, что намек на какую-то расу, поэтому что-то вроде 1) или 2) может объяснить это. версия 2: - Немного перетасуйте порядок операций (без функциональных изменений). - Улучшите комментарий, чтобы лучше объяснить порядок (Мэтт Б.) (вишня выбрана из коммита af1f2ad0c59fe4e2f924c526f66e968289d77971)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: drm/xe/dma-buf: handle empty bo and UAF races There look to be some nasty races here when triggering the invalidate_mappings hook: 1) We do xe_bo_alloc() followed by the attach, before the actual full bo init step in xe_dma_buf_init_obj(). However the bo is visible on the attachments list after the attach. This is bad since exporter driver, say amdgpu, can at any time call back into our invalidate_mappings hook, with an empty/bogus bo, leading to potential bugs/crashes. 2) Similar to 1) but here we get a UAF, when the invalidate_mappings hook is triggered. For example, we get as far as xe_bo_init_locked() but this fails in some way. But here the bo will be freed on error, but we still have it attached from dma-buf pov, so if the invalidate_mappings is now triggered then the bo we access is gone and we trigger UAF and more bugs/crashes. To fix this, move the attach step until after we actually have a fully set up buffer object. Note that the bo is not published to userspace until later, so not sure what the comment "Don't publish the bo until we have a valid attachment", is referring to. We have at least two different customers reporting hitting a NULL ptr deref in evict_flags when importing something from amdgpu, followed by triggering the evict flow. Hit rate is also pretty low, which would hint at some kind of race, so something like 1) or 2) might explain this. v2: - Shuffle the order of the ops slightly (no functional change) - Improve the comment to better explain the ordering (Matt B) (cherry picked from commit af1f2ad0c59fe4e2f924c526f66e968289d77971)
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 6
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.8
|
6.12.91
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.33
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.10
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc3:*:*:*:*:*:*
|
— | — |