CVE-2026-98002 PUBLISHED

iommu/amd: Fix ineffective error check in nested domain allocation

Assigner: Linux
Reserved: 25.09.2026 Published: 25.09.2026 Updated: 25.09.2026

In the Linux kernel, the following vulnerability has been resolved:

iommu/amd: Fix ineffective error check in nested domain allocation

amd_iommu_pdom_id_alloc() returns an int: a domain ID on success, or the negative errno from ida_alloc_range() when the ID space is exhausted or memory is short. amd_iommu_alloc_domain_nested() stores that return value in gdom_info->hdom_id, which is a u32, and only then tests it:

<pre>gdom_info->hdom_id = amd_iommu_pdom_id_alloc(); if (gdom_info->hdom_id <= 0) { </pre>

The assignment discards the sign, so -ENOSPC becomes 0xffffffe4 and the test never fires. The nested domain is then set up with a host domain ID that was never allocated, instead of the allocation failing with -ENOSPC.

Keep the value in an int, test it there, and store it only once it is known to be valid, which is what the other amd_iommu_pdom_id_alloc() callers already do.

Metrics

CVSS Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
CVSS Score: 7.8

AV:L - The patched function amd_iommu_alloc_domain_nested() is reached only via the IOMMU_HWPT_ALLOC ioctl on a local iommufd fd (/dev/iommu) against an AMD vIOMMU (iommufd_hwpt_alloc -> viommu->ops->alloc_domain_nested); no remote protocol carries the input. AC:H - The failure path needs ida_alloc_range() in amd_iommu_pdom_id_alloc() to fail: either all 65535 global host domain IDs are in use with a victim domain holding 0xffe4, which lowest-first allocation doesn't let the attacker arrange on demand, or a GFP_ATOMIC failure the attacker cannot force. PR:L - Needs a VMM-style user that has been given /dev/iommu (0660) and a bound VFIO device cdev to create a vIOMMU and nested HWPTs; that is delegated device access, not full init-namespace root. UI:N - The attacker allocates the nested HWPTs and attaches the device themselves; nobody else has to do anything. S:C - The unallocated hdom_id (truncated to 0xffe4/0xfff4 by DTE_DOMID_MASK) is written into the DTE by set_dte_nested(), so the nested device shares IOTLB tags with another IOMMU domain, breaking the DMA isolation boundary between domains. C:H - Because the DomID is aliased, the device's DMA can hit IOTLB translations cached for the other domain and read memory belonging to that domain. I:H - The same aliased IOTLB entries let the device's DMA writes land in the other domain's pages, corrupting memory outside the nested domain. A:H - Stray DMA writes into another domain's memory, plus invalidations for the parent S2 hitting the shared hdom_id, can corrupt host or guest memory used by other devices and bring them down.

Product Status

Vendor Linux
Product Linux
Versions Default: unaffected
  • affected from 757d2b1fdf5b7d6eead5963a49b5780617987ab8 to 80c231f5577229d1e90a1e312b3095f9502f8625 (excl.)
  • affected from 757d2b1fdf5b7d6eead5963a49b5780617987ab8 to fa5c0827f0b7bac6d0a188f10118151769ae68fd (excl.)
Vendor Linux
Product Linux
Versions Default: affected
  • Version 7.0 is affected
  • unaffected from 0 to 7.0 (excl.)
  • unaffected from 7.2.7 to 7.2.* (incl.)
  • unaffected from 7.3-rc3 to * (incl.)

References