Article View: linux.kernel.netdev
Article #4375[PATCH bpf-next v2 28/43] bpf: Don't take an extension for a writable raw tracepoint program
From: Alexei Starovoitov
Date: Sat, 17 Oct 2026 16:37
Date: Sat, 17 Oct 2026 16:37
43 lines
9785 bytes
9785 bytes
From: Alexei Starovoitov <ast@kernel.org>
bpf_probe_register() compares max_tp_access of the program that is
attached with the size of the buffer that the tracepoint lets programs
write to. An extension of that program, or of one of its global
functions, gets the same context and the same pointer to the buffer. What
it accesses is noted in its own max_tp_access, which nobody looks at. So
it reads and writes behind the buffer, of a tracepoint that may have none:
BUG: KASAN: stack-out-of-bounds in bpf_prog_5843f2b820eb4929_tr26_ext_far+0xf4/0x10c
Write of size 4 at addr ffffc90000d8f894 by task wext/103
Refuse such extensions.
Fixes: be8704ff07d2 ("bpf: Introduce dynamic program extensions")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
kernel/bpf/verifier.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 81660ffce99a..0d1b729989d6 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -22232,6 +22232,15 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
"Extension programs should be JITed\n");
return -EINVAL;
}
+ /*
+ * How much of the buffer of the tracepoint is used
+ * is checked for the program that is attached to it.
+ */
+ if (tgt_prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE) {
+ bpf_log(log,
+ "Cannot extend a writable raw tracepoint program\n");
+ return -EINVAL;
+ }
tgt_changes_pkt_data = aux->func
? aux->func[subprog]->aux->changes_pkt_data
: aux->changes_pkt_data;
--
2.55.0
Technical Details
Message-ID:
<20261017163745.3341787-29-alexei.starovoitov@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347803-linux-kernel-netdev=dewy.ruReferences:
<20261017163745.3341787-1-alexei.starovoitov@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347803-linux-kernel-netdev=dewy.ru
From: alexei.starovoitov@gmail.com (Alexei Starovoitov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH bpf-next v2 28/43] bpf: Don't take an extension for a writable raw tracepoint program
Date: Sat, 17 Oct 2026 16:37:30 +0000
Organization: Usenet Network
Message-ID: <20261017163745.3341787-29-alexei.starovoitov@gmail.com>
References: <20261017163745.3341787-1-alexei.starovoitov@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3088224"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uBfyjoLpPbmZeyTluMWroWKxWUs= sha256:J0HUQZ1tVnJojS+vhgNkAnRj+upAbmzjOq4SQ9TGmGc=
sha1:X58C9309F6loAmFtgfmbMNdRz4E= sha256:E31kqCnXPh5If9lzBDjrPbjjWlSDfQ8mg/N+WZTRsrY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 26D8A110728; Sat, 17 Oct 2026 19:54:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id TL8DUSXvZPOO;
Sat, 17 Oct 2026 19:54:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-347803-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 3DF661106E4; Sat, 17 Oct 2026 19:53:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sin.lore.kernel.org (Postfix) with ESMTP id 9BC512644B; Sat, 17 Oct 2026 16:41:10 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CEE5C3AA9CA;
Sat, 17 Oct 2026 16:40:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QQSgQkPH"
X-Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC4C92D73A6
for <netdev@vger.kernel.org>; Sat, 17 Oct 2026 16:40:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792255239; cv=none; b=Mryg240Rfc12j/gFbpOUVFJb8jKPwBhHGGgGCGDBFNOXJglDLNOr01DC3AV6Qphooka40+uncsHQDyk6BYqk0EfLmbCaSSI24VjFZrqwlX2iu7nk+Up/gRDXkkARqTSJxowQoloonOw1fF6Vqsj1VG0sodWW1tVyG3d8uBYADXI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792255239; c=relaxed/simple;
bh=LInPVHvbYU0TGNIozpTFRcFgntOfFRp+YJGP5QIZIwE=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=KqwtAYClocwHNKsfG71fTBA6utLIzxPy8TsSFiiZsJk+yC3IKJsKcp5A2TkWBNFlxYW8TjAEs98WsksMAFV+lYXPgyvW9vhCBxPiyKaEJHbHHMU10OlvMXze6I0Tgyc9RHQwgX51kKWcaqWc0a4hSaWsJzi2u8EH8s7YY9TKuds=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QQSgQkPH; arc=none smtp.client-ip=209.85.214.179
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2e831e86ebfso3578295ad.1
for <netdev@vger.kernel.org>; Sat, 17 Oct 2026 09:40:38 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792255238; x=1792860038; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=ycFcAXAF2bqJk9ipDiEaIXiHZnKOU+kSnggBV2CR5LE=;
b=QQSgQkPHy0cm9fqE3+bJrU2wI53iQWZdFkzgGvF9cvblk9A1NV6OK+aJYrJitioyrW
NqwKGFY5OOgQjpcrZQwICp6M94CXa8IHzZzw4YbKVbCh5FGYpR8a5Qh+a23IlMCAZHWI
7Bl0EGOSxG617kmtV/vxxp2+N3lgVk1ZGp8HXe5Ypeqtt563b4YArSzXkEkFpRMYcu5y
mdUy4Ch7Cx0tkdCmbRHnmSPZweYQ4X8DJ177bd9wUpQMB5zRzxyh5Bx+98JQfZwGrWU5
9/dzkMsP0tji+QW8+9tGqB2HrKzDBD8RBFz9mJbk43hU6ti30tdA4E1uoblKHjANM9el
DRsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792255238; x=1792860038;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=ycFcAXAF2bqJk9ipDiEaIXiHZnKOU+kSnggBV2CR5LE=;
b=a9g+mtJOhwCTE9Pckt8WECQs5fvd31an+7UdmStPvWkotcsmrfpqY1B3daeuoX/P/0
yzQsleVanH1/jji/ClP9YYfnhIj1EwsefwLROsuy95f1Y8olU3aSIHmBwdrMSDW+hBVj
rdqhWpUzEt5ZzuySWLP7UxzQ3Kn/vgqGkSBiVhYJ9LBB9CCJ99bTz21tH86FXSiMNVZD
vP0CRB6ASbNEvcqnZ3FssyID5JlDYoT630uNiUJiXslbqDs7ULmvy19Zhp0XIaCzPT4t
OA3KJ0LTiGCg+PGXs2mjzvdM7XLaoWccSwen1/vcrAXPPJ5Sk60e+CvF3CDWgqKRjPDL
hGuw==
X-Forwarded-Encrypted: i=1; AKwUvBwqSN/OMv54YHTBXFuxnVHENgLqa8TSLMZbbtggCNtzpxYLwYm9YKQq+aUjp2mvX7rfM1tsZm8=@vger.kernel.org
X-Gm-Message-State: AFq9FYLziKE55SkzfWqYzscgpkVf0t/hFFO6rYH5XgnoNAYyJFqpWItl
KYWfKOnaf/5tZ2PVWELZSB0mRvhS1KRVAnRpYEHqSahJmNi0Uux+K1X3
X-Gm-Gg: AYBFou15a3Sqt24eseado6no2KCtiVKHu/1IHG9t71GAJsw/mVe/+tbGyCiCOLbZ7US
SlPBidaTL3firJonS805UTlBwIT8WjoMpm3kyKWVHZv+gxsLGYYhJ29Utr6GX0TJam40bT6OP6L
lPkqOpoJqphL4wKidDAmFfavAUEHg1aOR8iVa89yvMhi6BKw3Vp8ZPGq5eH12lieopv3nKAVWfw
Ulpju6KvlPnRHBSd70SDWKFzOgC5CRxInuU3c5QDJAkgPzR4ZJlP0jipYPMkr1gJA1HX3a8Gj3E
aw3GtEDdZnkIjUSkvhHty59G0IWGOSj6eGEY2fUvf8qc1cClOmVHVf9XDJR2R6PEENETXcjSZ8M
gRi6hincaXSeGu5HYhIVorI8uA4NK6qc/xqwh7dHr6jJmsT/ckHKtvaFqYw//B26lZ49citPvZo
j1ef/ZFjfDmLwIlZd/9GGdcw9/8rBa8rLOkxga8oVVAd04FLj+UJFUs/OQny7F2N3I/LusLUDSo
JtseFOAwKVSaZX99YmnRWyJy+fRHDmQX/BEAIlNJreA+ry57ckGUZx07HNgYpuGVRv1PZZQBbCT
+06JOw1k8aYXAUGw/llHgehNxClacA7mstZDp1ucfhY=
X-Received: by 2002:a17:903:19ef:b0:2e2:bfe8:aa7e with SMTP id d9443c01a7336-2e9a68347e4mr29692205ad.7.1792255237949;
Sat, 17 Oct 2026 09:40:37 -0700 (PDT)
X-Received: from coder-ast-ast-dev-ml-0.tail2dda0.ts.net ([153.61.198.246])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2e97e804becsm22336215ad.21.2026.10.17.09.40.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 17 Oct 2026 09:40:37 -0700 (PDT)
X-Cc: daniel@iogearbox.net,
andrii@kernel.org,
eddyz87@gmail.com,
memxor@gmail.com,
netdev@vger.kernel.org,
josef@toxicpanda.com,
mason@kernel.org
X-Mailer: git-send-email 2.55.0
X-In-Reply-To: <20261017163745.3341787-1-alexei.starovoitov@gmail.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>