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 DF8D3200AF for ; Thu, 22 Aug 2024 03:33:05 +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=1724297586; cv=none; b=uz7uXJRasXnW7Z6hx7+qh/1jDnt5h+3r2v2y5saMWuKDdxczpSJdG9tAl9+s8CCXP190dy6EfILhsh7nUnq9C3c6kz1Yf4OiGNhkmb4sQ8NttbasemzmbDJS01E14WQyPAsxQgb1sJQTrQyacd+dEVz3umkJuxida0NV3Axwt8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724297586; c=relaxed/simple; bh=pYWOg9g3dQDJpoEcPiStE/yOm8Pusu3aVwqL7he9+iM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aBKL69WA1ld4PlD/ZZ6Fml0oTZ/2h9dUMqTq/rjD5aG4Z5rbfSPmizRZ3UIQ+zd0L0QLhVyYhVt/KVHX9wrj+6yAwxjLBh+aIzuBhfyTrzMvXRUhQ5LKtzMfuXO5cUxnsQzPe6H5Y0jEKV2OSql8lxVv3ShxvvoMIizctD7/4+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B4iJRNRW; 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="B4iJRNRW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60135C4AF09; Thu, 22 Aug 2024 03:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724297585; bh=pYWOg9g3dQDJpoEcPiStE/yOm8Pusu3aVwqL7he9+iM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=B4iJRNRWep3CJ3Ljm4qUBQSk2gnbnMyv7oF9klbE/UBJQoM05S8iqTYOWmcd+hJrP qPceyIbA5TyDAeuM0lFSpRfDuEUhDoeVZBYSVhhJxYNWG3kCf2Jqqj05NlskDLwVlc DGhuBp/ts/Motl5b7kyO4SNvz745S761joA65k7Y= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48923: btrfs: prevent copying too big compressed lzo segment Date: Thu, 22 Aug 2024 11:31:24 +0800 Message-ID: <2024082219-CVE-2022-48923-9db1@gregkh> X-Mailer: git-send-email 2.46.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=4247; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=pYWOg9g3dQDJpoEcPiStE/yOm8Pusu3aVwqL7he9+iM=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnHNrLHLRbpjV5QzpK8xnGp44xNwo3rQvTu6DassvULW e+l90q1I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZitZdhfpqc87Rbq+s/HV3q mrip/OjVcx+a1jLM4d8ya7Xyil/vt7HltzIbTVbdzeOlDgA= 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: btrfs: prevent copying too big compressed lzo segment Compressed length can be corrupted to be a lot larger than memory we have allocated for buffer. This will cause memcpy in copy_compressed_segment to write outside of allocated memory. This mostly results in stuck read syscall but sometimes when using btrfs send can get #GP kernel: general protection fault, probably for non-canonical address 0x841551d5c1000: 0000 [#1] PREEMPT SMP NOPTI kernel: CPU: 17 PID: 264 Comm: kworker/u256:7 Tainted: P OE 5.17.0-rc2-1 #12 kernel: Workqueue: btrfs-endio btrfs_work_helper [btrfs] kernel: RIP: 0010:lzo_decompress_bio (./include/linux/fortify-string.h:225 fs/btrfs/lzo.c:322 fs/btrfs/lzo.c:394) btrfs Code starting with the faulting instruction =========================================== 0:* 48 8b 06 mov (%rsi),%rax <-- trapping instruction 3: 48 8d 79 08 lea 0x8(%rcx),%rdi 7: 48 83 e7 f8 and $0xfffffffffffffff8,%rdi b: 48 89 01 mov %rax,(%rcx) e: 44 89 f0 mov %r14d,%eax 11: 48 8b 54 06 f8 mov -0x8(%rsi,%rax,1),%rdx kernel: RSP: 0018:ffffb110812efd50 EFLAGS: 00010212 kernel: RAX: 0000000000001000 RBX: 000000009ca264c8 RCX: ffff98996e6d8ff8 kernel: RDX: 0000000000000064 RSI: 000841551d5c1000 RDI: ffffffff9500435d kernel: RBP: ffff989a3be856c0 R08: 0000000000000000 R09: 0000000000000000 kernel: R10: 0000000000000000 R11: 0000000000001000 R12: ffff98996e6d8000 kernel: R13: 0000000000000008 R14: 0000000000001000 R15: 000841551d5c1000 kernel: FS: 0000000000000000(0000) GS:ffff98a09d640000(0000) knlGS:0000000000000000 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 kernel: CR2: 00001e9f984d9ea8 CR3: 000000014971a000 CR4: 00000000003506e0 kernel: Call Trace: kernel: kernel: end_compressed_bio_read (fs/btrfs/compression.c:104 fs/btrfs/compression.c:1363 fs/btrfs/compression.c:323) btrfs kernel: end_workqueue_fn (fs/btrfs/disk-io.c:1923) btrfs kernel: btrfs_work_helper (fs/btrfs/async-thread.c:326) btrfs kernel: process_one_work (./arch/x86/include/asm/jump_label.h:27 ./include/linux/jump_label.h:212 ./include/trace/events/workqueue.h:108 kernel/workqueue.c:2312) kernel: worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2455) kernel: ? process_one_work (kernel/workqueue.c:2397) kernel: kthread (kernel/kthread.c:377) kernel: ? kthread_complete_and_exit (kernel/kthread.c:332) kernel: ret_from_fork (arch/x86/entry/entry_64.S:301) kernel: The Linux kernel CVE team has assigned CVE-2022-48923 to this issue. Affected and fixed versions =========================== Fixed in 5.15.26 with commit 8df508b7a44c Fixed in 5.16.12 with commit e326bd06cdde Fixed in 5.17 with commit 741b23a970a7 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-2022-48923 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: fs/btrfs/lzo.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/8df508b7a44cd8110c726057cd28e8f8116885eb https://git.kernel.org/stable/c/e326bd06cdde46df952361456232022298281d16 https://git.kernel.org/stable/c/741b23a970a79d5d3a1db2d64fa2c7b375a4febb