Re: [PATCH 2/2] iommu/amd: Fix illegal cap/mmio access in IOMMU debugfs

From: Vasant Hegde

Date: Mon Mar 30 2026 - 05:22:21 EST


On 3/19/2026 1:07 PM, Guanghui Feng wrote:
> In the current AMD IOMMU debugfs, when multiple processes simultaneously
> access the IOMMU mmio/cap registers using the IOMMU debugfs, illegal
> access issues can occur in the following execution flow:
>
> 1. CPU1: Sets a valid access address using iommu_mmio/capability_write,
> and verifies the access address's validity in iommu_mmio/capability_show
>
> 2. CPU2: Sets an invalid address using iommu_mmio/capability_write
>
> 3. CPU1: accesses the IOMMU mmio/cap registers based on the invalid
> address, resulting in an illegal access.
>
> This patch modifies the execution process to first verify the address's
> validity and then access it based on the same address, ensuring
> correctness and robustness.
>
> Signed-off-by: Guanghui Feng <guanghuifeng@xxxxxxxxxxxxxxxxx>

Looks good.

Reviewed-by: Vasant Hegde <vasant.hegde@xxxxxxx>

-Vasant