CVE-2024-35981
Virtio Net Infinite Loop BUG in Linux Kernel
Description
In the Linux kernel, the following vulnerability has been resolved: virtio_net: Do not send RSS key if it is not supported There is a bug when setting the RSS options in virtio_net 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) ethtool_set_rxfh() calls virtnet_set_rxfh() 2) virtnet_set_rxfh() calls virtnet_commit_rss_command() 3) virtnet_commit_rss_command() 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 rss_key_size == 0. sg_buf_size = vi->rss_key_size; 5) This buffer is passed to qemu, but qemu is not happy with a buffer with zero length, and do the following in virtqueue_map_desc() (QEMU function): if (!sz) { virtio_error(vdev, "virtio: zero sized buffers are not allowed"); 6) virtio_error() (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 virtnet_send_command()) 9) The kernel is waiting doing the following : while (!virtqueue_get_buf(vi->cvq, &tmp) && !virtqueue_is_broken(vi->cvq)) cpu_relax(); 10) None of the following functions above is true, thus, the kernel loops here forever. Keeping in mind that virtqueue_is_broken() 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.
INFO
Published Date :
May 20, 2024, 10:15 a.m.
Last Modified :
Jan. 16, 2025, 5:22 p.m.
Source :
416baaa9-dc9f-4396-8d5f-8c081fb06d67
Remotely Exploitable :
No
Impact Score :
3.6
Exploitability Score :
1.8
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2024-35981
.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2024-35981
vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2024-35981
vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Jan. 16, 2025
Action Type Old Value New Value Added CVSS V3.1 NIST AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H Added CWE NIST CWE-835 Added CPE Configuration OR *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 5.18 up to (excluding) 6.1.90 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 6.2 up to (excluding) 6.6.29 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 6.7 up to (excluding) 6.8.7 *cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* *cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* *cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:* Changed Reference Type https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 No Types Assigned https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 Patch Changed Reference Type https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 No Types Assigned https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 Patch Changed Reference Type https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de No Types Assigned https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de Patch Changed Reference Type https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de No Types Assigned https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de Patch Changed Reference Type https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de No Types Assigned https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de Patch Changed Reference Type https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de No Types Assigned https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de Patch Changed Reference Type https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b No Types Assigned https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b Patch Changed Reference Type https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b No Types Assigned https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b Patch -
CVE Modified by af854a3a-2127-422b-91ae-364da2661108
Nov. 21, 2024
Action Type Old Value New Value Added Reference https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 Added Reference https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de Added Reference https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de Added Reference https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b -
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
May. 29, 2024
Action Type Old Value New Value -
CVE Received by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
May. 20, 2024
Action Type Old Value New Value Added Description In the Linux kernel, the following vulnerability has been resolved: virtio_net: Do not send RSS key if it is not supported There is a bug when setting the RSS options in virtio_net 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) ethtool_set_rxfh() calls virtnet_set_rxfh() 2) virtnet_set_rxfh() calls virtnet_commit_rss_command() 3) virtnet_commit_rss_command() 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 rss_key_size == 0. sg_buf_size = vi->rss_key_size; 5) This buffer is passed to qemu, but qemu is not happy with a buffer with zero length, and do the following in virtqueue_map_desc() (QEMU function): if (!sz) { virtio_error(vdev, "virtio: zero sized buffers are not allowed"); 6) virtio_error() (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 virtnet_send_command()) 9) The kernel is waiting doing the following : while (!virtqueue_get_buf(vi->cvq, &tmp) && !virtqueue_is_broken(vi->cvq)) cpu_relax(); 10) None of the following functions above is true, thus, the kernel loops here forever. Keeping in mind that virtqueue_is_broken() 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. Added Reference kernel.org https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47 [No types assigned]
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2024-35981
is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2024-35981
weaknesses.