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 F03571F4E4B for ; Fri, 27 Dec 2024 14:25:20 +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=1735309521; cv=none; b=YrtWqyB5c7AMO4LhJTZhVV6VeKVVoEcUeICvDzIp6vLqERhXPJV7L1JkQMvphn8jts08PuEwzPpExPQnG+IxKPkX8wKweDxYaadSkvgBXO4mejCn7IAaljahhoXC0gJzCM8t8z25CZL0olInC5AzCKrNDWItq0+B7EE/GjIn5Hk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735309521; c=relaxed/simple; bh=1S5QrbuH9zkDFiPD7OLk1w/GoEKHToxOdVfUwKTZMsI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mfn/KEasDO6AbT02eUJKrEnslz/pyQ97mRGzVMZXwCPhEQDQBmB2R70s/xTJikk5TnjliMbpDcJfUu9reRk3dMmFzalc1sWYFSayaqfX4FA9rJYJiCkKoNjbjsRRHbGEmPw+TxtWd+vXa86ZdIB/WqVsth//yhKXnFdqFJ7sDsU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kD0SiC2j; 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="kD0SiC2j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 561A7C4CED0; Fri, 27 Dec 2024 14:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735309520; bh=1S5QrbuH9zkDFiPD7OLk1w/GoEKHToxOdVfUwKTZMsI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=kD0SiC2jcGazy4ghiuJMfvBhQPeAZu/braECTXiPsthCK4IhwoEs+43MtlYTInRIV cJIMVDOEp/znGGdnTXERe6WYexykb2Telbv1voVOaGlqlcPQD5cjWOd3cvUE00ywF2 bby6XUSYzs6JneHQXaxhq/nZcZHR+UMuRnDTdqQE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56556: binder: fix node UAF in binder_add_freeze_work() Date: Fri, 27 Dec 2024 15:23:07 +0100 Message-ID: <2024122711-CVE-2024-56556-96b8@gregkh> X-Mailer: git-send-email 2.47.1 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=3107; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=1S5QrbuH9zkDFiPD7OLk1w/GoEKHToxOdVfUwKTZMsI=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5O/xLJ9fJfvL9dfq15ezdCTLvKgVEtj9NbLlqI2o8q +DKHLeojlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjI1/sM851EH6aw19Y+9l2a uEqiYOnzUuG3PQzzXS673r0UpytxYvdB+ZrP2gfn3eGZAwA= 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: binder: fix node UAF in binder_add_freeze_work() In binder_add_freeze_work() we iterate over the proc->nodes with the proc->inner_lock held. However, this lock is temporarily dropped in order to acquire the node->lock first (lock nesting order). This can race with binder_node_release() and trigger a use-after-free: ================================================================== BUG: KASAN: slab-use-after-free in _raw_spin_lock+0xe4/0x19c Write of size 4 at addr ffff53c04c29dd04 by task freeze/640 CPU: 5 UID: 0 PID: 640 Comm: freeze Not tainted 6.11.0-07343-ga727812a8d45 #17 Hardware name: linux,dummy-virt (DT) Call trace: _raw_spin_lock+0xe4/0x19c binder_add_freeze_work+0x148/0x478 binder_ioctl+0x1e70/0x25ac __arm64_sys_ioctl+0x124/0x190 Allocated by task 637: __kmalloc_cache_noprof+0x12c/0x27c binder_new_node+0x50/0x700 binder_transaction+0x35ac/0x6f74 binder_thread_write+0xfb8/0x42a0 binder_ioctl+0x18f0/0x25ac __arm64_sys_ioctl+0x124/0x190 Freed by task 637: kfree+0xf0/0x330 binder_thread_read+0x1e88/0x3a68 binder_ioctl+0x16d8/0x25ac __arm64_sys_ioctl+0x124/0x190 ================================================================== Fix the race by taking a temporary reference on the node before releasing the proc->inner lock. This ensures the node remains alive while in use. The Linux kernel CVE team has assigned CVE-2024-56556 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit d579b04a52a183db47dfcb7a44304d7747d551e1 and fixed in 6.12.4 with commit 38fbefeb2c140b581ed7de8117a5c90d6dd89c22 Issue introduced in 6.12 with commit d579b04a52a183db47dfcb7a44304d7747d551e1 and fixed in 6.13-rc1 with commit dc8aea47b928cc153b591b3558829ce42f685074 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-56556 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.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/38fbefeb2c140b581ed7de8117a5c90d6dd89c22 https://git.kernel.org/stable/c/dc8aea47b928cc153b591b3558829ce42f685074