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 4C28D1CD1F for ; Mon, 5 May 2025 14:53:57 +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=1746456838; cv=none; b=c+jc0ktp9BuR8eq6RHI8VXrUmVqSTC/+gbMw+oFfIvJiKqM8oYe94v1r5aWtnO1ie1a+XWdjV9i3x79gidCittZLuztwsj+CbKDJBba0azb1P2Dzo0XjdAEZFSHSNWMFHp/qlSVArJXtB3tXH1szPVB0mcUcGKPVEFOpm6qCf2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746456838; c=relaxed/simple; bh=aXbhw8XcRVwthvDG0iuUicLhIh772oTSeYP9YBbyEto=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ie6Xr9OzwE/6Q+zBxqknPSp3GsLpGrJuEW2LEgPJqRmuE2qAVQIJxTyWiwY8QGBw8+JOrHLohRSCoZ/uMPGnXyYxjuzggiDp0zYwkFoD2JSeuGHONN/eTPvabFLA6/+RA39ZxR2oC7XtLeK4KdfsdIqz3K0+HtTzTf9FOjuOKRU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I88+yxVP; 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="I88+yxVP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4654CC4CEE4; Mon, 5 May 2025 14:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746456837; bh=aXbhw8XcRVwthvDG0iuUicLhIh772oTSeYP9YBbyEto=; h=From:To:Cc:Subject:Date:Reply-to:From; b=I88+yxVPqK6hg4n7hMeGKkt8fAZTqmryfWcFCp6SPg3ud4HJD7rLJ+vHNvDdFZezl 51bFxNMdRIAGkHlrpVtA2zQqRWFw++SOndPfG26+KYJ9HQrPfc72AfJj6/h+ePY3lX JCXuuhr4gBNtnweulftjwEWO1gIiYoOkin9e02nM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-58237: bpf: consider that tail calls invalidate packet pointers Date: Mon, 5 May 2025 16:53:42 +0200 Message-ID: <2025050540-CVE-2024-58237-e263@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=2718; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Hw5ifhDvZP5TQMI1uH7Z/0aKcax4f7Xo5UWHgczN85w=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkSF774aHJsF1W3T36348KOVUktDCUmetKKzlcE7zZNu bSE88W6jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIqy/DfBedQ++2G8+PWCpa HqJwWbbtppjzX4b5nivd571q2CN0cpeq17ebTeF98X9nAwA= 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: consider that tail calls invalidate packet pointers Tail-called programs could execute any of the helpers that invalidate packet pointers. Hence, conservatively assume that each tail call invalidates packet pointers. Making the change in bpf_helper_changes_pkt_data() automatically makes use of check_cfg() logic that computes 'changes_pkt_data' effect for global sub-programs, such that the following program could be rejected: int tail_call(struct __sk_buff *sk) { bpf_tail_call_static(sk, &jmp_table, 0); return 0; } SEC("tc") int not_safe(struct __sk_buff *sk) { int *p = (void *)(long)sk->data; ... make p valid ... tail_call(sk); *p = 42; /* this is unsafe */ ... } The tc_bpf2bpf.c:subprog_tc() needs change: mark it as a function that can invalidate packet pointers. Otherwise, it can't be freplaced with tailcall_freplace.c:entry_freplace() that does a tail call. The Linux kernel CVE team has assigned CVE-2024-58237 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 51c39bb1d5d105a02e29aa7960f0a395086e6342 and fixed in 6.12.9 with commit 1c2244437f9ad3dd91215f920401a14f2542dbfc Issue introduced in 5.6 with commit 51c39bb1d5d105a02e29aa7960f0a395086e6342 and fixed in 6.13 with commit 1a4607ffba35bf2a630aab299e34dd3f6e658d70 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-2024-58237 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: net/core/filter.c tools/testing/selftests/bpf/progs/tc_bpf2bpf.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/1c2244437f9ad3dd91215f920401a14f2542dbfc https://git.kernel.org/stable/c/1a4607ffba35bf2a630aab299e34dd3f6e658d70