virtio_vdpa: build affinity masks conditionally
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 |
|
|
6.4.166.5.36.6In the Linux kernel, the following vulnerability has been resolved:
virtio_vdpa: build affinity masks conditionally
We try to build affinity mask via create_affinity_masks() unconditionally which may lead several issues:
- the affinity mask is not used for parent without affinity support (only VDUSE support the affinity now) - the logic of create_affinity_masks() might not work for devices other than block. For example it's not rare in the networking device where the number of queues could exceed the number of CPUs. Such case breaks the current affinity logic which is based on group_cpus_evenly() who assumes the number of CPUs are not less than the number of groups. This can trigger a warning[1]:
if (ret >= 0) WARN_ON(nr_present + nr_others < numgrps);
Fixing this by only build the affinity masks only when
- Driver passes affinity descriptor, driver like virtio-blk can make sure to limit the number of queues when it exceeds the number of CPUs - Parent support affinity setting config ops
This help to avoid the warning. More optimizations could be done on top.
From the CVE record · Linux
The Linux kernel's virtio_vdpa code builds affinity masks even when they are not needed or supported. On devices with more queues than CPUs, this can trigger a kernel warning. The input does not describe an attacker, access requirements, or user interaction.
Engineers running Linux kernels with virtio_vdpa should check their versions against the vendor advisory; affected versions are not specified in the input.