From mboxrd@z Thu Jan 1 00:00:00 1970 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 B8076192B82 for ; Sat, 11 Jan 2025 12:36:16 +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=1736598976; cv=none; b=DmUBadMlFI6VnQ2ifnE5u+mt/MZeemG823eO9l58f3oZ2OdpI3wUbSVpVMsdhk/G/NP+okRpbyV3u65COOpDWsE8EQLfVC9aPLn6w77rdwXrwYcdyJqmsGGBf//66gQjZYTKmYNQzK3nc2hz2NxT4s5k6/80/mkcd/B7vJ97fG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736598976; c=relaxed/simple; bh=NhGlowtYk4VkGic2wamV+eNEQg+pdeyvhNU64rQFOWE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hyDLLOcOF/D9a2t25u73/jfYs50cjEIqXaOpx5H0+ekF2q9bJx8r0yQco/02SZjxT4nU7wmEhq+eaOVcj2wlpTA82rZMdDpinQdfYwMVKxcBxV44C/4pSetYaluWbAtvWKJsAtFH0y7fZ/fJdV5rTKB6bVCXkgQtpqfHwSvjdpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DV/rkmwb; 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="DV/rkmwb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C378C4CED2; Sat, 11 Jan 2025 12:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736598976; bh=NhGlowtYk4VkGic2wamV+eNEQg+pdeyvhNU64rQFOWE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=DV/rkmwbifHOzLcBB4+UhtC2kX0DcAEgXW0gY2SV1IfXkQXcTKX+irhwzQgWk0s+a IsxAgXXyVGJffK3i84tjOulduefRpzDdk828XzuBMsRkUJIOfUnF0BJ1R2FPBe3r7u +qs9y3UDEWkKc8XAm5QaqNHoAc7c1dGvB77bsEvs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56368: ring-buffer: Fix overflow in __rb_map_vma Date: Sat, 11 Jan 2025 13:35:57 +0100 Message-ID: <2025011146-CVE-2024-56368-e3cd@gregkh> X-Mailer: git-send-email 2.48.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=4085; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NhGlowtYk4VkGic2wamV+eNEQg+pdeyvhNU64rQFOWE=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlNqYsePbaqm33tYdK9jpc9h/mXTpIIf7+drzHpnsCGW xf/P6mp6ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJvL3HMM/g2zzx+7ybFy9M y3h196x//7yq9WsY5vD7/7X0uHFfZ5XOerkC1q5ojy4nLgA= 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: ring-buffer: Fix overflow in __rb_map_vma An overflow occurred when performing the following calculation: nr_pages = ((nr_subbufs + 1) << subbuf_order) - pgoff; Add a check before the calculation to avoid this problem. syzbot reported this as a slab-out-of-bounds in __rb_map_vma: BUG: KASAN: slab-out-of-bounds in __rb_map_vma+0x9ab/0xae0 kernel/trace/ring_buffer.c:7058 Read of size 8 at addr ffff8880767dd2b8 by task syz-executor187/5836 CPU: 0 UID: 0 PID: 5836 Comm: syz-executor187 Not tainted 6.13.0-rc2-syzkaller-00159-gf932fb9b4074 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 __rb_map_vma+0x9ab/0xae0 kernel/trace/ring_buffer.c:7058 ring_buffer_map+0x56e/0x9b0 kernel/trace/ring_buffer.c:7138 tracing_buffers_mmap+0xa6/0x120 kernel/trace/trace.c:8482 call_mmap include/linux/fs.h:2183 [inline] mmap_file mm/internal.h:124 [inline] __mmap_new_file_vma mm/vma.c:2291 [inline] __mmap_new_vma mm/vma.c:2355 [inline] __mmap_region+0x1786/0x2670 mm/vma.c:2456 mmap_region+0x127/0x320 mm/mmap.c:1348 do_mmap+0xc00/0xfc0 mm/mmap.c:496 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:580 ksys_mmap_pgoff+0x32c/0x5c0 mm/mmap.c:542 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:82 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The reproducer for this bug is: ------------------------8<------------------------- #include #include #include #include #include int main(int argc, char **argv) { int page_size = getpagesize(); int fd; void *meta; system("echo 1 > /sys/kernel/tracing/buffer_size_kb"); fd = open("/sys/kernel/tracing/per_cpu/cpu0/trace_pipe_raw", O_RDONLY); meta = mmap(NULL, page_size, PROT_READ, MAP_SHARED, fd, page_size * 5); } ------------------------>8------------------------- The Linux kernel CVE team has assigned CVE-2024-56368 to this issue. Affected and fixed versions =========================== Issue introduced in 6.10 with commit 117c39200d9d760cbd5944bb89efb7b9c51965aa and fixed in 6.12.7 with commit ec12f30fe54234dd40ffee50dda8d2df10bd0871 Issue introduced in 6.10 with commit 117c39200d9d760cbd5944bb89efb7b9c51965aa and fixed in 6.13-rc4 with commit c58a812c8e49ad688f94f4b050ad5c5b388fc5d2 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-2024-56368 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: kernel/trace/ring_buffer.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/ec12f30fe54234dd40ffee50dda8d2df10bd0871 https://git.kernel.org/stable/c/c58a812c8e49ad688f94f4b050ad5c5b388fc5d2