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 B3DC330205A for ; Fri, 4 Jul 2025 13:43: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=1751636591; cv=none; b=kn56O8YLIhlGrHeL2Oq7J78vf4tiTt1P1Shyg2a9ythb81a3pUR6Dli6wuDK+ZH6Nifvzg0tgz5OVEjobV9ZzFofvjR7S2QSSNgOm1ChNBVfpjkPXzhpJi5sxj8VexMyH9NvyESc0qrn+WG/Gm1MiBu0Mws4faid3No5yywcGyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751636591; c=relaxed/simple; bh=ZDLW56awsM0ZFIgfrk9HuBWuS4DkqlrzFn1kcdPMP7s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b55DoyA3AvCDQjKtI48qmoEZEBGU7WKpVdayaDlivgIWSCjmJld/N+NLO6h7kG7ujeKFfuxX5LfLKN7JPpT3Z0QkNtP6JXh3kP6Kps6AiFjNwUU7NlxJiUA0ZTnsgraSj1Iick3xfOZ+pxqsk18dxZ4x5dseKgAI5QNp4vbsY38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O+5tvzKH; 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="O+5tvzKH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E96A7C4CEEE; Fri, 4 Jul 2025 13:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751636591; bh=ZDLW56awsM0ZFIgfrk9HuBWuS4DkqlrzFn1kcdPMP7s=; h=From:To:Cc:Subject:Date:Reply-to:From; b=O+5tvzKHu2FHYrPwJWaZzunrsh9pB1spJwqYfUOK1T9AX9fm9Im3pfJaRaiSAaFa8 DFd39ljzkmffgc3EDj0dqAt9/ZJhAD+XtM66A/tuXw8PycAT0ytvXk57Nlfn9t4xqB QvO2JyFofQqSYA6j790spqzewdkcceAtMfyPNuuI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38207: mm: fix uprobe pte be overwritten when expanding vma Date: Fri, 4 Jul 2025 15:37:36 +0200 Message-ID: <2025070420-CVE-2025-38207-e2ea@gregkh> X-Mailer: git-send-email 2.50.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=3461; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=n+xgsXgnnZWHYUJoLeXU96i11OpRAZZYELEGCY/K5fU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnpNwXu8qkwRjz9nr5d7JGZc/ayyT9uxh7rZzl358Xfc s+r+5htOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiU18zLGjXODN/1pHjCafC pVh2//xbtqSu+jvDgkk+N2T6WfkXvOx0Vj8u+3SDzisGHwA= 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: mm: fix uprobe pte be overwritten when expanding vma Patch series "Fix uprobe pte be overwritten when expanding vma". This patch (of 4): We encountered a BUG alert triggered by Syzkaller as follows: BUG: Bad rss-counter state mm:00000000b4a60fca type:MM_ANONPAGES val:1 And we can reproduce it with the following steps: 1. register uprobe on file at zero offset 2. mmap the file at zero offset: addr1 = mmap(NULL, 2 * 4096, PROT_NONE, MAP_PRIVATE, fd, 0); 3. mremap part of vma1 to new vma2: addr2 = mremap(addr1, 4096, 2 * 4096, MREMAP_MAYMOVE); 4. mremap back to orig addr1: mremap(addr2, 4096, 4096, MREMAP_MAYMOVE | MREMAP_FIXED, addr1); In step 3, the vma1 range [addr1, addr1 + 4096] will be remap to new vma2 with range [addr2, addr2 + 8192], and remap uprobe anon page from the vma1 to vma2, then unmap the vma1 range [addr1, addr1 + 4096]. In step 4, the vma2 range [addr2, addr2 + 4096] will be remap back to the addr range [addr1, addr1 + 4096]. Since the addr range [addr1 + 4096, addr1 + 8192] still maps the file, it will take vma_merge_new_range to expand the range, and then do uprobe_mmap in vma_complete. Since the merged vma pgoff is also zero offset, it will install uprobe anon page to the merged vma. However, the upcomming move_page_tables step, which use set_pte_at to remap the vma2 uprobe pte to the merged vma, will overwrite the newly uprobe pte in the merged vma, and lead that pte to be orphan. Since the uprobe pte will be remapped to the merged vma, we can remove the unnecessary uprobe_mmap upon merged vma. This problem was first found in linux-6.6.y and also exists in the community syzkaller: https://lore.kernel.org/all/000000000000ada39605a5e71711@google.com/T/ The Linux kernel CVE team has assigned CVE-2025-38207 to this issue. Affected and fixed versions =========================== Issue introduced in 3.5 with commit 2b144498350860b6ee9dc57ff27a93ad488de5dc and fixed in 6.15.4 with commit 58b83b9a9a929611a2a2e7d88f45cb0d786b7ee0 Issue introduced in 3.5 with commit 2b144498350860b6ee9dc57ff27a93ad488de5dc and fixed in 6.16-rc1 with commit 2b12d06c37fd3a394376f42f026a7478d826ed63 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-38207 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: mm/vma.c mm/vma.h 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/58b83b9a9a929611a2a2e7d88f45cb0d786b7ee0 https://git.kernel.org/stable/c/2b12d06c37fd3a394376f42f026a7478d826ed63