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 238E828C01E for ; Thu, 10 Jul 2025 08:16: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=1752135372; cv=none; b=JADzKHLUH4Vn2eAdPgjIaNRu5Jw942zp5t+vJ9uexhLGDeHF0TFl8RjDYgJnIxC2s4AzaXKFTlGDTTFeXc7GVRrNz3eNuhd3PpS5PRjI5fUB5BBSKkeHBPeWfzOWJF8sncdag29ULs+G9SmldzQbeD6J77kYt5ZQ+9nB8jyp9kU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752135372; c=relaxed/simple; bh=MFh33i0DFc3ZFIlWRKJMcROQRK5mdUUYhTPzFnCQzkI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=enQDMLiBtkx18e5k2dJf2b1ZsXONsbifLY1n8sYXv0tVvjTF1DXLubJaeIn7pIaqCKDkcT7ZjBT1OiXnX1iYuxVtAMzuuEu8nSkCGe1p8y4VPZKg5OxNRW2zomiVVSZjb7MCTG/nEuervnexjkJBJW+z3Ffj2sg6e/Y/NvKBV30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p4XNVlEX; 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="p4XNVlEX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DB3CC4CEE3; Thu, 10 Jul 2025 08:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752135371; bh=MFh33i0DFc3ZFIlWRKJMcROQRK5mdUUYhTPzFnCQzkI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=p4XNVlEXD9gNt1E+ERXvGoRAS8ocotMWq9FHz5cyoHFwwRcp/7v+J/53dHdEkbPIu 5/jG5X5z58BPC865ZpqiPwOEOgJtPvs2ZprkfwDApOr1r9Oh921AnWZyjxxDFgjoX7 V2wT9rnzjTdSTmGu7w9QI4JPuJvLPLgb9JlntI7E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38339: powerpc/bpf: fix JIT code size calculation of bpf trampoline Date: Thu, 10 Jul 2025 10:15:47 +0200 Message-ID: <2025071034-CVE-2025-38339-90f8@gregkh> X-Mailer: git-send-email 2.50.1 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=2946; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=7QMrO9fOeXxK9ecR59yPtJwXFh25t8dHf6jBx8Eindk=; b=owGbwMvMwCRo6H6F97bub03G02pJDBn5Zcve/mHrvX7mp/z/xzzajv/P8x5/uUnPY53xprez2 KNCKiMndMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEji1lmM0q4+G3iWvZDrmY 0jUa9rkdfqtqZRnmOzypO3X5Q0yGyZzY7mMR6aZHIzR2AQA= 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: powerpc/bpf: fix JIT code size calculation of bpf trampoline arch_bpf_trampoline_size() provides JIT size of the BPF trampoline before the buffer for JIT'ing it is allocated. The total number of instructions emitted for BPF trampoline JIT code depends on where the final image is located. So, the size arrived at with the dummy pass in arch_bpf_trampoline_size() can vary from the actual size needed in arch_prepare_bpf_trampoline(). When the instructions accounted in arch_bpf_trampoline_size() is less than the number of instructions emitted during the actual JIT compile of the trampoline, the below warning is produced: WARNING: CPU: 8 PID: 204190 at arch/powerpc/net/bpf_jit_comp.c:981 __arch_prepare_bpf_trampoline.isra.0+0xd2c/0xdcc which is: /* Make sure the trampoline generation logic doesn't overflow */ if (image && WARN_ON_ONCE(&image[ctx->idx] > (u32 *)rw_image_end - BPF_INSN_SAFETY)) { So, during the dummy pass, instead of providing some arbitrary image location, account for maximum possible instructions if and when there is a dependency with image location for JIT'ing. The Linux kernel CVE team has assigned CVE-2025-38339 to this issue. Affected and fixed versions =========================== Issue introduced in 6.13 with commit d243b62b7bd3d5314382d3b54e4992226245e936 and fixed in 6.15.4 with commit 7833deb95e05bec146414b3a2feb24f025ca27c0 Issue introduced in 6.13 with commit d243b62b7bd3d5314382d3b54e4992226245e936 and fixed in 6.16-rc1 with commit 59ba025948be2a92e8bc9ae1cbdaf197660bd508 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-38339 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: arch/powerpc/net/bpf_jit.h arch/powerpc/net/bpf_jit_comp.c arch/powerpc/net/bpf_jit_comp32.c arch/powerpc/net/bpf_jit_comp64.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/7833deb95e05bec146414b3a2feb24f025ca27c0 https://git.kernel.org/stable/c/59ba025948be2a92e8bc9ae1cbdaf197660bd508