From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796262061; b=mp9AhfN91xiFz2EzZrbAacKosIoyUQTpnNUiNWXlTVbai+qrhiPMxzyPGafrJBigxhS6 qPuZx7cEuSPzGU6lpkzNYaEHPNkFNYwffPahiPhHRHv2XOYVvunawUUmum8Y1iYTYhSIR yYLSoPylskSw9OpGVYgMwqkH+6EicvZeTSL7rz6Iv6PQyRyeS9qjil9WoLBjICA/PIHUg MfVvnt2xXg32VI0R0/TeMoXLqi81kZNHIGPkaEiJofU4r4LsMIVH2gYYyKmwRqnHPlgbY LZgvMI2xqdArIWZPQ2KPmzd1i2FU9emHNBPTtqXU1eBKSOzfbta19O1qOhvKEwb4a4w== 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=nBgdmRp7sk16o45BkBYJ1f38HNuw4NcaJ412y49m+J0X/ovHXyCYGiXShgtRcyYUTsrJ OimXNk0Kf7CK8X9g/jCed/0CzejFfcxhQsHPbb5OpcFpnBPfAgdJlMrDvEuuSKzmMO4rq VLNijsRnHacM4yiJoOgmyi4ACW1b0VKn0OnBvK/kwUOa8ejbrxIZbltNY+dIClGlTlf+t RptvvQbrZ3dcEQ/MLu07aV9kAMbwJ1xRh0rObNP3Vq2irPifF7oebhK/Gv5gbdjU4MGmf s9nFwwjrmafbGcgffxV2ztV3scNo7zjEIEh2Tisp4pbtZ0gKXfBwXbhLakYwaz0zpwQ== 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.177 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 D7E8E606A32F for ; Thu, 3 Dec 2026 01:41:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7E8E606A32F 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-f177.google.com with SMTP id d2e1a72fcca58-8a07078200fso7308166b3a.2 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=Rmsup5PzhzHkWnd+bnO+VU1wL8HRGK4mU70caqs4K6noBWWOQmuU51v8ojqQqrOyq6 193fhCZpXc63BmTnU4xIIc5Puvrm75RDRwb2EC7LteHv/2thikm61bR8nuWLOnA2wexk CdWxXlAARs5jxPt2KPB4r6CE2c1/0/EQV88WFDGMkT9CcSP6oDFGTU7lhGOp1+2HmfI3 mgEA/xvCyMN9vSOQKlhEeiQRpz14+F/RgRgrelXAhnAdU2FK3/MiyaoKqLeklN0AeGDf B211gxXuwaU8n1AO0uT+gi2xWutEl6r0FKJ2VcUwnTauJ1gs/w3qnPkKtyqw05+EMIEd +urg== X-Forwarded-Encrypted: i=1; AL+hErG3czZ4ksjWHQmEJAwdHitEOnZYVLAkq2zkjJmO/K2xgnrvlTMuG0rr9p51iU1gm/cQT4Lv7kp2MUsOq+wx8mo=@vger.kernel.org X-Gm-Message-State: APuU4Z+XN19PgX27AoyB+KRYLKPBtyzpNe6FJtw1oaf32MOaXyk/nEXj pgyUhpV/Cct4hTguO8xC1ZzWRtv0eW9u7epcKywhz2ZTLioCT5oq/6Ze X-Gm-Gg: AZFdTZdOKBcAPjLC71ep7tHhBxvFlyR4Au/lO5ZE6hiGBx0OJMtpib3m7189z1325gG 2OTIkpICssxWAOZTKFnia6pvClI4mJkiPU8axKufCx0UT2BS4/mD04BgQqK5HYMHdc4SWa3c+Aa x5CMPct8eNE8aru3bij8GIZUXQHNTxoWXF/+TS1rB8QxOhPLSVHjGqdmex26dEcjEBfc7CbQkQ0 3ppE2DNcfwxbMqVPjpYlBTQCwHV/5YZXw2T2lvqXjvalbSEABoqGgyWZrMaB8Kd4kiRnzZT9A87 8IJaHjbzk5Z5l/hymRZfn1JndeGJWtVN+9y+zk0lArpAuntIbuJ0Xf5AJKOsNJfS7HPwHvJJ5k1 GRLx8NaqCJvrd92HGT7fqvg5J8tR77SLBBuZ+Ta3j8I5srLX0ztGdKobq5UMnQGFLiZCnETcpdv UEwwbooWzKKDsBascH6FEMnORQph4b7m9gNJCAiD/5ij65QTX+mQ21Id9YWiTxKO3z3ydlKuKsU ZWT+qBBiIGi94YAUqI4jPeWi82dLcXRZzqnWwRiXGNKdKqAIx483cguAsfUZ/qmi6aI1aRfsCTU vK3iSQyL099fDM2kJ6p24syhiQXSdDu9wZKZ1C0Qlzv1+xvqZIbyr5q3A4GKxJgCDRZFfoqvKyb 4OaAfI135xr8SKKy6jy/G5/eI+qgYK03MkzsVCWlH6x+sbuTVR6I9jw0= 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: linux-kselftest@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