From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796262061; b=061AaCypCI76nwc813plqMFtx4/24m4x9gCQmH9KijhjOp8se5EhiFBzf0wUc5pxhVhu u1XiYG5fRZOR/h1nBfLkcaLjiTrvpRxtzt9+mR9YCaz2k5yR9Y01P0DxfS7bHOSRdKuUy ZOsUn5vlJjGhMmfW9TaRSc7Z1CA+Evj91gfDXwTZJ9HioClqZSjs08PfCGu/OnL+v10F0 AK/H3HFOKBdao8ksA0D4TQyILYhI5A5eYxIskJ8/5pKwBG1yVJxzGJt3sOteKgpoovuf7 PnhVIbcD5otBOdQku0o5MrBzFbj5bMzWce94iub0U8wB5pXBclI/+/0IBq0ORw7JJZw== 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=mms3F7iqopwKvI31p/jweN2psBQG+Ca5T0WMtqfL4vpSKGOAmb8HYiYZ4Ih4G6NprYRC lSQ7NV1dMiZFxlYMfDHtW7MEqCOy5DGC4gTTlsr68AK/SaUd6QaBFgW/FELAhoAiCSaTS mnfZLayTtuKkH260xM7ty7fzysH9+yETK33YE+qdtVV5XQvCwOKiYlUzsXnkGLy6FJ1f0 X7tU8MU2StH3BMQ/dBrHyhVxoH14FAj06q8YPHSkDsuyOe5DA16FlAL7KKVoz6omdAT5r OvgfVdCnzAe3Dp+d6zCmVHN1o7Aewo0qQdJ0I7NsVLoj3US78/tu8Ydgr1R+/1wbQzA== 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.215.180 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 DB1C5606A330 for ; Thu, 3 Dec 2026 01:41:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DB1C5606A330 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-pg1-f180.google.com with SMTP id 41be03b00d2f7-cdb1199bfd8so6552103a12.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=0yFNIt1Btc6cA9pCvsfFYMiqvZTszRpgWs8QfIA7jce9xiuJcj+0iYFDA/XoxLZ5+y JNTn2bHoLAJPD86wDMYYA2SfmFxPYlzlBW6Hq19s4+EGvnl+7mqMk7Dz452owYxVeYxh d5UutyYoSSAnpfDubBXH0rIYphpzFV4WlEh7rwhwkP3tIXGRH6L/UV2eIFnF8T9OvmwN gmnkFn2Rvj5leYFJDgA+RkxP8tMe5g+QCcAocepkv4b2LdoDWWbuM8rmEeRn8syloaF8 5neBDnQdlgBtgEd8Iy8ezKlNDovgdrqVWXWmM4Ky6SMAg6itSUEeO1qo7pKhe7TN/13K +kTg== X-Forwarded-Encrypted: i=1; AL+hErEfDI4A0kYV9Ag+cx53y+qFqfzFptdJARLOEubvnwfLruMCMMlkqZOole+bKD8JsLKOTCRkVg5oDkRpLYNJaUKbY6Q=@vger.kernel.org X-Gm-Message-State: APuU4Z8ZVU4veaAqPloznUqyTn04+oT1WVGxHAgnvoP0xneIf9BrvYuJ kuemC6R75TBfDCzjDvVUoi6/8+0hBYc0p7gvnshoSIkJWGd9VDYJuPSO X-Gm-Gg: AZFdTZdKfONdlVdczxPTEnVxLav/LqcW/BtVcuFwZSMofJmH8sYGqnpRY0IbxwTxvvQ t6kYlhzPh/VEuU3UoaKgAuXcGGg62aVpWpxNl1CyyjIMwB1Klz/10EUnzAycY6zOSyPLKretHqg RPoPSgJcR8VPS0Px0FOrzctC5b0KNPkrY4nwFfMBf/szqQ4NddHW3qJFhNSK7UlXSKQfxafZfoz 0C3tFetV9Qh0GQ1IfY1QYccahMrLXYoiuqu+LbQoBhlSxvEC1txXnWs4ymBhJiU7s3fclMDJHAy S+HT7JJkL1/Q7kfoKYjxV9XA1FE0+VhC53pQSyU611hKeLDIz9cwYFygD1ZxiWLJvxEBmW45toN pZXAHN6IV+Y9ymcIXF5CAlNbwKB/ZrPet+hnNbfbkADrrLayxVkDENgecqB+O8U1gr51DGakktp 8rTswVQt9tKxZvkwkJbfdp9Zl4fRDBpZFdE2Vxf+2zIstwj6Nv3qfRfi78pQbVBtKwriozCTVfI 66yzZq0SxS8TTzvaYgtqia/SfkyhyI+F6uSgNO2aJzBe2t5ijMBM81nAA4sWYJQNli/nJJOL9rw FBkAadeeXVwouHM+PM+MmdlSp6iURUzf/9yp8aOk4CvV0yEhgAlCxqAqHC5U2BoFV70TJBXpLkv auhtquNQoanybOfLVnJgJS08apBG4s6WSzy6M8toSlABdpLajB/SqW9o= 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-trace-kernel@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