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 0C456144D16 for ; Tue, 21 May 2024 15:39:28 +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=1716305968; cv=none; b=c3N9jRfVifDq5BuEPWmQFyZizPNexCnuAFrLY5WmFToWd9iSUQnWkOYDeOoIf4KIDwVHzWooCx1UdUnWN/8S4wLgJJ6ef6GIOBOOVWviGDlnma2fRHBLgeBebvEv6dfTcRt+PB5kLn4zUshZCK036qAWmVIS7P3u2983mS7ImAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716305968; c=relaxed/simple; bh=VHWVZM8uyAbbIMTI6Cq6h5AjM4AS35PN2bvSi6bBmNE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R0lV0TMKcIqGXvEwywHX47/cMnIxCe66POzST/1JrbUv2i6cfsLSR+ewNvmiFlye34mWOzZORYLNiEdaU67SbDtLN+ileW1JhmoroyAAx6Gt434a86BqfagEjKRiIrTP8G93sj7u+XmmF2GqMXUAMt0d1DXb69pbswednUAPkM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GD74U0Kv; 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="GD74U0Kv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8323AC2BD11; Tue, 21 May 2024 15:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716305967; bh=VHWVZM8uyAbbIMTI6Cq6h5AjM4AS35PN2bvSi6bBmNE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=GD74U0KvTI/ow0VWKT1fHW3rvnGpn2zx2Pf4qNXx4JYk6Ye6i4clt1U4zsRNEOnmz hIVUSKmkvfcOmtZAAq8kyUrkFzOmrx4Iklx6CzEKTf+7CL+8fwA2G1DicLmJyft6Ab Zhy4StlXK32790ZYoQ1RPFvzv2/BJXf3FdjxjrJM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52842: virtio/vsock: Fix uninit-value in virtio_transport_recv_pkt() Date: Tue, 21 May 2024 17:32:18 +0200 Message-ID: <2024052111-CVE-2023-52842-711c@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=4973; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=VHWVZM8uyAbbIMTI6Cq6h5AjM4AS35PN2bvSi6bBmNE=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk++xzE+ZIFbK9V5FoGva5/NOlb15HNG/80pa6PTnnWH +P72PdDRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEyk4RLDfO//BWe/lj23DI+9 sHe3wfXnxj/qxRjmyjiXHvyeu+VOzofwvsDbM6+cE66qBgA= 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/vsock: Fix uninit-value in virtio_transport_recv_pkt() KMSAN reported the following uninit-value access issue: ===================================================== BUG: KMSAN: uninit-value in virtio_transport_recv_pkt+0x1dfb/0x26a0 net/vmw_vsock/virtio_transport_common.c:1421 virtio_transport_recv_pkt+0x1dfb/0x26a0 net/vmw_vsock/virtio_transport_common.c:1421 vsock_loopback_work+0x3bb/0x5a0 net/vmw_vsock/vsock_loopback.c:120 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0xff6/0x1e60 kernel/workqueue.c:2703 worker_thread+0xeca/0x14d0 kernel/workqueue.c:2784 kthread+0x3cc/0x520 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Uninit was stored to memory at: virtio_transport_space_update net/vmw_vsock/virtio_transport_common.c:1274 [inline] virtio_transport_recv_pkt+0x1ee8/0x26a0 net/vmw_vsock/virtio_transport_common.c:1415 vsock_loopback_work+0x3bb/0x5a0 net/vmw_vsock/vsock_loopback.c:120 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0xff6/0x1e60 kernel/workqueue.c:2703 worker_thread+0xeca/0x14d0 kernel/workqueue.c:2784 kthread+0x3cc/0x520 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Uninit was created at: slab_post_alloc_hook+0x105/0xad0 mm/slab.h:767 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5a2/0xaf0 mm/slub.c:3523 kmalloc_reserve+0x13c/0x4a0 net/core/skbuff.c:559 __alloc_skb+0x2fd/0x770 net/core/skbuff.c:650 alloc_skb include/linux/skbuff.h:1286 [inline] virtio_vsock_alloc_skb include/linux/virtio_vsock.h:66 [inline] virtio_transport_alloc_skb+0x90/0x11e0 net/vmw_vsock/virtio_transport_common.c:58 virtio_transport_reset_no_sock net/vmw_vsock/virtio_transport_common.c:957 [inline] virtio_transport_recv_pkt+0x1279/0x26a0 net/vmw_vsock/virtio_transport_common.c:1387 vsock_loopback_work+0x3bb/0x5a0 net/vmw_vsock/vsock_loopback.c:120 process_one_work kernel/workqueue.c:2630 [inline] process_scheduled_works+0xff6/0x1e60 kernel/workqueue.c:2703 worker_thread+0xeca/0x14d0 kernel/workqueue.c:2784 kthread+0x3cc/0x520 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 CPU: 1 PID: 10664 Comm: kworker/1:5 Not tainted 6.6.0-rc3-00146-g9f3ebbef746f #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014 Workqueue: vsock-loopback vsock_loopback_work ===================================================== The following simple reproducer can cause the issue described above: int main(void) { int sock; struct sockaddr_vm addr = { .svm_family = AF_VSOCK, .svm_cid = VMADDR_CID_ANY, .svm_port = 1234, }; sock = socket(AF_VSOCK, SOCK_STREAM, 0); connect(sock, (struct sockaddr *)&addr, sizeof(addr)); return 0; } This issue occurs because the `buf_alloc` and `fwd_cnt` fields of the `struct virtio_vsock_hdr` are not initialized when a new skb is allocated in `virtio_transport_init_hdr()`. This patch resolves the issue by initializing these fields during allocation. The Linux kernel CVE team has assigned CVE-2023-52842 to this issue. Affected and fixed versions =========================== Issue introduced in 6.3 with commit 71dc9ec9ac7d and fixed in 6.6.2 with commit 0b8906fb48b9 Issue introduced in 6.3 with commit 71dc9ec9ac7d and fixed in 6.7 with commit 34c4effacfc3 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-52842 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: net/vmw_vsock/virtio_transport_common.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/cd12535b97dd7d18cf655ec78ce1cf1f29a576be https://git.kernel.org/stable/c/0b8906fb48b99e993d6e8a12539f618f4854dd26 https://git.kernel.org/stable/c/34c4effacfc329aeca5635a69fd9e0f6c90b4101