Re: [RFC linux v1 2/3] iommu/virtio: Prevent driver unbind via sysfs

From: Niklas Schnelle

Date: Wed Nov 25 2026 - 15:16:02 EST


On Tue, 2026-11-24 at 10:54 -0500, Cam Miller wrote:
> Set suppress_bind_attrs on the virtio-iommu driver to prevent userspace
> from triggering driver unbind via sysfs.
>
> Unbinding the IOMMU driver from beneath live endpoint devices would
> leave those devices with dangling domain pointers. This would not be a
> recoverable operation.
>
> Note that suppress_bind_attrs covers only the driver bind/unbind path,
> not PCI-level device removal triggered via the sysfs remove file.
>
> Fixes: edcd69ab9a32 ("iommu: Add virtio-iommu driver")
> Signed-off-by: Cam Miller <cam@xxxxxxxxxxxxx>
> ---
> drivers/iommu/virtio-iommu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index a08474eeed58..dd10c3e98a3d 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -1285,7 +1285,10 @@ static struct virtio_device_id id_table[] = {
> MODULE_DEVICE_TABLE(virtio, id_table);
>
> static struct virtio_driver virtio_iommu_drv = {
> - .driver.name = KBUILD_MODNAME,
> + .driver = {
> + .name = KBUILD_MODNAME,
> + .suppress_bind_attrs = true,
> + },
> .id_table = id_table,
> .feature_table = features,
> .feature_table_size = ARRAY_SIZE(features),

Makes sense to me and this is also in line with other IOMMU drivers
like arm-smmu-v3 that use the same attribute.

Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>

Thanks,
Niklas