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 0587C264A92 for ; Mon, 20 Oct 2025 15:27: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=1760974041; cv=none; b=VBLKbkm4Gbgpk4licQM3Fges/XC89Zb07t1jwZQdeWypSGKYP6hkuVT7vgP4VwSMJOtwttC/LCyHArxKlhL8mGlQEfI223GDd9MEoY1fDm4BVIoV9WOMChLJtMD6JG+0bLlr/cwHyzir1EvudnyqoHZcQPKFXry3Xon6ZeP2WCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760974041; c=relaxed/simple; bh=TOCk7Lb7+y0R9yykCS8B1YIXTFwgmIjeY4kB1q4Mrvw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EfGIAb1sb4E+iqIGVQPQsRFj6rGgZ2fRVfUaRM6WvirhjA7CDtyVoUgyi0h8O5SWy18fUywtwSg/4L1g7mhlMmiG+HXWlRLHo+zcvREovPKEQ8WrZyLwqtzwKHCyMkBNUnzDoGKfOsLIVyGUKuAsPSAIYMRoh4r9LntX83hDI7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yY9fzjhx; 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="yY9fzjhx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23A3DC113D0; Mon, 20 Oct 2025 15:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760974040; bh=TOCk7Lb7+y0R9yykCS8B1YIXTFwgmIjeY4kB1q4Mrvw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=yY9fzjhxn6QG7ku4xSwvXqkNw9J/Ml6G0StikGJDO1wyloUMuqK6NlOT5EuWG0fwt 2SCr1CB20/vNDq3yhNaclWhXA1suV45QCpmaNdeh9ovyEHnHQvX9LG/MfO3/+9rOve tpA7jbMHZg6RbErp2oqpYBjtnOhIMwhwQA4yZTho= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40009: fs/proc/task_mmu: check p->vec_buf for NULL Date: Mon, 20 Oct 2025 17:27:05 +0200 Message-ID: <2025102002-CVE-2025-40009-5a08@gregkh> X-Mailer: git-send-email 2.51.1.dirty 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=4033; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Gg7uoMRaJDHswHM1LyIrfJlMDCl/P4knixBsZNyuH9A=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnfQo4d+VRSNDOiUmz1ydy6RaVHLzpcu3w6YMfK2cczV yzPn7R/RkcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBM5Js/wxx+vyXSAt9P/+lq L9T6N+e1y2PGcHaGefqhP8zCVU8/1PjzLfTd2xntYXHTjgIA 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: fs/proc/task_mmu: check p->vec_buf for NULL When the PAGEMAP_SCAN ioctl is invoked with vec_len = 0 reaches pagemap_scan_backout_range(), kernel panics with null-ptr-deref: [ 44.936808] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN NOPTI [ 44.937797] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 44.938391] CPU: 1 UID: 0 PID: 2480 Comm: reproducer Not tainted 6.17.0-rc6 #22 PREEMPT(none) [ 44.939062] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [ 44.939935] RIP: 0010:pagemap_scan_thp_entry.isra.0+0x741/0xa80 [ 44.946828] Call Trace: [ 44.947030] [ 44.949219] pagemap_scan_pmd_entry+0xec/0xfa0 [ 44.952593] walk_pmd_range.isra.0+0x302/0x910 [ 44.954069] walk_pud_range.isra.0+0x419/0x790 [ 44.954427] walk_p4d_range+0x41e/0x620 [ 44.954743] walk_pgd_range+0x31e/0x630 [ 44.955057] __walk_page_range+0x160/0x670 [ 44.956883] walk_page_range_mm+0x408/0x980 [ 44.958677] walk_page_range+0x66/0x90 [ 44.958984] do_pagemap_scan+0x28d/0x9c0 [ 44.961833] do_pagemap_cmd+0x59/0x80 [ 44.962484] __x64_sys_ioctl+0x18d/0x210 [ 44.962804] do_syscall_64+0x5b/0x290 [ 44.963111] entry_SYSCALL_64_after_hwframe+0x76/0x7e vec_len = 0 in pagemap_scan_init_bounce_buffer() means no buffers are allocated and p->vec_buf remains set to NULL. This breaks an assumption made later in pagemap_scan_backout_range(), that page_region is always allocated for p->vec_buf_index. Fix it by explicitly checking p->vec_buf for NULL before dereferencing. Other sites that might run into same deref-issue are already (directly or transitively) protected by checking p->vec_buf. Note: >From PAGEMAP_SCAN man page, it seems vec_len = 0 is valid when no output is requested and it's only the side effects caller is interested in, hence it passes check in pagemap_scan_get_args(). This issue was found by syzkaller. The Linux kernel CVE team has assigned CVE-2025-40009 to this issue. Affected and fixed versions =========================== Issue introduced in 6.7 with commit 52526ca7fdb905a768a93f8faa418e9b988fc34b and fixed in 6.12.50 with commit ca988dcdc6683ecd9de5f525ce469588a9141c21 Issue introduced in 6.7 with commit 52526ca7fdb905a768a93f8faa418e9b988fc34b and fixed in 6.16.10 with commit a2cb8818a3d915cd33a1e8b2babc1bb0c34862c3 Issue introduced in 6.7 with commit 52526ca7fdb905a768a93f8faa418e9b988fc34b and fixed in 6.17 with commit 28aa29986dde79e8466bc87569141291053833f5 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-40009 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: fs/proc/task_mmu.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/ca988dcdc6683ecd9de5f525ce469588a9141c21 https://git.kernel.org/stable/c/a2cb8818a3d915cd33a1e8b2babc1bb0c34862c3 https://git.kernel.org/stable/c/28aa29986dde79e8466bc87569141291053833f5