7.8high
genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.20% (higher than 10% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie The IOMMU translation for MSI message addresses has been a 2-step process, separated in time: 1) iommu_dma_prepare_msi(): A cookie pointer containing the IOVA address is stored in the MSI descriptor when an MSI interrupt is allocated. 2) iommu_dma_compose_msi_msg(): this cookie pointer is used to compute a translated message address. This has an inherent lifetime problem for the pointer stored in the cookie that must remain valid between the two steps. However, there is no locking at the irq layer that helps protect the lifetime. Today, this works under the assumption that the iommu domain is not changed while MSI interrupts being programmed. This is true for normal DMA API users within the kernel, as the iommu domain is attached before the driver is probed and cannot be changed while a driver is attached. Classic VFIO type1 also prevented changing the iommu domain while VFIO was running as it does not support changing the "container" after starting up. However, iommufd has improved this so that the iommu domain can be changed during VFIO operation. This potentially allows userspace to directly race VFIO_DEVICE_ATTACH_IOMMUFD_PT (which calls iommu_attach_group()) and VFIO_DEVICE_SET_IRQS (which calls into iommu_dma_compose_msi_msg()). This potentially causes both the cookie pointer and the unlocked call to iommu_get_domain_for_dev() on the MSI translation path to become UAFs. Fix the MSI cookie UAF by removing the cookie pointer. The translated IOVA address is already known during iommu_dma_prepare_msi() and cannot change. Thus, it can simply be stored as an integer in the MSI descriptor. The other UAF related to iommu_get_domain_for_dev() will be addressed in patch "iommu: Make iommu_dma_prepare_msi() into a generic operation" by using the IOMMU group mutex.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from ece6e6f0218b7777e650bf93728130ae6f4feb7d before e4d3763223c7b72ded53425207075e7453b4e3d5, from ece6e6f0218b7777e650bf93728130ae6f4feb7d before ba41e4e627db51d914444aee0b93eb67f31fa330, from ece6e6f0218b7777e650bf93728130ae6f4feb7d before 53f42776e435f63e5f8e61955e4c205dbfeaf524, from ece6e6f0218b7777e650bf93728130ae6f4feb7d before 856152eb91e67858a09e30a7149a1f29b04b7384, from ece6e6f0218b7777e650bf93728130ae6f4feb7d before 1f7df3a691740a7736bbc99dc4ed536120eb4746, 5.2 Not affected: before 5.2, from 6.1.141 up to 6.1.*, from 6.6.93 up to 6.6.*, from 6.12.31 up to 6.12.*, from 6.14.9 up to 6.14.*, from 6.15 up to * | CVE List |
| linux linux_kernel | from 5.2 before 6.1.141, from 6.2 before 6.6.93, from 6.7 before 6.12.31, from 6.13 before 6.14.9 | NVD |
| debian debian_linux | 11.0 | NVD |
All scores
| Linux | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie The IOMMU translation for MSI message addresses has been a 2-step process, separated in time: 1) iommu_dma_prepare_msi(): A cookie pointer containing the IOVA address is stored in the MSI descriptor when an MSI interrupt is allocated. 2) iommu_dma_compose_msi_msg(): this cookie pointer is used to compute a translated message address. This has an inherent lifetime problem for the pointer stored in the cookie that must remain valid between the two steps. However, there is no locking at the irq layer that helps protect the lifetime. Today, this works under the assumption that the iommu domain is not changed while MSI interrupts being programmed. This is true for normal DMA API users within the kernel, as the iommu domain is attached before the driver is probed and cannot be changed while a driver is attached. Classic VFIO type1 also prevented changing the iommu domain while VFIO was running as it does not support changing the "container" after starting up. However, iommufd has improved this so that the iommu domain can be changed during VFIO operation. This potentially allows userspace to directly race VFIO_DEVICE_ATTACH_IOMMUFD_PT (which calls iommu_attach_group()) and VFIO_DEVICE_SET_IRQS (which calls into iommu_dma_compose_msi_msg()). This potentially causes both the cookie pointer and the unlocked call to iommu_get_domain_for_dev() on the MSI translation path to become UAFs. Fix the MSI cookie UAF by removing the cookie pointer. The translated IOVA address is already known during iommu_dma_prepare_msi() and cannot change. Thus, it can simply be stored as an integer in the MSI descriptor. The other UAF related to iommu_get_domain_for_dev() will be addressed in patch "iommu: Make iommu_dma_prepare_msi() into a generic operation" by using the IOMMU group mutex.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: genirq/msi: Almacenar el IOVA de IOMMU directamente en msi_desc en lugar de en iommu_cookie La traducción de IOMMU para direcciones de mensajes MSI ha sido un proceso de 2 pasos, separados en el tiempo: 1) iommu_dma_prepare_msi(): Un puntero de cookie que contiene la dirección IOVA se almacena en el descriptor MSI cuando se asigna una interrupción MSI. 2) iommu_dma_compose_msi_msg(): este puntero de cookie se utiliza para calcular una dirección de mensaje traducida. Esto tiene un problema de vida útil inherente para el puntero almacenado en la cookie que debe seguir siendo válido entre los dos pasos. Sin embargo, no hay bloqueo en la capa irq que ayude a proteger la vida útil. Hoy en día, esto funciona bajo el supuesto de que el dominio iommu no cambia mientras se programan las interrupciones MSI. Esto aplica a los usuarios normales de la API de DMA dentro del kernel, ya que el dominio iommu se conecta antes de sondear el controlador y no se puede cambiar mientras esté conectado. El tipo 1 de VFIO clásico también impedía cambiar el dominio iommu mientras VFIO se ejecutaba, ya que no admite cambiar el "contenedor" después del inicio. Sin embargo, iommufd ha mejorado esto para que el dominio iommu se pueda cambiar durante la operación de VFIO. Esto potencialmente permite que el espacio de usuario compita directamente con VFIO_DEVICE_ATTACH_IOMMUFD_PT (que llama a iommu_attach_group()) y VFIO_DEVICE_SET_IRQS (que llama a iommu_dma_compose_msi_msg()). Esto potencialmente provoca que tanto el puntero de cookie como la llamada desbloqueada a iommu_get_domain_for_dev() en la ruta de traducción MSI se conviertan en UAF. Corrija el UAF de la cookie MSI eliminando el puntero de cookie. La dirección IOVA traducida ya se conoce durante iommu_dma_prepare_msi() y no puede modificarse. Por lo tanto, puede almacenarse simplemente como un entero en el descriptor MSI. El resto de UAF relacionado con iommu_get_domain_for_dev() se abordará en el parche "iommu: Convertir iommu_dma_prepare_msi() en una operación genérica" mediante el mutex del grupo IOMMU.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-38062 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2025-38062 changed 2026-07-30 | Public domain |