From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388021; b=Zd5318G9101oWNYp61xMjDmU+jW8POHJj/DvHkBs3tR5GpxgjDCu5o+AaDoUTXp/w9QD DBzW5Ar2w4O+cNWN1OcinSCb3jkL8ZaQaKVklPqR57c552HpLsCYIRghIZlhQ6SMEg0me PJhQULQB3UGf2mbUgHN1HWPRLLnxiLry6BzfJLV0qCA0MkwOIe/iLPu92qo2SMisiORh0 cWG6r4DDJb6VMbMtAihDL0bWVxnqp0TMgFtbAC/BVuL/X5RzfJo3Ccim2eeESTjugPGsp jXv+ZD8lbDLTDUhU+sEJ26hl7D/TH1q2WyyNLLcIVzYKE6zIbn+qHKGATUSuXi+0lJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388021; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=AAPLjDibG01m4rqyT0Rgvz4mKtCR+JMYY6oj4gUvCn4=; b=wkn+pa/QpYA6oTpezi+krzeUClQxj66vaSs7HPFSFHw6l1HugLgQIa5DhtE+N+haf3i8 IyP6H9IZK+cjeHbcUaUnz24me0R6RRnClI/fEnjIUaWEn6dixhj8x3AoEfKgNXvTgiViH t0Xdqgm4iMx+FxJr0y/VTlKEY20Bp+Mo9FGWG/v6I2iE/ZOei5EdR1uDqwMoSW8cRrUSs uueOpiQbKIWg8U2iAqYf/Zgm3cXZZYjdfZ76A7RgNOjxmZFjQCKioWCRfBWaDTSsdNBgP ECt9VW7ToBYHPvULzZPyERgzLoMGOCBIZMCkpmvDHtVm/MVXybIkgj5cGhJmBlccv5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=C2ewv19w; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE94A606A322; Fri, 4 Dec 2026 12:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=C2ewv19w Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9B6B1F000C2; Fri, 4 Dec 2026 12:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388021; bh=AAPLjDibG01m4rqyT0Rgvz4mKtCR+JMYY6oj4gUvCn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C2ewv19wb3FK4v5apme9MVJnmDiHcnQ8L6l/z6HMWU2bxbnwUwUy299p+lc8jdGoI k4UGnRp8PGwtpyMaWU8T+qClSNzjQHelkA7Qyf5AeCitjuOQ3OgigSeJ6WBd5IfDbb eOnYaITkSf++lSaSAKtXSpA/RzzN2nKKE4mLRSKs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.1 0414/1059] bpf: Assume no bounds for a writable tp with tail calls Date: Fri, 4 Dec 2026 18:59:05 +0900 Message-ID: <20261204100655.063287988@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik [ Upstream commit cd0490e671d70326d70c7d36e82388939fd9b071 ] A writable raw tracepoint hands a buffer to the program. The verifier notes how far the program reaches into it, and bpf_probe_register() refuses a program that reaches further than the tracepoint allows. A program that does not touch the buffer passes, and can tail-call one of its type that reads and writes behind it. Take a BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE program with a tail call to reach as far as can be, as for the stack, the packet and the buffers of iterators. It cannot be attached any more. Plain raw tracepoint programs, for which the limit is zero, cannot get at the buffer, and a tail call stays within one type: they are left alone. Fixes: 9df1c28bb752 ("bpf: add writable context for raw tracepoints") Signed-off-by: Josef Bacik Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261017163745.3341787-28-alexei.starovoitov@gmail.com [ sashal: Changed the path from kernel/bpf/fixups.c bpf_do_misc_fixups() to do_misc_fixups() in kernel/bpf/verifier.c, since the function hasn't been split out there; the hunk is otherwise unchanged. ] Signed-off-by: Sasha Levin --- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index da7cfd5320e35..2cbf43f3149ed 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -14400,6 +14400,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env) prog->aux->max_pkt_offset = MAX_PACKET_OFF; prog->aux->max_rdonly_access = U32_MAX; prog->aux->max_rdwr_access = U32_MAX; + if (prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE) + prog->aux->max_tp_access = U32_MAX; /* mark bpf_tail_call as different opcode to avoid * conditional branch in the interpreter for every normal -- 2.53.0