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 D29D22E3B19 for ; Tue, 7 Oct 2025 15:22:37 +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=1759850557; cv=none; b=eCato7YhsNt62gFWxVVddwG9ZIAPycDGZQ4EEe8yb3TD9SN+TJ4ZuelFLwYC6OFTNerwn8FPEKew6Q9RPumugkMorcmthlk2nqHlc2KtL3uvlGXEXKKYDPQ4a0GPnU7fqcRzNv3VNOGyaPAPmd9TBJ+31nQQTrEkxQYffiKZ+GI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759850557; c=relaxed/simple; bh=Iu6yR27oYJKMZBuAIwvcUJ6bCgueLpqiElb9ORmTvtE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AbEPYyyzdNp6xlMfSdDny0pZxp9X3qVNefKBbH5Xc33u+7aROvF+n+zxG9mf/svvANqdCUa6K8PsnUVV8LREy1b1OofF/gmhOjD7fozFM6LfUEWrlE15MlINgfs/8F8RGwKkvr+UdByAPRunp0qNUHFFm1BniH/kgsA4JovZaxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kdQgiH3k; 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="kdQgiH3k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB9BC4CEF1; Tue, 7 Oct 2025 15:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759850557; bh=Iu6yR27oYJKMZBuAIwvcUJ6bCgueLpqiElb9ORmTvtE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=kdQgiH3kqOn8hQKxO3iYAISBVzYK4S0oBFvYDID/f5ijoU+D0aP0zvIx5YJcO5mQ/ SsFXP5URoC+PUmxe8t4dTS0ruT+8GBW3PpuaOcawVlqi9m21klYdmPzlbIwdCFnkN5 psMPofU3s+QUIARxYch8aahZDIGDaOL2R7vyCL9A= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53642: x86: fix clear_user_rep_good() exception handling annotation Date: Tue, 7 Oct 2025 17:19:47 +0200 Message-ID: <2025100716-CVE-2023-53642-a8f8@gregkh> X-Mailer: git-send-email 2.51.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=4945; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=axmvlEdskp73RnhVxfKaFUmu8uBr/YqJAwuUr8IF3LM=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlP9UtsbRXcTv9gUO9xXyeflvVVdsOtQ3/rnKOdF1+Ni DI2Tr/dEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABPRaWdYcOOU6oa1c6+a8DN7 WBhuMt/z/OXHkwwLNn9YH7Tz5eN7AeU+MhLfFKb8mR5vAgA= 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: x86: fix clear_user_rep_good() exception handling annotation This code no longer exists in mainline, because it was removed in commit d2c95f9d6802 ("x86: don't use REP_GOOD or ERMS for user memory clearing") upstream. However, rather than backport the full range of x86 memory clearing and copying cleanups, fix the exception table annotation placement for the final 'rep movsb' in clear_user_rep_good(): rather than pointing at the actual instruction that did the user space access, it pointed to the register move just before it. That made sense from a code flow standpoint, but not from an actual usage standpoint: it means that if user access takes an exception, the exception handler won't actually find the instruction in the exception tables. As a result, rather than fixing it up and returning -EFAULT, it would then turn it into a kernel oops report instead, something like: BUG: unable to handle page fault for address: 0000000020081000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page ... RIP: 0010:clear_user_rep_good+0x1c/0x30 arch/x86/lib/clear_page_64.S:147 ... Call Trace: __clear_user arch/x86/include/asm/uaccess_64.h:103 [inline] clear_user arch/x86/include/asm/uaccess_64.h:124 [inline] iov_iter_zero+0x709/0x1290 lib/iov_iter.c:800 iomap_dio_hole_iter fs/iomap/direct-io.c:389 [inline] iomap_dio_iter fs/iomap/direct-io.c:440 [inline] __iomap_dio_rw+0xe3d/0x1cd0 fs/iomap/direct-io.c:601 iomap_dio_rw+0x40/0xa0 fs/iomap/direct-io.c:689 ext4_dio_read_iter fs/ext4/file.c:94 [inline] ext4_file_read_iter+0x4be/0x690 fs/ext4/file.c:145 call_read_iter include/linux/fs.h:2183 [inline] do_iter_readv_writev+0x2e0/0x3b0 fs/read_write.c:733 do_iter_read+0x2f2/0x750 fs/read_write.c:796 vfs_readv+0xe5/0x150 fs/read_write.c:916 do_preadv+0x1b6/0x270 fs/read_write.c:1008 __do_sys_preadv2 fs/read_write.c:1070 [inline] __se_sys_preadv2 fs/read_write.c:1061 [inline] __x64_sys_preadv2+0xef/0x150 fs/read_write.c:1061 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd which then looks like a filesystem bug rather than the incorrect exception annotation that it is. [ The alternative to this one-liner fix is to take the upstream series that cleans this all up: 68674f94ffc9 ("x86: don't use REP_GOOD or ERMS for small memory copies") 20f3337d350c ("x86: don't use REP_GOOD or ERMS for small memory clearing") adfcf4231b8c ("x86: don't use REP_GOOD or ERMS for user memory copies") * d2c95f9d6802 ("x86: don't use REP_GOOD or ERMS for user memory clearing") 3639a535587d ("x86: move stac/clac from user copy routines into callers") 577e6a7fd50d ("x86: inline the 'rep movs' in user copies for the FSRM case") 8c9b6a88b7e2 ("x86: improve on the non-rep 'clear_user' function") 427fda2c8a49 ("x86: improve on the non-rep 'copy_user' function") * e046fe5a36a9 ("x86: set FSRS automatically on AMD CPUs that have FSRM") e1f2750edc4a ("x86: remove 'zerorest' argument from __copy_user_nocache()") 034ff37d3407 ("x86: rewrite '__copy_user_nocache' function") with either the whole series or at a minimum the two marked commits being needed to fix this issue ] The Linux kernel CVE team has assigned CVE-2023-53642 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit 0db7058e8e23e6bbab1b4747ecabd1784c34f50b and fixed in 6.1.29 with commit 76ce32682635fe907e0f8e64e039e773e5c7508f 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-53642 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: arch/x86/lib/clear_page_64.S 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/76ce32682635fe907e0f8e64e039e773e5c7508f