From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Leon Hwang" <leon.hwang@linux.dev>, <bpf@vger.kernel.org>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"James Clark" <james.clark@linaro.org>,
"KP Singh" <kpsingh@kernel.org>,
"Matt Bobrowski" <matt@bobrowski.net>,
"Shuah Khan" <shuah@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-trace-kernel@vger.kernel.org>,
<linux-perf-users@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next 1/4] bpf: Add log support for perf link_create
Date: Thu, 03 Dec 2026 01:40:58 +0000 [thread overview]
Message-ID: <DNAPR9T09HR2.20H2H7CUY4ME0@gmail.com> (raw)
In-Reply-To: <20261202153739.57959-2-leon.hwang@linux.dev>
On Wed Dec 2, 2026 at 3:37 PM UTC, Leon Hwang wrote:
> BPF_LINK_CREATE returns -EINVAL for several perf event attach failures.
> It also returns -EEXIST when the perf event already has a program or
> when the same program is attached to the trace event through another
> perf event.
>
> Pass the link log through the perf event attach path so callers can
> tell which check failed. Keep PERF_EVENT_IOC_SET_BPF on the same path
> without a log. Provide a bpf_log() stub for builds without
> CONFIG_BPF_SYSCALL.
>
> Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
> ---
> include/linux/bpf_verifier.h | 7 ++++
> include/linux/trace_events.h | 9 ++--
> kernel/bpf/syscall.c | 20 +++++----
> kernel/events/core.c | 79 ++++++++++++++++++++++++------------
> kernel/trace/bpf_trace.c | 15 +++++--
> 5 files changed, 91 insertions(+), 39 deletions(-)
>
> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> index 50b3f8ab9720..a27f66a25618 100644
> --- a/include/linux/bpf_verifier.h
> +++ b/include/linux/bpf_verifier.h
> @@ -1607,8 +1607,15 @@ __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log,
> const char *fmt, va_list args);
> __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env,
> const char *fmt, ...);
> +#ifdef CONFIG_BPF_SYSCALL
> __printf(2, 3) void bpf_log(struct bpf_verifier_log *log,
> const char *fmt, ...);
> +#else
> +static inline __printf(2, 3) void bpf_log(struct bpf_verifier_log *log,
> + const char *fmt, ...)
> +{
> +}
> +#endif
> int bpf_vlog_init(struct bpf_verifier_log *log, u32 log_level,
> char __user *log_buf, u32 log_size);
> void bpf_vlog_reset(struct bpf_verifier_log *log, u64 new_pos);
> diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
> index dff8a209875c..0fe900813581 100644
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -781,7 +781,8 @@ trace_trigger_soft_disabled(struct trace_event_file *file)
> #ifdef CONFIG_BPF_EVENTS
> unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx);
> unsigned int trace_call_bpf_faultable(struct trace_event_call *call, void *ctx);
> -int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie);
> +int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie,
> + struct bpf_verifier_log *log);
This is not landable.
Don't you remember how netdev folks objected to such thing?
Same story here.
pw-bot: cr
next prev parent reply other threads:[~2026-12-03 1:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 15:37 [PATCH bpf-next 0/4] bpf: Add log support for perf link_create Leon Hwang
2026-12-02 15:37 ` [PATCH bpf-next 1/4] " Leon Hwang
2026-12-02 16:26 ` bot+bpf-ci
2026-12-03 1:40 ` Alexei Starovoitov [this message]
2026-12-02 15:37 ` [PATCH bpf-next 2/4] bpf: Add log support for kprobe_multi link_create Leon Hwang
2026-12-02 15:37 ` [PATCH bpf-next 3/4] bpf: Add log support for uprobe_multi link_create Leon Hwang
2026-12-02 15:37 ` [PATCH bpf-next 4/4] selftests/bpf: Test perf event and multi-probe link creation logs Leon Hwang
2026-12-02 15:48 ` [PATCH bpf-next 0/4] bpf: Add log support for perf link_create sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNAPR9T09HR2.20H2H7CUY4ME0@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=matt@bobrowski.net \
--cc=memxor@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.