From nobody Sun Feb 8 13:08:58 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 884D02DB797 for ; Mon, 12 Jan 2026 14:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768229963; cv=none; b=H6eb2URaHFgjJ2hntlTNxVIwcpXSbAj+9hYMxjJBvHyX3fzcJ1EBpcM0zdt/fquPsPwuc4knYSdiFOdXPQ8QLVVne/7FIhVxv2lwLVcQhfNo2r/IDUXJp0M61+IvHcNkh0cTASs0grkMGZNVYDkAuSdog6FR3i3kxtjhoJkObko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768229963; c=relaxed/simple; bh=RJ69CubqkwnPTdvwSZSH7PUSpEI4aL47uicaffDDgFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kJhAufmI9BOwIn7hDL12ORZLLWciCTEkOmWa17IyydnjyALcv2SSGNbjLolJCvNhUAtMbQdZ++CAlwFTl1///LGxbaxIY2xEpHSvNctXi2ifeA7ZZ/ZNhhUJ3pZtyU0x49FsX9Mz9krJk9p7GR8/5W7lyWdP13oiZEIknIjDH/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=fJCR4OAN; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fJCR4OAN" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768229959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iR0SDBhL9jfzL+OidPPa2eVFyYTGzNy0iLhy6VQkwpw=; b=fJCR4OANpTBHpZV1r34K+34wgVjHVQ1jYXdt6X76Y+l7h6cn0/HonZKbZkBGXQKcpq2H63 FeaWmCL5uYq5lJrStPa9Zjl/i05REi2Ocsqc1vvdNWaHX34Lfq3f2B/TLdhSHofjWsrkgB mxZrZ4CwR8rsvr0J4fGzBsKtcbB45Wg= From: Leon Hwang To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Christian Brauner , Seth Forshee , Yuichiro Tsuji , Andrey Albershteyn , Leon Hwang , Willem de Bruijn , Jason Xing , Tao Chen , Mykyta Yatsenko , Kumar Kartikeya Dwivedi , Anton Protopopov , Amery Hung , Rong Tao , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-patches-bot@fb.com Subject: [PATCH bpf-next v5 6/9] bpf: Add syscall common attributes support for btf_load Date: Mon, 12 Jan 2026 22:56:13 +0800 Message-ID: <20260112145616.44195-7-leon.hwang@linux.dev> In-Reply-To: <20260112145616.44195-1-leon.hwang@linux.dev> References: <20260112145616.44195-1-leon.hwang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Since bpf_log_attr_init() now supports struct bpf_common_attr, pass the common attributes to it to enable syscall common attributes support for BPF_BTF_LOAD. Signed-off-by: Leon Hwang --- include/linux/bpf_verifier.h | 3 ++- kernel/bpf/log.c | 5 +++-- kernel/bpf/syscall.c | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 44dd60de1966..9022e4f515f9 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -642,7 +642,8 @@ struct bpf_log_attr { =20 int bpf_prog_load_log_attr_init(struct bpf_log_attr *log_attr, struct bpf_= attrs *attrs, struct bpf_attrs *attrs_common); -int bpf_btf_load_log_attr_init(struct bpf_log_attr *log_attr, struct bpf_a= ttrs *attrs); +int bpf_btf_load_log_attr_init(struct bpf_log_attr *log_attr, struct bpf_a= ttrs *attrs, + struct bpf_attrs *attrs_common); int bpf_log_attr_finalize(struct bpf_log_attr *log_attr, struct bpf_verifi= er_log *log); =20 #define BPF_MAX_SUBPROGS 256 diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c index 96df089a2c89..0dba014ca055 100644 --- a/kernel/bpf/log.c +++ b/kernel/bpf/log.c @@ -902,13 +902,14 @@ int bpf_prog_load_log_attr_init(struct bpf_log_attr *= log_attr, struct bpf_attrs offsetof(union bpf_attr, log_true_size), attrs_common); } =20 -int bpf_btf_load_log_attr_init(struct bpf_log_attr *log_attr, struct bpf_a= ttrs *attrs) +int bpf_btf_load_log_attr_init(struct bpf_log_attr *log_attr, struct bpf_a= ttrs *attrs, + struct bpf_attrs *attrs_common) { const union bpf_attr *attr =3D attrs->attr; =20 return bpf_log_attr_init(log_attr, attrs, attr->btf_log_buf, attr->btf_lo= g_size, attr->btf_log_level, offsetof(union bpf_attr, btf_log_true_size), - NULL); + attrs_common); } =20 int bpf_log_attr_finalize(struct bpf_log_attr *log_attr, struct bpf_verifi= er_log *log) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 8382fafc8d17..d0440e640e40 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5433,7 +5433,8 @@ static int bpf_obj_get_info_by_fd(const union bpf_att= r *attr, =20 #define BPF_BTF_LOAD_LAST_FIELD btf_token_fd =20 -static int bpf_btf_load(const union bpf_attr *attr, bpfptr_t uattr, __u32 = uattr_size) +static int bpf_btf_load(const union bpf_attr *attr, bpfptr_t uattr, __u32 = uattr_size, + struct bpf_attrs *common_attrs) { struct bpf_token *token =3D NULL; struct bpf_log_attr log_attr; @@ -5447,7 +5448,7 @@ static int bpf_btf_load(const union bpf_attr *attr, b= pfptr_t uattr, __u32 uattr_ return -EINVAL; =20 bpf_attrs_init(&attrs, attr, uattr, uattr_size); - err =3D bpf_btf_load_log_attr_init(&log_attr, &attrs); + err =3D bpf_btf_load_log_attr_init(&log_attr, &attrs, common_attrs); if (err) return err; =20 @@ -6281,7 +6282,8 @@ static int __sys_bpf(enum bpf_cmd cmd, bpfptr_t uattr= , unsigned int size, err =3D bpf_raw_tracepoint_open(&attr); break; case BPF_BTF_LOAD: - err =3D bpf_btf_load(&attr, uattr, size); + bpf_attrs_init(&common_attrs, &common_attr, uattr_common, size_common); + err =3D bpf_btf_load(&attr, uattr, size, &common_attrs); break; case BPF_BTF_GET_FD_BY_ID: err =3D bpf_btf_get_fd_by_id(&attr); --=20 2.52.0