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 35FE33451AA for ; Wed, 24 Dec 2025 13:10:17 +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=1766581818; cv=none; b=XnXONVyig5xLonF9hn10GjmOtlDX6Bql4rSyNfkiEiaYkHrsn5vX6q4P79DeX2AYCw5Jr15TaXhs0VIHcDizk8PGTajqJ7xdz2TWAVpduSkLrQHqALNKjaQdjAV0mdIKtYhp89fdYnzHcdH6RvhPjYeeA3MLMuyQMJF+pw70/Us= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766581818; c=relaxed/simple; bh=9slpiF6IdYS9151KXkHwPujX249pU3lYHjaTIa4qHm0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bsrMP4TIPXMlnHMSzOU/i2CpM07PIQ6rB2xCk3DDaER3zeTRLAa2P8xQwa7ihb+eeFT6EiG8G/giLBOYrzFoCIsNW5I4e78Fi3bmcHoX9/h9heihHW0ofAkAAoE66j7PdEaAxoEu1fEM7zF8tqNrb1hB1ocZO3c1HEAFKNWQz6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xEdrY9rz; 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="xEdrY9rz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 526D4C4CEFB; Wed, 24 Dec 2025 13:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766581817; bh=9slpiF6IdYS9151KXkHwPujX249pU3lYHjaTIa4qHm0=; h=From:To:Cc:Subject:Date:Reply-To:From; b=xEdrY9rz2QA9o/pt2SQkA8rKDOhlvkogWkJ5IFSIud4NVnj6yQmD2QnvZ6wJ64qeR 0FKAl+SR+oLsZW7rpAxE6p+a07/lcVP+xrpkm4kOIq63ZFYJ/PXE1v34pgRRDE7bEf hXEeIY5Ho4bQvb8imDs9Eps+e7iiZnZrUbniNqug= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-54116: drm/fbdev-generic: prohibit potential out-of-bounds access Date: Wed, 24 Dec 2025 14:07:13 +0100 Message-ID: <2025122415-CVE-2023-54116-886b@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=5033; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=rd9h4pmdILAPbXdxZnh5hYLdsdRnpYDofiZprNPrMto=; b=owGbwMvMwCRo6H6F97bub03G02pJDJneT93/RxauerXz/7srjzZH7H7oee7+do6TM8v/FclEn wp6uP3LjY5YFgZBJgZZMUWWL9t4ju6vOKToZWh7GmYOKxPIEAYuTgGYyBEWhnkG6gwVepZaav5z ak6FMR2yDqxO/smwYFmu2M4aK4037AXha39e/cEkvUvqHgA= 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: drm/fbdev-generic: prohibit potential out-of-bounds access The fbdev test of IGT may write after EOF, which lead to out-of-bound access for drm drivers with fbdev-generic. For example, run fbdev test on a x86+ast2400 platform, with 1680x1050 resolution, will cause the linux kernel hang with the following call trace: Oops: 0000 [#1] PREEMPT SMP PTI [IGT] fbdev: starting subtest eof Workqueue: events drm_fb_helper_damage_work [drm_kms_helper] [IGT] fbdev: starting subtest nullptr RIP: 0010:memcpy_erms+0xa/0x20 RSP: 0018:ffffa17d40167d98 EFLAGS: 00010246 RAX: ffffa17d4eb7fa80 RBX: ffffa17d40e0aa80 RCX: 00000000000014c0 RDX: 0000000000001a40 RSI: ffffa17d40e0b000 RDI: ffffa17d4eb80000 RBP: ffffa17d40167e20 R08: 0000000000000000 R09: ffff89522ecff8c0 R10: ffffa17d4e4c5000 R11: 0000000000000000 R12: ffffa17d4eb7fa80 R13: 0000000000001a40 R14: 000000000000041a R15: ffffa17d40167e30 FS: 0000000000000000(0000) GS:ffff895257380000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffa17d40e0b000 CR3: 00000001eaeca006 CR4: 00000000001706e0 Call Trace: ? drm_fbdev_generic_helper_fb_dirty+0x207/0x330 [drm_kms_helper] drm_fb_helper_damage_work+0x8f/0x170 [drm_kms_helper] process_one_work+0x21f/0x430 worker_thread+0x4e/0x3c0 ? __pfx_worker_thread+0x10/0x10 kthread+0xf4/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2c/0x50 CR2: ffffa17d40e0b000 ---[ end trace 0000000000000000 ]--- The is because damage rectangles computed by drm_fb_helper_memory_range_to_clip() function is not guaranteed to be bound in the screen's active display area. Possible reasons are: 1) Buffers are allocated in the granularity of page size, for mmap system call support. The shadow screen buffer consumed by fbdev emulation may also choosed be page size aligned. 2) The DIV_ROUND_UP() used in drm_fb_helper_memory_range_to_clip() will introduce off-by-one error. For example, on a 16KB page size system, in order to store a 1920x1080 XRGB framebuffer, we need allocate 507 pages. Unfortunately, the size 1920*1080*4 can not be divided exactly by 16KB. 1920 * 1080 * 4 = 8294400 bytes 506 * 16 * 1024 = 8290304 bytes 507 * 16 * 1024 = 8306688 bytes line_length = 1920*4 = 7680 bytes 507 * 16 * 1024 / 7680 = 1081.6 off / line_length = 507 * 16 * 1024 / 7680 = 1081 DIV_ROUND_UP(507 * 16 * 1024, 7680) will yeild 1082 memcpy_toio() typically issue the copy line by line, when copy the last line, out-of-bound access will be happen. Because: 1082 * line_length = 1082 * 7680 = 8309760, and 8309760 > 8306688 Note that userspace may still write to the invisiable area if a larger buffer than width x stride is exposed. But it is not a big issue as long as there still have memory resolve the access if not drafting so far. - Also limit the y1 (Daniel) - keep fix patch it to minimal (Daniel) - screen_size is page size aligned because of it need mmap (Thomas) - Adding fixes tag (Thomas) The Linux kernel CVE team has assigned CVE-2023-54116 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit aa15c677cc34e626789cb65b8e7375180851c03b and fixed in 6.1.30 with commit efd2821b8abeccb6b51423002e2a62921481a26e Issue introduced in 5.18 with commit aa15c677cc34e626789cb65b8e7375180851c03b and fixed in 6.3.4 with commit 251653fa974ea551a15d16cacfed7cde68cc7f87 Issue introduced in 5.18 with commit aa15c677cc34e626789cb65b8e7375180851c03b and fixed in 6.4 with commit c8687694bb1f5c48134f152f8c5c2e53483eb99d 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-54116 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/gpu/drm/drm_fb_helper.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/efd2821b8abeccb6b51423002e2a62921481a26e https://git.kernel.org/stable/c/251653fa974ea551a15d16cacfed7cde68cc7f87 https://git.kernel.org/stable/c/c8687694bb1f5c48134f152f8c5c2e53483eb99d