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 DCE77211A39 for ; Thu, 27 Mar 2025 16:45:11 +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=1743093911; cv=none; b=bsDr7+nSetejFkqUm7ATw+va3C8ptyqyIhnS145MC8WkXsgtf/CdTR8hBa7dHupzc9q5IZeeiA9p2OpcThycFn32nqzDf4S18GbVtjWf69mLTYN9S/RaCt8XA58NL2kpEglDoq4jRUtviu+YixAbbJN9NpsPKfkK4yr/3wJBst0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743093911; c=relaxed/simple; bh=TnWrGmNM2y/EoPH10wYw7wqQ8BuR2NNKmY6REkX3LXU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UAvBcHw3bJ9UgrqCn2D8M06e+07zt5x5euzF6jwZ/z9zbwwiDTqqbuw2CxabkbdoUjnH9LCs7qWICR5IZUkDInhaGrUaY0JZhpH9ycF2DFWgKqwdIV0v0otrfYMH0MjPYKp9QRMTehwhzR40thokQSzCeRGrTn5Msanm8sORZYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IdrLlEXF; 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="IdrLlEXF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF5DFC4CEDD; Thu, 27 Mar 2025 16:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1743093911; bh=TnWrGmNM2y/EoPH10wYw7wqQ8BuR2NNKmY6REkX3LXU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=IdrLlEXFEtzJT7Oi9AXKa7i7W89jufLXdOe/9uA3uUerY56h5S7+vUIRBVu9LbAHj trB3YKQO3rbew1JsU9JhIVB3jg4gRFPnIAk0nZPQjGLNJ7zZPH+CthNiNByFo6BPRG AgmvOrGQlhKdonFMeH0UfakV1GUbZbG30JCRyv1c= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52973: vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF Date: Thu, 27 Mar 2025 17:43:20 +0100 Message-ID: <2025032703-CVE-2023-52973-a993@gregkh> X-Mailer: git-send-email 2.49.0 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=5863; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=TnWrGmNM2y/EoPH10wYw7wqQ8BuR2NNKmY6REkX3LXU=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlPG8Rjv0Qv7TPsLb+sP/VeUbOVcvSZ2OBgro9bxc4n5 ZlGXZvcEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABO5851hwaz91zrqUlNaORZ+ 3GvH5R99Pqbbg2HBXDGT6qI6zZ4718RPzdhz0OyYwIcrAA== 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: vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF After a call to console_unlock() in vcs_read() the vc_data struct can be freed by vc_deallocate(). Because of that, the struct vc_data pointer load must be done at the top of while loop in vcs_read() to avoid a UAF when vcs_size() is called. Syzkaller reported a UAF in vcs_size(). BUG: KASAN: use-after-free in vcs_size (drivers/tty/vt/vc_screen.c:215) Read of size 4 at addr ffff8881137479a8 by task 4a005ed81e27e65/1537 CPU: 0 PID: 1537 Comm: 4a005ed81e27e65 Not tainted 6.2.0-rc5 #1 Hardware name: Red Hat KVM, BIOS 1.15.0-2.module Call Trace: __asan_report_load4_noabort (mm/kasan/report_generic.c:350) vcs_size (drivers/tty/vt/vc_screen.c:215) vcs_read (drivers/tty/vt/vc_screen.c:415) vfs_read (fs/read_write.c:468 fs/read_write.c:450) ... Allocated by task 1191: ... kmalloc_trace (mm/slab_common.c:1069) vc_allocate (./include/linux/slab.h:580 ./include/linux/slab.h:720 drivers/tty/vt/vt.c:1128 drivers/tty/vt/vt.c:1108) con_install (drivers/tty/vt/vt.c:3383) tty_init_dev (drivers/tty/tty_io.c:1301 drivers/tty/tty_io.c:1413 drivers/tty/tty_io.c:1390) tty_open (drivers/tty/tty_io.c:2080 drivers/tty/tty_io.c:2126) chrdev_open (fs/char_dev.c:415) do_dentry_open (fs/open.c:883) vfs_open (fs/open.c:1014) ... Freed by task 1548: ... kfree (mm/slab_common.c:1021) vc_port_destruct (drivers/tty/vt/vt.c:1094) tty_port_destructor (drivers/tty/tty_port.c:296) tty_port_put (drivers/tty/tty_port.c:312) vt_disallocate_all (drivers/tty/vt/vt_ioctl.c:662 (discriminator 2)) vt_ioctl (drivers/tty/vt/vt_ioctl.c:903) tty_ioctl (drivers/tty/tty_io.c:2776) ... The buggy address belongs to the object at ffff888113747800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 424 bytes inside of 1024-byte region [ffff888113747800, ffff888113747c00) The buggy address belongs to the physical page: page:00000000b3fe6c7c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x113740 head:00000000b3fe6c7c order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0 anon flags: 0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff) raw: 0017ffffc0010200 ffff888100042dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888113747880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888113747900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > ffff888113747980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888113747a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888113747a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Disabling lock debugging due to kernel taint The Linux kernel CVE team has assigned CVE-2023-52973 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 4.14.329 with commit af79ea9a2443016f64d8fd8d72020cc874f0e066 Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 4.19.273 with commit 6332f52f44b9776568bf3c0b714ddfb0bb175e78 Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 5.4.232 with commit d0332cbf53dad06a22189cc341391237f4ea6d9f Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 5.10.168 with commit 55515d7d8743b71b80bfe68e89eb9d92630626ab Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 5.15.93 with commit fc9e27f3ba083534b8bbf72ab0f5c810ffdc7d18 Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 6.1.11 with commit 8506f16aae9daf354e3732bcfd447e2a97f023df Issue introduced in 2.6.38 with commit ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff and fixed in 6.2 with commit 226fae124b2dac217ea5436060d623ff3385bc34 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-52973 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/tty/vt/vc_screen.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/af79ea9a2443016f64d8fd8d72020cc874f0e066 https://git.kernel.org/stable/c/6332f52f44b9776568bf3c0b714ddfb0bb175e78 https://git.kernel.org/stable/c/d0332cbf53dad06a22189cc341391237f4ea6d9f https://git.kernel.org/stable/c/55515d7d8743b71b80bfe68e89eb9d92630626ab https://git.kernel.org/stable/c/fc9e27f3ba083534b8bbf72ab0f5c810ffdc7d18 https://git.kernel.org/stable/c/8506f16aae9daf354e3732bcfd447e2a97f023df https://git.kernel.org/stable/c/226fae124b2dac217ea5436060d623ff3385bc34