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 C1ED72877DC for ; Thu, 11 Sep 2025 16:53:05 +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=1757609585; cv=none; b=fN0/4/6EbX5Xy3WlWWChJ0FnQ0fUpkbV/vFV6hUQQy1dvn7yCrjpAHi+F7kGWxyDFf0v1pQqWqzjrgsFP3Qhb7dYxDgjNz06NgIfQF7yuBMO0q3n11GxhK3STXeX0IWhctUv2UeIKBHOq1jSwEM+tn8XsOTkcwZ+ITZXyB9yLDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757609585; c=relaxed/simple; bh=ywriT71XDSnY6q007cYHKTeV83hAQ9D7QSFdooZIBd0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mHKlFfIapp41Fx5dCgcgg7MkXm+5lFKRWSmbTs3bFnAMoZKn/asXvCm9kOHxr6F2aMyUsuqsSvS8FPwG0ioiAI9D7ZATMmWTApu8XuFiBwV36UEVdTVkEaA7HbZVwizGDen6tPzdn4jS8A0KrzkQKmdXaokltZYdxw3+gS5OHF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=w0ffH3h4; 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="w0ffH3h4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E039EC4CEF0; Thu, 11 Sep 2025 16:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757609585; bh=ywriT71XDSnY6q007cYHKTeV83hAQ9D7QSFdooZIBd0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=w0ffH3h4Srr2Cnjm/+FOhODlijYkfOAvm68BWxDIOUZKH6WWOnF7uqTknnOI1Bfgj Js781BXdBvNqv6umfc3uxqwGC+K6yNHYwdPgCP7JTj74Sj+HFFKDB5wT88YYe/RvKP u34BE08Pj8979GFUwJo+ZuhfqWsmT6ff4VJqYgwE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-39748: bpf: Forget ranges when refining tnum after JSET Date: Thu, 11 Sep 2025 18:52:49 +0200 Message-ID: <2025091141-CVE-2025-39748-29e7@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=3182; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NVz2INPIpJ+4eAoFIMeaEQrq4USkyA9MhWzP3ALIWzA=; b=owGbwMvMwCRo6H6F97bub03G02pJDBmH/kWKHp0akZ2zKDwlnD1x5bLzj0slWiL8FhxZNHdu9 7LeTdPsOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi79sY5mnMP1XL9T3p6ZX0 Mw1mljPd552VcGCYXxNqFJZua7vW1Xb6rFCFpqO2S3+dAgA= 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: bpf: Forget ranges when refining tnum after JSET Syzbot reported a kernel warning due to a range invariant violation on the following BPF program. 0: call bpf_get_netns_cookie 1: if r0 == 0 goto 2: if r0 & Oxffffffff goto The issue is on the path where we fall through both jumps. That path is unreachable at runtime: after insn 1, we know r0 != 0, but with the sign extension on the jset, we would only fallthrough insn 2 if r0 == 0. Unfortunately, is_branch_taken() isn't currently able to figure this out, so the verifier walks all branches. The verifier then refines the register bounds using the second condition and we end up with inconsistent bounds on this unreachable path: 1: if r0 == 0 goto r0: u64=[0x1, 0xffffffffffffffff] var_off=(0, 0xffffffffffffffff) 2: if r0 & 0xffffffff goto r0 before reg_bounds_sync: u64=[0x1, 0xffffffffffffffff] var_off=(0, 0) r0 after reg_bounds_sync: u64=[0x1, 0] var_off=(0, 0) Improving the range refinement for JSET to cover all cases is tricky. We also don't expect many users to rely on JSET given LLVM doesn't generate those instructions. So instead of improving the range refinement for JSETs, Eduard suggested we forget the ranges whenever we're narrowing tnums after a JSET. This patch implements that approach. The Linux kernel CVE team has assigned CVE-2025-39748 to this issue. Affected and fixed versions =========================== Fixed in 6.12.43 with commit f01e06930444cab289a8783017af9b64255bd103 Fixed in 6.15.11 with commit 2fd0c26bacd90ef26522bd3169000a4715bf151f Fixed in 6.16.2 with commit 80a6b11862a7cfdf691e8f9faee89cfea219f098 Fixed in 6.17-rc1 with commit 6279846b9b2532e1b04559ef8bd0dec049f29383 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-39748 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/bpf/verifier.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/f01e06930444cab289a8783017af9b64255bd103 https://git.kernel.org/stable/c/2fd0c26bacd90ef26522bd3169000a4715bf151f https://git.kernel.org/stable/c/80a6b11862a7cfdf691e8f9faee89cfea219f098 https://git.kernel.org/stable/c/6279846b9b2532e1b04559ef8bd0dec049f29383