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 B410A16C850 for ; Thu, 27 Feb 2025 02:09:11 +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=1740622151; cv=none; b=kXqSnr7GqhZ4DOynN2UbHnlzZff514kPknn/88TAArPI28c6CD4+UFEuSMax9eiWfgKbJGFW4kZmD5kjS0ETDKgZxhnOdOFHxEtlCXD5TedC0J40itbIjaHfB/ZpgC84QJ7qL2DwmgBv9UBIZZNWSWhcicQrt2idYc8WdTNlMR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622151; c=relaxed/simple; bh=H3bf4BrjkVUpMnYBJ4gNqAYBPeEtzuu1cVjpQ/4YC94=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=M0mjIMMnBtVN0yyneyJQf6NB9WCV9GUH3zDCrF/evktOHUi7mv6g+8i47ooZ6C1V5w8gVgpLlEyrimzus4wVdp7492tP7b4E7Mu3BFYxdDsRMtSNyiRA8xMot8TQ+B45Ed7691YdBUBgpZb1t/wNJAVYiAanfDahlwDol1xHCcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oFLsZRV6; 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="oFLsZRV6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1E8C4CEE9; Thu, 27 Feb 2025 02:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740622151; bh=H3bf4BrjkVUpMnYBJ4gNqAYBPeEtzuu1cVjpQ/4YC94=; h=From:To:Cc:Subject:Date:Reply-to:From; b=oFLsZRV66Ty29taMh9ZsO/aScpNPAOiCEveLSfDTM0/jeSh9QAfMAsJtLe/SkGud7 w+5QnbAfq7ywOjxdGALJZkGynzrZco2lUfHFmKKVR9Y3qHH510bha/TK9KMZlQOYTe L8MUWDI+s6fHWtGEO25g5g59AQwpgak+D6HMqplk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21709: kernel: be more careful about dup_mmap() failures and uprobe registering Date: Wed, 26 Feb 2025 18:06:04 -0800 Message-ID: <2025022643-CVE-2025-21709-e967@gregkh> X-Mailer: git-send-email 2.48.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=3070; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=H3bf4BrjkVUpMnYBJ4gNqAYBPeEtzuu1cVjpQ/4YC94=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7T5TfiQ1QT3aZ902hI/3Va6v9NtlxCz9teh7E25hw5 sWDiKuHO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiTnUM80xn9+p31j4y9mq/ Y/+m/p2Y+aG2LoZ5CuIPct5Myd22fHf+oXvyn/cF2O7YCwA= 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: kernel: be more careful about dup_mmap() failures and uprobe registering If a memory allocation fails during dup_mmap(), the maple tree can be left in an unsafe state for other iterators besides the exit path. All the locks are dropped before the exit_mmap() call (in mm/mmap.c), but the incomplete mm_struct can be reached through (at least) the rmap finding the vmas which have a pointer back to the mm_struct. Up to this point, there have been no issues with being able to find an mm_struct that was only partially initialised. Syzbot was able to make the incomplete mm_struct fail with recent forking changes, so it has been proven unsafe to use the mm_struct that hasn't been initialised, as referenced in the link below. Although 8ac662f5da19f ("fork: avoid inappropriate uprobe access to invalid mm") fixed the uprobe access, it does not completely remove the race. This patch sets the MMF_OOM_SKIP to avoid the iteration of the vmas on the oom side (even though this is extremely unlikely to be selected as an oom victim in the race window), and sets MMF_UNSTABLE to avoid other potential users from using a partially initialised mm_struct. When registering vmas for uprobe, skip the vmas in an mm that is marked unstable. Modifying a vma in an unstable mm may cause issues if the mm isn't fully initialised. The Linux kernel CVE team has assigned CVE-2025-21709 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit d2406291483775ecddaee929231a39c70c08fda2 and fixed in 6.13.2 with commit da139948aeda677ac09cc0e7d837f8a314de7d55 Issue introduced in 6.8 with commit d2406291483775ecddaee929231a39c70c08fda2 and fixed in 6.14-rc1 with commit 64c37e134b120fb462fb4a80694bfb8e7be77b14 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-2025-21709 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/events/uprobes.c kernel/fork.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/da139948aeda677ac09cc0e7d837f8a314de7d55 https://git.kernel.org/stable/c/64c37e134b120fb462fb4a80694bfb8e7be77b14