From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796262061; b=EZ3JDWYJiVintlPwskG4tky60lpKe9hEBocs0fIUaQ+M1LXz4oBA/Yxnt7KleZeL5fNX kjW33oKyegpwedONoFwxMt2elwSueqQUmNs3ktUot/OC1xbRzVmAvBV5kz4R7erpXRXUf Sm9w8P8AmSMQvl64V9pguzXddEK0ba4VHgB2qunkuRQeRK4DLgLGc7Wpg/OXKez961mm6 PZhWQG3NHeIEMQHffg8B06DCmRI/dpY1r5QB+6dz7aWf/q2ou01r5CHlMvNqJpuuRskzo 3YAe85X0mW8N19Tb2DCxQ5ifN/aPSzTNie7KRDWOUSsHyC3HL+Z1/f7yWJhto68pRXQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796262061; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id: Cc:Subject:From:To:X-Mailer:References:In-Reply-To; bh=m8s+zto1FDw+JsETmFdAQeaB1KR87QNNtuRLNurlD+w=; b=FB6dVsT47K22ORUGNI3KmggoD4xG4ngXa6iKurLhfB7Vd+375ih2imqWBqI/svwGLnBq rhmJXS93IOSDUo7BallU4J6g4VBbBFmAeRVjx5KWaUR/QdMI3YSTRxkH9XrTmYe5NDCe9 JS2ebDEfAnV3LjnyU2oDgqzCSGbsLceSV0jyOMthUQN4srGm2AkEvNQtkjt8xZwECaqCq xOJ0ICuFlX8dWU+bDdUY+uw/Eaep5UZ0PLVTlaQz7xZyKF389gbtcgYHvDgDkX8vMh6E4 YeJAQPDRLlIJuEf9d37acMnYE+dTk8PBy1N5h+lCxdFxAyLeAXqg412sUuWugs7yang== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=nifqs2QL; arc=none smtp.remote-ip=209.85.210.176 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5DFB606A322 for ; Thu, 3 Dec 2026 01:41:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D5DFB606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=nifqs2QL Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-8b6b22be970so5253685b3a.1 for ; Wed, 02 Dec 2026 17:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796262060; x=1796866860; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=m8s+zto1FDw+JsETmFdAQeaB1KR87QNNtuRLNurlD+w=; b=nifqs2QLEQ2MS6ESehbTcCpWWa3VQ2bzCQ9K+YvCvwVJWTpDAskcpJUdrCXkh1hUk8 29EHsVmYGz4fty+MJU3Ml99Kkfsl4h8Wy+C8TTRAPY1zBF9ldi/u6ZWwyD46Dj3VftGf 1PvODOzENZemsOSox61ldhKkEnv0LrJTI4LFFVo0xPPechMN2VeGIh3tLhJzrcNUsnwx uuoNhgVyq3IZp77TqTyW0zZNSdDGT+RO9wzjb0ssUO0lDLLOZ+3FUqSBh3S1+jXG+ddr gZLLsR+fV0URKxqvcuYb+DBT4tvcWMAoRNsgE56O+13S9Dgf4atC17pM6Owu5zQy+c/u EgNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796262060; x=1796866860; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=m8s+zto1FDw+JsETmFdAQeaB1KR87QNNtuRLNurlD+w=; b=LTnj+hx9YVLYV5VOU5H6U8b82t4QGhrND2O8ckWMKPcZ6vb43ZwjOxM9cHoQXoH68o IJnc1KmC4uTAAnnfwb1GYCmY5lg5ZRVumtKbYwAE9fvmkjewAIk+c8vexosdqm5hB176 z8NHilSD0GlJHDu19TjaYPnuBcj74+4OyNycJaIYliIecZeen8yaQGRx5W8fleY8OEWC ADmO7IyKZmBVaXf2I1P95DmkgaaQ5CDRVRKJsmmJyZ6VBXG2EfH5buJtGWSlYXMMy5rn KetEGQctCFkOYLogvrEsm3qTW6i4DCG7tquVk4uVPjMYwLc/H2pLRb14/OEr+qPhls0m 3srQ== X-Forwarded-Encrypted: i=1; AL+hErGHWjB6I0rUbejLHvaZJPizXtMKQ20PMzmW9yIVG73s0EFPSlnhsspvajMr/uyR5GXY4Wc=@vger.kernel.org X-Gm-Message-State: APuU4Z9ZSxDrG/DFmbansQwhogdmI+1uE8UbywK3MIfTfyxt5WMGTBRN ZcL6pRJD2fXhGKXpmVMksF8i1lqzMPQPfMaMb3SjR3DuCnAalHYE1IlD X-Gm-Gg: AZFdTZeKKoMdgPBOqu99ZjrQypR0GAS18IzQW8PlKmYqzm/tnKihungcdRi3acz1aC7 ByoXlD39QbWV85zCgXfbYha1G+rUKWh/jAocmu1SwA1GOwR5KW9J1J0jS/4uV8Eo8YeSPps15sQ p60tUJgkNiUyuuhcfGab4HFLU6qOxbsZ8gmo933e05A5jbR63Lp2YNjjrR4tadZUoF3llOhEYWI j9jpWK8tlhUHU4ZQL1EFXEiDzxtQyOP6V294SsCYnAKS08clBSvjTKlKU3Jj7dTHHFFCREX8gZW ihwGUbQ0cqgJ0n690AdiyfLKMd3VyjTgrMDUIvuqumhaYgMHwHp/cpizKQrc0mjZExZLuufcx0L cVXiywc+kjdzK3yQrEzBxSaxg5H2WjxvopiqARtNmLKrLRi/3rO0KIuQW6Kzqj0Ve4lULRhcta0 YBuuBS8DB7fSrHrIsg/SRwZgLp4rGV3BCo3pBVxc7sqhym9NhtvI9IRvgYyOMc25Qd7G/dJ4aOG AK2XxA9URBeZkAzrC+pSJvGw+mw0GN+XRMx0ocunGvmQgGS8lJ5WbbhPkoHrl7tRLV+li2ou+j4 eXfdbskgiocl0LXtgFT5ccQnGv+HH3BE6dHbZirHbRsYCLHpzLNhgnuM0Lkt+Gnsc0tSn4pegdg 4CFbHeanYb7FyzS4DSuUc/T/hGlCZr2Ji6t2aEl6JLUONiJ3cUBT4bi4= X-Received: by 2002:a17:90b:3f0e:b0:3ab:1481:69e5 with SMTP id 98e67ed59e1d1-3b41c8ffb06mr44436895a91.11.1796262059785; Wed, 02 Dec 2026 17:40:59 -0800 (PST) Received: from localhost ([153.61.198.253]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d10dadsm1613981a91.5.2026.12.02.17.40.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 17:40:59 -0800 (PST) X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 03 Dec 2026 01:40:58 +0000 Message-Id: Cc: "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Eduard Zingerman" , "Kumar Kartikeya Dwivedi" , "Martin KaFai Lau" , "Song Liu" , "Yonghong Song" , "Jiri Olsa" , "Emil Tsalapatis" , "Ihor Solodrai" , "John Fastabend" , "Steven Rostedt" , "Masami Hiramatsu" , "Mathieu Desnoyers" , "Peter Zijlstra" , "Ingo Molnar" , "Arnaldo Carvalho de Melo" , "Namhyung Kim" , "Mark Rutland" , "Alexander Shishkin" , "Ian Rogers" , "Adrian Hunter" , "James Clark" , "KP Singh" , "Matt Bobrowski" , "Shuah Khan" , , , , Subject: Re: [PATCH bpf-next 1/4] bpf: Add log support for perf link_create From: "Alexei Starovoitov" To: "Leon Hwang" , X-Mailer: aerc 0.20.1-357-ga8fcb8d99360 References: <20261202153739.57959-1-leon.hwang@linux.dev> <20261202153739.57959-2-leon.hwang@linux.dev> 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 > --- > 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_v= erifier_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, voi= d *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