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 4F3B935CBA9 for ; Wed, 12 Nov 2025 22:00:51 +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=1762984852; cv=none; b=ETXJyb1EbF2UHG7k/4aMQVUD65Z1V1vAMGPpIHhx0+8v9WkoTzUKfanS9JSDLIduXGd++gELTiC5pHqEVJYfutWzca8Zbr4GB/8S9RVUoZG+PoP5Emf8TLlFKsve2P1tUwrJ3s9qU8w0lnR/iuv26BFqu6+LKhaFlaPSvdYA220= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762984852; c=relaxed/simple; bh=ytelo0kmuYsDKfWHic0K4H7XlTbI4fLOmTeWwvagBQE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jfH+t/GjmoS3UHZoVdrtXE9SMWyKR31KMpS0qjI5HhMEnxIN5IxoN1D2JLjq7zhAMJWLZ3ku2nnaW5SksMVKQhzppUFOOORe2JCulkFZakvaTd7n/Y5s2RH01queTzgmUGw9/s5JSaIcxJU1O9Ieksy7o4c6SC5yQoTVyltDM68= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qZp2yC5n; 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="qZp2yC5n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F7EC4CEF5; Wed, 12 Nov 2025 22:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762984851; bh=ytelo0kmuYsDKfWHic0K4H7XlTbI4fLOmTeWwvagBQE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=qZp2yC5nbkFyG6BQvTWYrepenvyZ3TEnH/qigq0UjjcpJOoHejwevBqbbhdnjJuU2 gjF7WRkh5gTxRGHgmJQmXAPbeTssDkG49Vhzwd39oXxc5XSXq1N7NmZ3eM9Cu9/ZRR 0gIVeS/EH5KmzBv02pcJjSkQYu2Xpu6CUb1v0CgU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40178: pid: Add a judgment for ns null in pid_nr_ns Date: Wed, 12 Nov 2025 17:00:41 -0500 Message-ID: <2025111240-CVE-2025-40178-8673@gregkh> X-Mailer: git-send-email 2.51.2 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=4955; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=L5w4fWDzZA2AnNGPIfiCrAKqspgLvcNU94dyotQNuuQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDJmizB2e7cn2l89YaMuHpCvuLNpVXrpeUXBCsfY5phmu7 M5Bv806YlkYBJkYZMUUWb5s4zm6v+KQopeh7WmYOaxMIEMYuDgFYCIP5zIsWHD89uEpjJp6+wsu mb3o4FntPnPHI4a5YhNYAre5nWtULI3LMHC6Yzpxbt0qAA== 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: pid: Add a judgment for ns null in pid_nr_ns __task_pid_nr_ns ns = task_active_pid_ns(current); pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns); if (pid && ns->level <= pid->level) { Sometimes null is returned for task_active_pid_ns. Then it will trigger kernel panic in pid_nr_ns. For example: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058 Mem abort info: ESR = 0x0000000096000007 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x07: level 3 translation fault Data abort info: ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 39-bit VAs, pgdp=00000002175aa000 [0000000000000058] pgd=08000002175ab003, p4d=08000002175ab003, pud=08000002175ab003, pmd=08000002175be003, pte=0000000000000000 pstate: 834000c5 (Nzcv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __task_pid_nr_ns+0x74/0xd0 lr : __task_pid_nr_ns+0x24/0xd0 sp : ffffffc08001bd10 x29: ffffffc08001bd10 x28: ffffffd4422b2000 x27: 0000000000000001 x26: ffffffd442821168 x25: ffffffd442821000 x24: 00000f89492eab31 x23: 00000000000000c0 x22: ffffff806f5693c0 x21: ffffff806f5693c0 x20: 0000000000000001 x19: 0000000000000000 x18: 0000000000000000 x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 00000000023a1adc x14: 0000000000000003 x13: 00000000007ef6d8 x12: 001167c391c78800 x11: 00ffffffffffffff x10: 0000000000000000 x9 : 0000000000000001 x8 : ffffff80816fa3c0 x7 : 0000000000000000 x6 : 49534d702d535449 x5 : ffffffc080c4c2c0 x4 : ffffffd43ee128c8 x3 : ffffffd43ee124dc x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffffff806f5693c0 Call trace: __task_pid_nr_ns+0x74/0xd0 ... __handle_irq_event_percpu+0xd4/0x284 handle_irq_event+0x48/0xb0 handle_fasteoi_irq+0x160/0x2d8 generic_handle_domain_irq+0x44/0x60 gic_handle_irq+0x4c/0x114 call_on_irq_stack+0x3c/0x74 do_interrupt_handler+0x4c/0x84 el1_interrupt+0x34/0x58 el1h_64_irq_handler+0x18/0x24 el1h_64_irq+0x68/0x6c account_kernel_stack+0x60/0x144 exit_task_stack_account+0x1c/0x80 do_exit+0x7e4/0xaf8 ... get_signal+0x7bc/0x8d8 do_notify_resume+0x128/0x828 el0_svc+0x6c/0x70 el0t_64_sync_handler+0x68/0xbc el0t_64_sync+0x1a8/0x1ac Code: 35fffe54 911a02a8 f9400108 b4000128 (b9405a69) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Oops: Fatal exception in interrupt The Linux kernel CVE team has assigned CVE-2025-40178 to this issue. Affected and fixed versions =========================== Fixed in 5.4.301 with commit 75dbc029c5359438be4a6f908bfbfdab969af776 Fixed in 5.10.246 with commit c2d09d724856b6f82ab688f65fc1ce833bb56333 Fixed in 5.15.195 with commit c3b654021931dc806ba086c549e8756c3f204a67 Fixed in 6.1.157 with commit e10c36a771c5cc910abd9fe4aa9033ee32a47c38 Fixed in 6.6.113 with commit 09d227c59d97efda7d5cc878a4335a6b2bb224c2 Fixed in 6.12.54 with commit 2076b916bf41be48799d1443df0f8fc75d12ccd0 Fixed in 6.17.4 with commit a0212978af1825b37da0b453b94d9b0e5af11478 Fixed in 6.18-rc1 with commit 006568ab4c5ca2309ceb36fa553e390b4aa9c0c7 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-40178 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/pid.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/75dbc029c5359438be4a6f908bfbfdab969af776 https://git.kernel.org/stable/c/c2d09d724856b6f82ab688f65fc1ce833bb56333 https://git.kernel.org/stable/c/c3b654021931dc806ba086c549e8756c3f204a67 https://git.kernel.org/stable/c/e10c36a771c5cc910abd9fe4aa9033ee32a47c38 https://git.kernel.org/stable/c/09d227c59d97efda7d5cc878a4335a6b2bb224c2 https://git.kernel.org/stable/c/2076b916bf41be48799d1443df0f8fc75d12ccd0 https://git.kernel.org/stable/c/a0212978af1825b37da0b453b94d9b0e5af11478 https://git.kernel.org/stable/c/006568ab4c5ca2309ceb36fa553e390b4aa9c0c7