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=1796385849; b=3y2zaa8m6Y/4LRf1KKtpsehDMgD9d1l/FgMB7xiOR0ek6wqILbEuwHNVQtwVZ12brNNh HVuH75t/4Kh7epRZy7xf+JwFGkVNJSgPZygw05c9hSdC5/Su0W5G5RmxyUnD7MZKOM4V3 7//oCODOV3uQm5NsiU5fDWN6IT8JOMJYnePUanvnWlUFWYKfZlf7ufAwtN4WiZWEP0LkZ eLnS9FxU9Js6KSBoHxq1EOy0h9GtEYenClUxJEif1M3sMVXSW7LQeDCxJN3Wi5JLD0gCU VW3vuDkOAWZzm2+chGIHYPkAdoX0aFeaPH7BdYx7kRAeoK9AMmWXAfBNoSeCxhphViw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385849; 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=kVPX2k8P5b3arRuZVhdXkDz5lDOVut0WX70+e2xSrjk=; b=2z16XswiuIKs5ZNhuo2XHZ0iujeI+8Jy6GSNLQOztPENKsyqr3daurkfsSZAFr4rJ1yn te0cM14mQ4JXOeJERjZ6WeN2W7//sYvk0q1MUE8FpgERUPJufCan3txVAEyLIvvOal1YU JkSUNRVXDharkacZHdQ9eIAbQdNAjyZ4GE3eEWV/ggM0jHezTdbWZMSfdMJAifXq67F+D Nz8ffavuCQQI+aRiso00i77Bd/ivNaXVX3X+9TMUYmWcD1Oc09wlc12IiGe8tdfDSR//G gNeqDdBJLNNsweyXV3hb33x6lv8dlR2dHkqHRicNPqnPTcF1SC62CNFcVfMnBs8c5nA== 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=o6kr+tyi; 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 D0340606A335; Fri, 4 Dec 2026 12:04:09 +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=o6kr+tyi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 517EA1F00897; Fri, 4 Dec 2026 12:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385849; bh=kVPX2k8P5b3arRuZVhdXkDz5lDOVut0WX70+e2xSrjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o6kr+tyirgrk3sMEXpY4zIYUjg8kVSDrqGBbFKBxAYmzdCmwKp34bXu01nxpmICIX mKcDNQGIr6xvL/Wmwyj9QkyZ+xOVA9r9U/5C3ZCnV52tP2AaJdy/vcldH0QlFrmgBO eXPm2W0joQ/OL7Gvu7ZF7VLKUTLLFwGmhvm2g4X4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Huey , Andrii Nakryiko , Joe Damato , Andrii Nakryiko , Alexei Starovoitov , Luo Gengkun , Sasha Levin Subject: [PATCH 6.6 0716/1167] perf/bpf: Dont call bpf_overflow_handler() for tracing events Date: Fri, 4 Dec 2026 19:02:23 +0900 Message-ID: <20261204100720.721370864@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Huey [ Upstream commit 100bff23818eb61751ed05d64a7df36ce9728a4d ] The regressing commit is new in 6.10. It assumed that anytime event->prog is set bpf_overflow_handler() should be invoked to execute the attached bpf program. This assumption is false for tracing events, and as a result the regressing commit broke bpftrace by invoking the bpf handler with garbage inputs on overflow. Prior to the regression the overflow handlers formed a chain (of length 0, 1, or 2) and perf_event_set_bpf_handler() (the !tracing case) added bpf_overflow_handler() to that chain, while perf_event_attach_bpf_prog() (the tracing case) did not. Both set event->prog. The chain of overflow handlers was replaced by a single overflow handler slot and a fixed call to bpf_overflow_handler() when appropriate. This modifies the condition there to check event->prog->type == BPF_PROG_TYPE_PERF_EVENT, restoring the previous behavior and fixing bpftrace. Signed-off-by: Kyle Huey Suggested-by: Andrii Nakryiko Reported-by: Joe Damato Closes: https://lore.kernel.org/lkml/ZpFfocvyF3KHaSzF@LQ3V64L9R2/ Fixes: f11f10bfa1ca ("perf/bpf: Call BPF handler directly, not through overflow machinery") Cc: stable@vger.kernel.org Tested-by: Joe Damato # bpftrace Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20240813151727.28797-1-jdamato@fastly.com Signed-off-by: Alexei Starovoitov Signed-off-by: Luo Gengkun Signed-off-by: Sasha Levin --- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index fd71555ccc48b..f7eb5463f3dc9 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9718,7 +9718,8 @@ static int __perf_event_overflow(struct perf_event *event, ret = __perf_event_account_interrupt(event, throttle); - if (event->prog && !bpf_overflow_handler(event, data, regs)) + if (event->prog && event->prog->type == BPF_PROG_TYPE_PERF_EVENT && + !bpf_overflow_handler(event, data, regs)) return ret; /* -- 2.53.0