В ядре Linux устранена следующая уязвимость:
PCI: избегайте тупиковой ситуации pci_dev_lock() AB/BA с помощью sriov_numvfs_store()
Путь sysfs sriov_numvfs_store() получает блокировку устройства до того, как
блокировка доступа к пространству конфигурации:
sriov_numvfs_store
device_lock # A (1) получить блокировку устройства
sriov_configure
vfio_pci_sriov_configure # (например)
vfio_pci_core_sriov_configure
pci_disable_sriov
sriov_disable
pci_cfg_access_lock
pci_wait_cfg # B (4) ждать dev->block_cfg_access == 0
Ранее pci_dev_lock() получала блокировку доступа к конфигурационному пространству до того, как
блокировка устройства:
pci_dev_lock
pci_cfg_access_lock
dev->block_cfg_access = 1 # B (2) установить dev->block_cfg_access = 1
device_lock # A (3) дождаться блокировки устройства
Любой путь, использующий pci_dev_lock(), например, pci_reset_function(), может
тупик с sriov_numvfs_store(), если операции происходят в последовательности
(1) (2) (3) (4).
Избегайте тупиковой ситуации, изменив порядок в pci_dev_lock(), чтобы он получил
блокировка устройства перед блокировкой доступа к пространству конфигурации, так же, как и
Путь sriov_numvfs_store().
[bhelgaas: объединенный и адаптированный журнал коммитов от независимого Джея Чжоу
последующая публикация:
https://lore.kernel.org/r/20220404062539.1710-1-jianjay.zhou@huawei.com]
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() The sysfs sriov_numvfs_store() path acquires the device lock before the config space access lock: sriov_numvfs_store device_lock # A (1) acquire device lock sriov_configure vfio_pci_sriov_configure # (for example) vfio_pci_core_sriov_configure pci_disable_sriov sriov_disable pci_cfg_access_lock pci_wait_cfg # B (4) wait for dev->block_cfg_access == 0 Previously, pci_dev_lock() acquired the config space access lock before the device lock: pci_dev_lock pci_cfg_access_lock dev->block_cfg_access = 1 # B (2) set dev->block_cfg_access = 1 device_lock # A (3) wait for device lock Any path that uses pci_dev_lock(), e.g., pci_reset_function(), may deadlock with sriov_numvfs_store() if the operations occur in the sequence (1) (2) (3) (4). Avoid the deadlock by reversing the order in pci_dev_lock() so it acquires the device lock before the config space access lock, the same as the sriov_numvfs_store() path. [bhelgaas: combined and adapted commit log from Jay Zhou's independent subsequent posting: https://lore.kernel.org/r/20220404062539.1710-1-jianjay.zhou@huawei.com]
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
— |
4.9.318
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.10
|
4.14.283
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.15
|
4.19.247
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.20
|
5.4.198
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.5
|
5.10.121
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.46
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
5.17.14
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.18
|
5.18.3
|