vfio: Split migration ops from main device ops
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
vfio: Split migration ops from main device ops
vfio core checks whether the driver sets some migration op (e.g. set_state/get_state) and accordingly calls its op.
However, currently mlx5 driver sets the above ops without regards to its migration caps.
This might lead to unexpected usage/Oops if user space may call to the above ops even if the driver doesn't support migration. As for example, the migration state_mutex is not initialized in that case.
The cleanest way to manage that seems to split the migration ops from the main device ops, this will let the driver setting them separately from the main ops when it's applicable.
As part of that, validate ops construction on registration and include a check for VFIO_MIGRATION_STOP_COPY since the uAPI claims it must be set in migration_flags.
HISI driver was changed as well to match this scheme.
From the CVE record · Linux
The Linux kernel’s VFIO core may expose mlx5 migration operations even when the driver does not support migration. Local user space calling those operations could trigger unexpected behavior or a kernel Oops; the input does not specify an authentication requirement.
Engineers running Linux kernels with VFIO and the mlx5 driver should check their deployments; affected versions are not specified.