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 86A5B25C6E1 for ; Fri, 2 May 2025 16:01:24 +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=1746201684; cv=none; b=QWiUpDCUOanN3w0aqq4P+AIU4Nx6/RjNqagjxvb/dAmcqx3WOpvaKn6cNFgRKSsm3dbZeiD1O+7g+68zQ0jp7I6b1gVfQRCVW++4qIWpsfROLgDRBq90rIEL91/OtTz0yPWycy5Vixqeyi2hiMRI2mMDvbfZSZdDobHKDiKiFqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746201684; c=relaxed/simple; bh=+1wdHVaFr0aXAv3jU2GW4MMbWPs/FGFeMnfqsgwlNV0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OGQgPgHwlbNaYs7BLBU/auHLMnDftXDVGgEbOQURYSmAJSaH76PPYCVUaz0+wZNJ4G7UXWZeEx8Hjj2VFLIKQ25dg5RDxs81fF5xsXAlP5S5P0oZqZNJOQnnJUYo/3UBg4zR+VZIAQ75Q83jgI3SrEnfyq5yb/IOadhhhGn4oxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B6/+qcTA; 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="B6/+qcTA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1405AC4CEE4; Fri, 2 May 2025 16:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746201684; bh=+1wdHVaFr0aXAv3jU2GW4MMbWPs/FGFeMnfqsgwlNV0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=B6/+qcTAeOFzcM7GHBjd5at6EjudxU/LuNprJE0xc5YDirsaXXt42E7A9A+7KHPO+ mFB1YYhBIv99DjKgUXj1h+Swp/Sq4ngJaaXk+92/zo9agKkd9AIYLZkLni8LbFZSR6 0ncp2vk1WV+umWTTtdqpjB9O5avZcS78V/fNeSSE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53135: riscv: Use READ_ONCE_NOCHECK in imprecise unwinding stack mode Date: Fri, 2 May 2025 17:56:40 +0200 Message-ID: <2025050236-CVE-2023-53135-3c65@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=6250; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=0NYJcXinDzSXttvPDTmqm1LdUkHC4x4d6x77dVJHIy8=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkir34U/D21wcBOm+fr25IqNi6exhV1R9kCEh/H8Lw+e bEl/49IRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzk13mGuSIJ+U52zr/UJ197 5K7WMf3doi+x6Qzz9G51v/5f+iK6YcGdl35rTcOZnl+uBQA= 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: riscv: Use READ_ONCE_NOCHECK in imprecise unwinding stack mode When CONFIG_FRAME_POINTER is unset, the stack unwinding function walk_stackframe randomly reads the stack and then, when KASAN is enabled, it can lead to the following backtrace: [ 0.000000] ================================================================== [ 0.000000] BUG: KASAN: stack-out-of-bounds in walk_stackframe+0xa6/0x11a [ 0.000000] Read of size 8 at addr ffffffff81807c40 by task swapper/0 [ 0.000000] [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.2.0-12919-g24203e6db61f #43 [ 0.000000] Hardware name: riscv-virtio,qemu (DT) [ 0.000000] Call Trace: [ 0.000000] [] walk_stackframe+0x0/0x11a [ 0.000000] [] init_param_lock+0x26/0x2a [ 0.000000] [] walk_stackframe+0xa2/0x11a [ 0.000000] [] dump_stack_lvl+0x22/0x36 [ 0.000000] [] print_report+0x198/0x4a8 [ 0.000000] [] init_param_lock+0x26/0x2a [ 0.000000] [] walk_stackframe+0xa2/0x11a [ 0.000000] [] kasan_report+0x9a/0xc8 [ 0.000000] [] walk_stackframe+0xa2/0x11a [ 0.000000] [] walk_stackframe+0xa2/0x11a [ 0.000000] [] desc_make_final+0x80/0x84 [ 0.000000] [] stack_trace_save+0x88/0xa6 [ 0.000000] [] filter_irq_stacks+0x72/0x76 [ 0.000000] [] devkmsg_read+0x32a/0x32e [ 0.000000] [] kasan_save_stack+0x28/0x52 [ 0.000000] [] desc_make_final+0x7c/0x84 [ 0.000000] [] stack_trace_save+0x84/0xa6 [ 0.000000] [] kasan_set_track+0x12/0x20 [ 0.000000] [] __kasan_slab_alloc+0x58/0x5e [ 0.000000] [] __kmem_cache_create+0x21e/0x39a [ 0.000000] [] create_boot_cache+0x70/0x9c [ 0.000000] [] kmem_cache_init+0x6c/0x11e [ 0.000000] [] mm_init+0xd8/0xfe [ 0.000000] [] start_kernel+0x190/0x3ca [ 0.000000] [ 0.000000] The buggy address belongs to stack of task swapper/0 [ 0.000000] and is located at offset 0 in frame: [ 0.000000] stack_trace_save+0x0/0xa6 [ 0.000000] [ 0.000000] This frame has 1 object: [ 0.000000] [32, 56) 'c' [ 0.000000] [ 0.000000] The buggy address belongs to the physical page: [ 0.000000] page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x81a07 [ 0.000000] flags: 0x1000(reserved|zone=0) [ 0.000000] raw: 0000000000001000 ff600003f1e3d150 ff600003f1e3d150 0000000000000000 [ 0.000000] raw: 0000000000000000 0000000000000000 00000001ffffffff [ 0.000000] page dumped because: kasan: bad access detected [ 0.000000] [ 0.000000] Memory state around the buggy address: [ 0.000000] ffffffff81807b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0.000000] ffffffff81807b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0.000000] >ffffffff81807c00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 f3 [ 0.000000] ^ [ 0.000000] ffffffff81807c80: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 [ 0.000000] ffffffff81807d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0.000000] ================================================================== Fix that by using READ_ONCE_NOCHECK when reading the stack in imprecise mode. The Linux kernel CVE team has assigned CVE-2023-53135 to this issue. Affected and fixed versions =========================== Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 5.4.237 with commit a99a61d9e1bfca2fc37d223a6a185c0eb66aba02 Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 5.10.175 with commit 3de277af481ab931fab9e295ad8762692920732a Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 5.15.103 with commit 3a9418d2c93c1c86ce4d0595112d91c7a8e70c2c Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 6.1.20 with commit 324912d6c0c4006711054d389faa2239c1655e1e Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 6.2.7 with commit 17fa90ffba20743c946920fbb0afe160d0ead8c9 Issue introduced in 4.15 with commit 5d8544e2d0075a5f3c9a2cf27152354d54360da1 and fixed in 6.3 with commit 76950340cf03b149412fe0d5f0810e52ac1df8cb 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-53135 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/riscv/kernel/stacktrace.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/a99a61d9e1bfca2fc37d223a6a185c0eb66aba02 https://git.kernel.org/stable/c/3de277af481ab931fab9e295ad8762692920732a https://git.kernel.org/stable/c/3a9418d2c93c1c86ce4d0595112d91c7a8e70c2c https://git.kernel.org/stable/c/324912d6c0c4006711054d389faa2239c1655e1e https://git.kernel.org/stable/c/17fa90ffba20743c946920fbb0afe160d0ead8c9 https://git.kernel.org/stable/c/76950340cf03b149412fe0d5f0810e52ac1df8cb