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 77FDF31B114 for ; Wed, 24 Dec 2025 10:58:20 +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=1766573900; cv=none; b=dnJnSXZG7BuoNPDeZ/uW83WvL+uAaj+l7AVg/Tg5y6qW6VdoMnkmSRBvif6Lsb6ii4Gr5CBgRAJ3+sE95PDuBdYsN5SKPZyv3MFvzeKcjJAWlOF9pq2CppiZ0LyUh/MOnYFlcZFUbhSGJUICQrNDyhlFx4voMsGd8obZrfJBCOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766573900; c=relaxed/simple; bh=hBJM9PLdxJDz6u/FItRqfHVf8dvPsxlWQPSbc9LyTWE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bwIPQespHX6YNex/R2lUlOuc7gu8/KoLdEsdzmxaq462BEYbnvG5l2P2o3Aq08qIx6NR3K8FlN/ynBOTB+1p8Omt3bcl6ZeBfONs0betgs50Xu1SHb0590/jHJZzLzUuCzse066n3cpuaXmCmk+WzPVDyfsGRCAOB8GGoRPSMMY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VuKs3GTW; 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="VuKs3GTW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3433C4CEFB; Wed, 24 Dec 2025 10:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766573900; bh=hBJM9PLdxJDz6u/FItRqfHVf8dvPsxlWQPSbc9LyTWE=; h=From:To:Cc:Subject:Date:Reply-To:From; b=VuKs3GTWQhbDMcHSKEb++paoDzIo/uJyciylxRC/Jwi9p+TTouZtvF50obRcP00Gb 7CwsHl2MI4Mwhof7U7rLngYJiKKmI9NMsX44aIXbRBRwNJIlizBnCp+IxR+/iK8Yda pRQhtyo8OTa8H702yvaksVQR7HhWlnaapM0BW6yw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-54008: virtio_vdpa: build affinity masks conditionally Date: Wed, 24 Dec 2025 11:56:52 +0100 Message-ID: <2025122429-CVE-2023-54008-cfde@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5280; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=DvkaFRd0tZ2PeAMwA4m3QYbk8IgerHR+7OjI/nJIPF0=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnex+7ma13lOrPekWXvHJu3xQ8npK27qtrzfffWVcz79 I4+L57r2xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQAX4WVYcHr7bkY/llClJ1xq ijmvViwvOuReyLBg4sS/TCpVeVNnxC1cPjVjUp/+MutoAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In 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. [1] [ 682.146655] WARNING: CPU: 6 PID: 1550 at lib/group_cpus.c:400 group_cpus_evenly+0x1aa/0x1c0 [ 682.146668] CPU: 6 PID: 1550 Comm: vdpa Not tainted 6.5.0-rc5jason+ #79 [ 682.146671] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 [ 682.146673] RIP: 0010:group_cpus_evenly+0x1aa/0x1c0 [ 682.146676] Code: 4c 89 e0 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc e8 1b c4 74 ff 48 89 ef e8 13 ac 98 ff 4c 89 e7 45 31 e4 e8 08 ac 98 ff eb c2 <0f> 0b eb b6 e8 fd 05 c3 00 45 31 e4 eb e5 cc cc cc cc cc cc cc cc [ 682.146679] RSP: 0018:ffffc9000215f498 EFLAGS: 00010293 [ 682.146682] RAX: 000000000001f1e0 RBX: 0000000000000041 RCX: 0000000000000000 [ 682.146684] RDX: ffff888109922058 RSI: 0000000000000041 RDI: 0000000000000030 [ 682.146686] RBP: ffff888109922058 R08: ffffc9000215f498 R09: ffffc9000215f4a0 [ 682.146687] R10: 00000000000198d0 R11: 0000000000000030 R12: ffff888107e02800 [ 682.146689] R13: 0000000000000030 R14: 0000000000000030 R15: 0000000000000041 [ 682.146692] FS: 00007fef52315740(0000) GS:ffff888237380000(0000) knlGS:0000000000000000 [ 682.146695] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 682.146696] CR2: 00007fef52509000 CR3: 0000000110dbc004 CR4: 0000000000370ee0 [ 682.146698] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 682.146700] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 682.146701] Call Trace: [ 682.146703] [ 682.146705] ? __warn+0x7b/0x130 [ 682.146709] ? group_cpus_evenly+0x1aa/0x1c0 [ 682.146712] ? report_bug+0x1c8/0x1e0 [ 682.146717] ? handle_bug+0x3c/0x70 [ 682.146721] ? exc_invalid_op+0x14/0x70 [ 682.146723] ? asm_exc_invalid_op+0x16/0x20 [ 682.146727] ? group_cpus_evenly+0x1aa/0x1c0 [ 682.146729] ? group_cpus_evenly+0x15c/0x1c0 [ 682.146731] create_affinity_masks+0xaf/0x1a0 [ 682.146735] virtio_vdpa_find_vqs+0x83/0x1d0 [ 682.146738] ? __pfx_default_calc_sets+0x10/0x10 [ 682.146742] virtnet_find_vqs+0x1f0/0x370 [ 682.146747] virtnet_probe+0x501/0xcd0 [ 682.146749] ? vp_modern_get_status+0x12/0x20 [ 682.146751] ? get_cap_addr.isra.0+0x10/0xc0 [ 682.146754] virtio_dev_probe+0x1af/0x260 [ 682.146759] really_probe+0x1a5/0x410 The Linux kernel CVE team has assigned CVE-2023-54008 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 3dad56823b5332ffdbe1867b2d7b50fbacea124a and fixed in 6.4.16 with commit 5f2592243ccd5bb5341f59be409ccfdd586841f3 Issue introduced in 6.4 with commit 3dad56823b5332ffdbe1867b2d7b50fbacea124a and fixed in 6.5.3 with commit 628b53fc66ca1910a3cb53c3c7e44e59750c3668 Issue introduced in 6.4 with commit 3dad56823b5332ffdbe1867b2d7b50fbacea124a and fixed in 6.6 with commit ae15aceaa98ad9499763923f7890e345d9f46b60 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-2023-54008 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/virtio/virtio_vdpa.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/5f2592243ccd5bb5341f59be409ccfdd586841f3 https://git.kernel.org/stable/c/628b53fc66ca1910a3cb53c3c7e44e59750c3668 https://git.kernel.org/stable/c/ae15aceaa98ad9499763923f7890e345d9f46b60