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 B88C4285073 for ; Wed, 18 Jun 2025 11:02:51 +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=1750244571; cv=none; b=Jkz9w+OuXFlmkiVuURfBc+/rATyhp5bgLjd2/qr2ERIeBmxG/+WcqQCMh/nQitIxJYLRNb6whl0WOl3KgM7R0C2f2y7Avr+fsp9NY+9PKru1ZvNC3AyF6KF3WR0kbM7W/g/gMK+EzpSaiy7F4fnHipEH1PomWs5bkeXWB2rItsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244571; c=relaxed/simple; bh=eTR/HW/FAVw6hvw/gkgGrWaMW0uNvC4HX3hf/I+ZOyQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AgN1iSAraLzbR9zbpG91QpFvUsR9/NT/h9hA7A/cs2kXm2RKFtu76HvCrEidy9iDEAtAES5fYscbjLBj4ptFtt3YJZUsfac1Xl9sxiZnaW6G2yu0XL4m7xnaCyWD0w5BaVX0C5eIcpZKwc0g6u+DtP4MDgIURzdHVOIPgc21AOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=z/ogFanv; 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="z/ogFanv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 480B1C4CEE7; Wed, 18 Jun 2025 11:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244571; bh=eTR/HW/FAVw6hvw/gkgGrWaMW0uNvC4HX3hf/I+ZOyQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=z/ogFanvD6dtqiKwXrmkYQs1fr5ONAr81j804wYvpjE0rxCG9iEiHg4yJtXQwBHRb Mikl2SJSgGchTeQxh6BNlnrlkrxzEhkhuHPTJauj+ZvEl9Q4bNkI5oPHMVj51u+jtq LK/le3orVOWRg7cAC3ujRmH5O5zJGEte8VwKtZg4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49947: binder: fix alloc->vma_vm_mm null-ptr dereference Date: Wed, 18 Jun 2025 13:00:12 +0200 Message-ID: <2025061808-CVE-2022-49947-0737@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=4259; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=QdNvjwQcxlUDaOQlgdX0qrxHnVpJ+ZH59HkeUSbcAj8=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBcywPPZm7Qen/fwP5A0J1S9Y8ibjbqPBcvjkpff/Kk 0VaTs1hHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRnOUM8xNWsyzlDk59HBLI +NREKdk+8Uv0G4b5Lms+HV+jInPso7qjZafdPgONin/PAA== 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: binder: fix alloc->vma_vm_mm null-ptr dereference Syzbot reported a couple issues introduced by commit 44e602b4e52f ("binder_alloc: add missing mmap_lock calls when using the VMA"), in which we attempt to acquire the mmap_lock when alloc->vma_vm_mm has not been initialized yet. This can happen if a binder_proc receives a transaction without having previously called mmap() to setup the binder_proc->alloc space in [1]. Also, a similar issue occurs via binder_alloc_print_pages() when we try to dump the debugfs binder stats file in [2]. Sample of syzbot's crash report: ================================================================== KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f] CPU: 0 PID: 3755 Comm: syz-executor229 Not tainted 6.0.0-rc1-next-20220819-syzkaller #0 syz-executor229[3755] cmdline: ./syz-executor2294415195 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:__lock_acquire+0xd83/0x56d0 kernel/locking/lockdep.c:4923 [...] Call Trace: lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 down_read+0x98/0x450 kernel/locking/rwsem.c:1499 mmap_read_lock include/linux/mmap_lock.h:117 [inline] binder_alloc_new_buf_locked drivers/android/binder_alloc.c:405 [inline] binder_alloc_new_buf+0xa5/0x19e0 drivers/android/binder_alloc.c:593 binder_transaction+0x242e/0x9a80 drivers/android/binder.c:3199 binder_thread_write+0x664/0x3220 drivers/android/binder.c:3986 binder_ioctl_write_read drivers/android/binder.c:5036 [inline] binder_ioctl+0x3470/0x6d00 drivers/android/binder.c:5323 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] ================================================================== Fix these issues by setting up alloc->vma_vm_mm pointer during open() and caching directly from current->mm. This guarantees we have a valid reference to take the mmap_lock during scenarios described above. [1] https://syzkaller.appspot.com/bug?extid=f7dc54e5be28950ac459 [2] https://syzkaller.appspot.com/bug?extid=a75ebe0452711c9e56d9 The Linux kernel CVE team has assigned CVE-2022-49947 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15.64 with commit 577d9c05cc48c5242bcf719c06a5baf3105473ad and fixed in 5.15.66 with commit 81203ab7a6ef843a2b904a0a494f28c457d44d27 Issue introduced in 5.19.6 with commit 7b0163c1b07b7ff1717aa975821c40df98786ddc and fixed in 5.19.8 with commit b2a97babb0a510f8921891f9e70c5a5ef33cadac 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-49947 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/android/binder_alloc.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/81203ab7a6ef843a2b904a0a494f28c457d44d27 https://git.kernel.org/stable/c/b2a97babb0a510f8921891f9e70c5a5ef33cadac https://git.kernel.org/stable/c/1da52815d5f1b654c89044db0cdc6adce43da1f1