From mboxrd@z Thu Jan 1 00:00:00 1970 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 8B5EB1FF1D1 for ; Wed, 16 Apr 2025 14:14:42 +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=1744812882; cv=none; b=OqCV0ojVMPTdWQMdrZ0AGsGyuDcMpMlzzLgp1NV77aUtmmBeu1CTfzYRNErc6S3+Z+58ZQz0fTUEe+cdFto6kVVxJPER6P1eb6ApeoS1f115gNq5utQOov1CRxjpG8F/OcngaQxE4qfCb3cX4f9uobrKa2tYZpCmOhBO6+mV0/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744812882; c=relaxed/simple; bh=gLvCtNiZP94E3JlfNW8UFkxkOueAaony/QYwpcSa01w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rEl2h6/GfBNr0swn7/QKpknoLCUhfxOU9JlJ/9MKD7EzHSTSAHIM6z5alNQDKTKXsK/Z35N/bOMT2AiP50MMaHDFQAbW6dzrKnYY8PDI/a1/H/k9BGjOOgcckIlkq0mRFc/XtM93R0raguxf5SwvchXIMjcnFNgUGscCnpx/T6I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V1Po8MQf; 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="V1Po8MQf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F01BC4CEE2; Wed, 16 Apr 2025 14:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744812882; bh=gLvCtNiZP94E3JlfNW8UFkxkOueAaony/QYwpcSa01w=; h=From:To:Cc:Subject:Date:Reply-to:From; b=V1Po8MQfxgZ0Ly1bho/1bO5q7JDImgbTuO3sx8ahbheS5NW+iHFVNkPDNXOjAIbnn bP8Oij+eCU76kli+0co4vKHaIo/T7NufVu1HwX/a9cXmFLhKVuc/imYZ1PxTjyw6EA V48zJjYCbmxPaC5NY9546iv7cZXQfBLyi9Bxa/mI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-22048: LoongArch: BPF: Don't override subprog's return value Date: Wed, 16 Apr 2025 16:12:19 +0200 Message-ID: <2025041602-CVE-2025-22048-4738@gregkh> X-Mailer: git-send-email 2.49.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=3322; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=gLvCtNiZP94E3JlfNW8UFkxkOueAaony/QYwpcSa01w=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn/d23aN3Ne+skPXYvE32d98N66IVzncoTtyqN+J1qk1 oq7MvIndcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEJEQY5orxb7Y9/jJwxw5z 8xuVSryRSx0u/GSYKzx39aXboRuedrFUfNplwDn77ZKaGQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: LoongArch: BPF: Don't override subprog's return value The verifier test `calls: div by 0 in subprog` triggers a panic at the ld.bu instruction. The ld.bu insn is trying to load byte from memory address returned by the subprog. The subprog actually set the correct address at the a5 register (dedicated register for BPF return values). But at commit 73c359d1d356 ("LoongArch: BPF: Sign-extend return values") we also sign extended a5 to the a0 register (return value in LoongArch). For function call insn, we later propagate the a0 register back to a5 register. This is right for native calls but wrong for bpf2bpf calls which expect zero-extended return value in a5 register. So only move a0 to a5 for native calls (i.e. non-BPF_PSEUDO_CALL). The Linux kernel CVE team has assigned CVE-2025-22048 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6.64 with commit 0c8d50501bc13cacecc19caaddc10db372592a39 and fixed in 6.6.87 with commit 7df2696256a034405d3c5a71b3a4c54725de4404 Issue introduced in 6.12.2 with commit d5d83242a1d778ceb6d8b07c6b491cf7483ca112 and fixed in 6.12.23 with commit 223d565d8892481684091cfbaf3466f2b0e289d3 Issue introduced in 6.13 with commit 73c359d1d356cf10236ccd358bd55edab33e9424 and fixed in 6.13.11 with commit 780628a780b622759d9e5adc76d15432144da1a3 Issue introduced in 6.13 with commit 73c359d1d356cf10236ccd358bd55edab33e9424 and fixed in 6.14.2 with commit 996e90ab446641553e8e21707b38b9709605e0e0 Issue introduced in 6.13 with commit 73c359d1d356cf10236ccd358bd55edab33e9424 and fixed in 6.15-rc1 with commit 60f3caff1492e5b8616b9578c4bedb5c0a88ed14 Issue introduced in 6.1.120 with commit 8382e92f90b601acf6d426121e6f4991502e767d Issue introduced in 6.11.11 with commit 3b75f627b73d96787a493e2f1187543ba9c056a4 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-22048 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/loongarch/net/bpf_jit.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/7df2696256a034405d3c5a71b3a4c54725de4404 https://git.kernel.org/stable/c/223d565d8892481684091cfbaf3466f2b0e289d3 https://git.kernel.org/stable/c/780628a780b622759d9e5adc76d15432144da1a3 https://git.kernel.org/stable/c/996e90ab446641553e8e21707b38b9709605e0e0 https://git.kernel.org/stable/c/60f3caff1492e5b8616b9578c4bedb5c0a88ed14