Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 183F422EF5 for ; Mon, 20 May 2024 09:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716198220; cv=none; b=kR1VETwMFQesosj+9wVUQxoRZndHwqZc0L82Nyoih1LjL2/lqMSlQnxi8bg2/GjPCXjzkwbVKWUjLoAR5RAjk0naouFcQ/JDjOjrW91MeOp4GeyM2uwxf2J/UHS4zeJiNWBjnECF1XslsyZkEpAo2fYVHDDv+VUkLM7eJz9En9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716198220; c=relaxed/simple; bh=QWtboHrW0mrrvnF4W0C9nZMtUkHu+VeoFM6i/c7WJ0s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EyWj8NI7XmLQG/YcQz897ypsWnupaKbXr8oN/VHNX3L6ew1VivPTwdLkRIK2C/br+rO5iIYk6NSSjV/uZyhckNEmiQIXC4vN49Fod8mHwApY3nABzPirtTjD8o2rjVfOM1D/v/19pr3xH03SmGAaiubP0v9auuCH2E/N925uJCY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C+X5kScx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="C+X5kScx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91EE1C2BD10; Mon, 20 May 2024 09:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716198220; bh=QWtboHrW0mrrvnF4W0C9nZMtUkHu+VeoFM6i/c7WJ0s=; h=From:To:Cc:Subject:Date:Reply-to:From; b=C+X5kScx1tEI1fV73Pp4wxA3+uaw+bYUUq6C55d+jhxxmOKR04B3OadrHQ5bo0tVX pb87w/IUPAl0XXH3xQUxY3H0FCNEuBm6P0BvUEIOptndVMBvtJNlbRU4tzfZFmOxle lIQdMTPluxls4t/hHZaAJbGybvo7WoN+KTv7ufBg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35981: virtio_net: Do not send RSS key if it is not supported Date: Mon, 20 May 2024 11:42:46 +0200 Message-ID: <2024052026-CVE-2024-35981-2fb9@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3642; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=QWtboHrW0mrrvnF4W0C9nZMtUkHu+VeoFM6i/c7WJ0s=; b=owGbwMvMwCRo6H6F97bub03G02pJDGne0kwiV9Iep2gtFNymX+Ds6Gizd/76uXef7zWPaZvff rCuL/VgRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzEM5NhwTH/FWHxquXe9eIf Fyp2qTd/nDYlhWHB5qI9XiKzWZjE9yTG+IiGyhRfv/sTAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit 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. The Linux kernel CVE team has assigned CVE-2024-35981 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit c7114b1249fa and fixed in 6.1.90 with commit 539a2b995a4e Issue introduced in 5.18 with commit c7114b1249fa and fixed in 6.6.29 with commit 43a71c1b4b3a Issue introduced in 5.18 with commit c7114b1249fa and fixed in 6.8.7 with commit 28e9a64638cd Issue introduced in 5.18 with commit c7114b1249fa and fixed in 6.9 with commit 059a49aa2e25 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-35981 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/net/virtio_net.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/539a2b995a4ed93125cb0efae0f793b00ab2158b https://git.kernel.org/stable/c/43a71c1b4b3a6d4db857b1435d271540279fc7de https://git.kernel.org/stable/c/28e9a64638cd16bc1ecac9ff74ffeacb9fb652de https://git.kernel.org/stable/c/059a49aa2e25c58f90b50151f109dd3c4cdb3a47