CVE-2024-35981: virtio_net: Do not send RSS key if it is not supported
In the Linux kernel, the following vulnerability has been resolved:
virtionet: Do not send RSS key if it is not supported
There is a bug when setting the RSS options in virtionet that can break the whole machine, getting the kernel into an infinite loop.
Running the following command in any QEMU virtual machine with virtionet will reproduce this problem:
# ethtool -X eth0 hfunc toeplitz
This is how the problem happens:
1) ethtoolsetrxfh() calls virtnetsetrxfh()
2) virtnetsetrxfh() calls virtnetcommitrsscommand()
3) virtnetcommitrsscommand() populates 4 entries for the rss scatter-gather
4) Since the command above does not have a key, then the last scatter-gatter entry will be zeroed, since rsskeysize == 0. sgbufsize = vi->rsskeysize;
5) This buffer is passed to qemu, but qemu is not happy with a buffer with zero length, and do the following in virtqueuemapdesc() (QEMU function):
if (!sz) { virtioerror(vdev, "virtio: zero sized buffers are not allowed");
6) virtioerror() (also QEMU function) set the device as broken
vdev->broken = true;
7) Qemu bails out, and do not repond this crazy kernel.
8) The kernel is waiting for the response to come back (function virtnetsendcommand())
9) The kernel is waiting doing the following :
while (!virtqueuegetbuf(vi->cvq, &tmp) && !virtqueueisbroken(vi->cvq)) cpurelax();
10) None of the following functions above is true, thus, the kernel loops here forever. Keeping in mind that virtqueueisbroken() does not look at the qemu vdev->broken, so, it never realizes that the vitio is broken at QEMU side.
Fix it by not sending RSS commands if the feature is not available in the device.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35981?
CVE-2024-35981 has been classified as a medium severity vulnerability due to its potential to cause kernel crashes.
How do I fix CVE-2024-35981?
To resolve CVE-2024-35981, upgrade the Linux kernel to versions 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.128-1, or 6.12.12-1.
Which systems are affected by CVE-2024-35981?
CVE-2024-35981 affects multiple versions of the Linux kernel, specifically between versions 5.18 and 6.6.29, as well as versions 6.7 to 6.8.7 and 6.9 release candidates.
What is the cause of CVE-2024-35981?
CVE-2024-35981 is caused by a bug in the virtio_net driver related to RSS options that can lead to an infinite loop in the kernel.
Is there any workaround for CVE-2024-35981?
Currently, the best approach to mitigate CVE-2024-35981 is to apply the necessary kernel updates as there are no specific workarounds available.