Skip to content

CVE-2025-38062 genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie

MediumCVSS 5.5 EPSS 0.20%
Published
Updated
Exploit status
No public exploit known
Technology
Linux KernelUbuntuDebian

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.

Upgrade path

13 packages: 7 fixed, 5 with no fix yet.

PackageAffectedFixed inStatus
cbl-mariner kernel(CBL-Mariner 2.0) All versions No fix listed No fix yet
Microsoft cbl2 kernel 5.15.202.1-1 All versions No fix listed No fix yet
ubuntu/linux(Ubuntu 22.04) All versions No fix listed No fix yet
ubuntu/linux-kvm(Ubuntu 22.04) All versions No fix listed No fix yet
ubuntu/linux-raspi(Ubuntu 22.04) All versions No fix listed No fix yet
azure linux kernel(Azure Linux 3.0) < 6.6.96.1-1 6.6.96.1-1 Fixed
debian/linux(Debian 12) < 6.1.147-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +38 more 6.1.147-1 Fixed
debian/linux(Debian 13) < 6.12.32-1 6.12.32-1 Fixed
debian/linux(Debian 14) < 6.12.32-1 6.12.32-1 Fixed
Linux kernel < 6.1.141; < 6.6.93; < 6.12.31; < 6.14.9 +11 more 1f7df3a691740a7736bbc99dc4ed536120eb4746, 6.1.141, 6.6.93, 6.12.31, 6.14.9, 6.15, 53f42776e435f63e5f8e61955e4c205dbfeaf524, 856152eb91e67858a09e30a7149a1f29b04b7384, ba41e4e627db51d914444aee0b93eb67f31fa330, e4d3763223c7b72ded53425207075e7453b4e3d5 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-100.100 6.8.0-100.100 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1047.51 6.8.0-1047.51 Fixed
debian linux = 11.0 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
azure linux kernel(Azure Linux:3.0) < 6.6.96.1-1 6.6.96.1-1
cbl-mariner kernel(CBL-Mariner:2.0) All versions No fix listed
Microsoft cbl2 kernel 5.15.202.1-1 All versions No fix listed
debian/linux(Debian:12) < 6.1.147-1 6.1.147-1
debian/linux(Debian:12) = 6.1.106-1 No fix listed
debian/linux(Debian:12) = 6.1.106-2 No fix listed
debian/linux(Debian:12) = 6.1.106-3 No fix listed
debian/linux(Debian:12) = 6.1.112-1 No fix listed
debian/linux(Debian:12) = 6.1.115-1 No fix listed
debian/linux(Debian:12) = 6.1.119-1 No fix listed
debian/linux(Debian:12) = 6.1.123-1 No fix listed
debian/linux(Debian:12) = 6.1.124-1 No fix listed
debian/linux(Debian:12) = 6.1.128-1 No fix listed
debian/linux(Debian:12) = 6.1.129-1 No fix listed
debian/linux(Debian:12) = 6.1.133-1 No fix listed
debian/linux(Debian:12) = 6.1.135-1 No fix listed
debian/linux(Debian:12) = 6.1.137-1 No fix listed
debian/linux(Debian:12) = 6.1.139-1 No fix listed
debian/linux(Debian:12) = 6.1.140-1 No fix listed
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
Show 43 more
ProductAffected versionsFixed in
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
debian/linux(Debian:12) = 6.1.85-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:12) = 6.1.99-1 No fix listed
debian/linux(Debian:13) < 6.12.32-1 6.12.32-1
debian/linux(Debian:14) < 6.12.32-1 6.12.32-1
Linux kernel >= ece6e6f0218b7777e650bf93728130ae6f4feb7d, < e4d3763223c7b72ded53425207075e7453b4e3d5 e4d3763223c7b72ded53425207075e7453b4e3d5
Linux kernel >= ece6e6f0218b7777e650bf93728130ae6f4feb7d, < ba41e4e627db51d914444aee0b93eb67f31fa330 ba41e4e627db51d914444aee0b93eb67f31fa330
Linux kernel >= ece6e6f0218b7777e650bf93728130ae6f4feb7d, < 53f42776e435f63e5f8e61955e4c205dbfeaf524 53f42776e435f63e5f8e61955e4c205dbfeaf524
Linux kernel >= ece6e6f0218b7777e650bf93728130ae6f4feb7d, < 856152eb91e67858a09e30a7149a1f29b04b7384 856152eb91e67858a09e30a7149a1f29b04b7384
Linux kernel >= ece6e6f0218b7777e650bf93728130ae6f4feb7d, < 1f7df3a691740a7736bbc99dc4ed536120eb4746 1f7df3a691740a7736bbc99dc4ed536120eb4746
Linux kernel = 5.2 No fix listed
Linux kernel < 6.1.141 6.1.141
Linux kernel < 6.6.93 6.6.93
Linux kernel < 6.12.31 6.12.31
Linux kernel < 6.14.9 6.14.9
Linux kernel < 6.15 6.15
ubuntu/linux(Ubuntu:22.04) All versions No fix listed
ubuntu/linux-kvm(Ubuntu:22.04) All versions No fix listed
ubuntu/linux-raspi(Ubuntu:22.04) All versions No fix listed
ubuntu/linux(Ubuntu:24.04) < 6.8.0-100.100 6.8.0-100.100
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1047.51 6.8.0-1047.51
Linux kernel >= 5.2, < 6.1.141 6.1.141
Linux kernel >= 6.2, < 6.6.93 6.6.93
Linux kernel >= 6.7, < 6.12.31 6.12.31
Linux kernel >= 6.13, < 6.14.9 6.14.9
debian linux = 11.0 No fix listed

References