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 0B9932749C0 for ; Wed, 1 Oct 2025 07:44:01 +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=1759304644; cv=none; b=OydYCvS3ojxQHEsLkZOxOETHpPYIPlcGVHH4Ebgzgv+ZijX2tvBwlTqo/ScBrAi+Wi10kxNbzgieIVgXe45/JUxuQZauQShGfOXmj1Yu1sAAinsEY6XUz2BM0zJMNLC4K/HVjQgduNCrBMctlc2kqH9ADugypRp6UvrhwxBdD+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759304644; c=relaxed/simple; bh=ODbVscGVHl/Xupp3pkjL+HlFMUeJB+NHXfOl15DFXmw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rvp6bxOMruD01zZDo8KoHFf/9P532VSJ0SWHG+dkxjDpbgVfTYkov7mUq6XVSuXwM/jUpXLcwtI/pn25AQZNEuisz6oq2OeGPplFmF/9DR0m8BOGXNtUImvhUZFm6YMeK1ANkW5Upw/5mi/6FO6XzULEigmzyAMX1M+CzvyrHLA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f0hq1E4k; 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="f0hq1E4k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 147C6C4CEF4; Wed, 1 Oct 2025 07:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759304641; bh=ODbVscGVHl/Xupp3pkjL+HlFMUeJB+NHXfOl15DFXmw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=f0hq1E4kGxLImQJpXAHj3Bq4yNu9yIfUIk9vtmMwWi6rR1xmqIbw/8upQc/3szqLf OR6Ybxr1jYZkeDP8qtoQPiUDnxoYenyJvz16DNb4FWtBpEUMlmCYKE929Ot2K8KLMe REXWNrhtu/hajSmnJ2mod8u9LM570LHpqKlYfE3k= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-39899: mm/userfaultfd: fix kmap_local LIFO ordering for CONFIG_HIGHPTE Date: Wed, 1 Oct 2025 09:43:23 +0200 Message-ID: <2025100117-CVE-2025-39899-3921@gregkh> X-Mailer: git-send-email 2.51.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=2880; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=BqD+C0L8QjBzRIvbvlBxj3LW690LrGtPMGpiXSRFLwc=; b=owGbwMvMwCRo6H6F97bub03G02pJDBl3bk99e/qJ8xNescQWW/XFoeemXPzTcNTy+9THrxfzF S5av3nzho5YFgZBJgZZMUWWL9t4ju6vOKToZWh7GmYOKxPIEAYuTgGYyO1rDAsWrfD2mi3F/v1V HUfgElOtj2vyt5ozLDjxZZ1jWWRLpZqzhlBeaN+Nml1vMgA= 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/userfaultfd: fix kmap_local LIFO ordering for CONFIG_HIGHPTE With CONFIG_HIGHPTE on 32-bit ARM, move_pages_pte() maps PTE pages using kmap_local_page(), which requires unmapping in Last-In-First-Out order. The current code maps dst_pte first, then src_pte, but unmaps them in the same order (dst_pte, src_pte), violating the LIFO requirement. This causes the warning in kunmap_local_indexed(): WARNING: CPU: 0 PID: 604 at mm/highmem.c:622 kunmap_local_indexed+0x178/0x17c addr \!= __fix_to_virt(FIX_KMAP_BEGIN + idx) Fix this by reversing the unmap order to respect LIFO ordering. This issue follows the same pattern as similar fixes: - commit eca6828403b8 ("crypto: skcipher - fix mismatch between mapping and unmapping order") - commit 8cf57c6df818 ("nilfs2: eliminate staggered calls to kunmap in nilfs_rename") Both of which addressed the same fundamental requirement that kmap_local operations must follow LIFO ordering. The Linux kernel CVE team has assigned CVE-2025-39899 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit adef440691bab824e39c1b17382322d195e1fab0 and fixed in 6.12.46 with commit b051f707018967ea8f697d790a1ed8c443f63812 Issue introduced in 6.8 with commit adef440691bab824e39c1b17382322d195e1fab0 and fixed in 6.16.6 with commit bd1ee62759d0bd4d6b909731c076c230ac89d61e Issue introduced in 6.8 with commit adef440691bab824e39c1b17382322d195e1fab0 and fixed in 6.17 with commit 9614d8bee66387501f48718fa306e17f2aa3f2f3 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-39899 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/userfaultfd.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/b051f707018967ea8f697d790a1ed8c443f63812 https://git.kernel.org/stable/c/bd1ee62759d0bd4d6b909731c076c230ac89d61e https://git.kernel.org/stable/c/9614d8bee66387501f48718fa306e17f2aa3f2f3