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 398F426A0E5 for ; Fri, 18 Apr 2025 07:03:10 +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=1744959790; cv=none; b=MBpcjPcHJqFXj6U5bzXGXYmhrKR4DulSLr7ku3nqPPiuF+q2YHqcBn3zmO2EzORZ6UTuHR5sUIDW1pALHteZo+UE1w7CjHIg+b95TLMS9GuzXhAFcLexK1EIzrD6UqdSMeFb2TQ3G5Urt+aPzR6ylkGEBxM55j00jW5oFopVCPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744959790; c=relaxed/simple; bh=d88fiZF80FtQKYQ2SnrCfXTy2KkVC2lWhvRAvvWAqPI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b+08A+UIlxQdSptYQNZF1Vvks3p4j55rvAIhRVw/0f6KR6MGe1iy/axgOST4qWuP51BUgafbQZvVQ7y49flMEQ/lRdYfFIZa1kcwB3EZv++tpBEs+S+LQbbQ4jPmn0cu+1GDOhclFa8zQPiLKuTOTUMwpPkuvijVi7fJx2uVCPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S5JITArW; 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="S5JITArW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B089AC4CEE2; Fri, 18 Apr 2025 07:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744959790; bh=d88fiZF80FtQKYQ2SnrCfXTy2KkVC2lWhvRAvvWAqPI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=S5JITArW5/rGoOGN4HXqLFsQBBQUkySAX0vmDl8WYkj7BmO3Jg2FLK3pfIigQs2zW uyfbHcYZhWJKoVWXId4JYB9G+Yc6PElCTFuLwLg6cH1JEKxjE/4mPVl5syTY8Ue2k6 iMvLh09BbdNHiA6FCP+EFuQRL6rO1JLQ4GaC1PWQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-37893: LoongArch: BPF: Fix off-by-one error in build_prologue() Date: Fri, 18 Apr 2025 09:02:16 +0200 Message-ID: <2025041816-CVE-2025-37893-57b4@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=3326; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=lovL6pVzMWI2pu9MV6jKp90+ANGFNJrB9HxkTEvSgvA=; b=owGbwMvMwCRo6H6F97bub03G02pJDBmMP35UPIm4r3ryZPn/6kavpFOWUxre/oqb6uy/+JDO0 zluL7pCO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiU+MY5lcfj//37Pbyc5Md jW5k37FxmTjfgplhnvXaLWnnIg+yPFsXv07y+cQ9DhpbPwEA 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: LoongArch: BPF: Fix off-by-one error in build_prologue() Vincent reported that running BPF progs with tailcalls on LoongArch causes kernel hard lockup. Debugging the issues shows that the JITed image missing a jirl instruction at the end of the epilogue. There are two passes in JIT compiling, the first pass set the flags and the second pass generates JIT code based on those flags. With BPF progs mixing bpf2bpf and tailcalls, build_prologue() generates N insns in the first pass and then generates N+1 insns in the second pass. This makes epilogue_offset off by one and we will jump to some unexpected insn and cause lockup. Fix this by inserting a nop insn. The Linux kernel CVE team has assigned CVE-2025-37893 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.1.134 with commit e9ccb262b39ab01a5ac2e485b7996b8498e7b373 Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.6.87 with commit b3ffad2f02db4aace6799fe0049508b8925eae45 Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.12.23 with commit 205a2182c51ffebaef54d643e3745e720cded08b Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.13.11 with commit c74d95a5679741ef428974ab788f5b0758dc78ae Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.14.2 with commit 48b904de2408af5f936f0e03f48dfcddeab58aa0 Issue introduced in 6.1 with commit 5dc615520c4dfb358245680f1904bad61116648e and fixed in 6.15-rc1 with commit 7e2586991e36663c9bc48c828b83eab180ad30a9 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-37893 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 arch/loongarch/net/bpf_jit.h 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/e9ccb262b39ab01a5ac2e485b7996b8498e7b373 https://git.kernel.org/stable/c/b3ffad2f02db4aace6799fe0049508b8925eae45 https://git.kernel.org/stable/c/205a2182c51ffebaef54d643e3745e720cded08b https://git.kernel.org/stable/c/c74d95a5679741ef428974ab788f5b0758dc78ae https://git.kernel.org/stable/c/48b904de2408af5f936f0e03f48dfcddeab58aa0 https://git.kernel.org/stable/c/7e2586991e36663c9bc48c828b83eab180ad30a9