From nobody Sun Feb 8 11:43:30 2026 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.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 9CA3B381718 for ; Fri, 23 Jan 2026 03:27:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769138828; cv=none; b=V0q2gD2H/6L8rL9iY5ibESJ4lbxqXJM6+sal0ndJIzbiN5pjo7/K0b2em5VYvUv6BUb4jGkinoCIq2RuswM8zNc4GSkHpuQxh66m0ayyIRwzGw3/ooMDjYI+smdryyTuNH2l/WtAgPA2FgkcF6LTJiQJy8pHEVWKv6v+QhDmO6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769138828; c=relaxed/simple; bh=y1kKlElWA1x/XM6Wz5R/d/glsIS6y2hLv2QEDt32Fc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fghGjGI3jYJ0ZKL/0ju3ihdCrp7x0uljbKOOQnDhxOX+la4qksTO2NuVxe2RW3f0BjP/2+klKvbwzqCra6IA2gpe3oV/SinuOJvxlXRpoACp+7jNm7uZk5X/X5asCCnzkMEe5CCkftpx4ZIpes7dL4qJDn8Fi8h8BlDtAcDNhf4= 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=owjQ6Zry; arc=none smtp.client-ip=95.215.58.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="owjQ6Zry" 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=1769138818; 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=lUdsbdc1S8X/9qw1zh3i4z0z65VGYSHUbuVLsq9rNHU=; b=owjQ6Zrywu1+UzaCdloCz6uSqOV57ZHTYsNFI8iqdNGRP0NSFrmyRjmDb7cdOmE6fBzrd4 xQM7J3rSeTs09UDnRnwsdFiOyS1Fn3DPTkVIdlY4GrTW7HUGTP0ksgMsFiv4iIOJkXuWz6 sWbOn6Z/s4NNvsoYj9g0vfz5fdogG7o= 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 v7 6/9] bpf: Add syscall common attributes support for btf_load Date: Fri, 23 Jan 2026 11:24:42 +0800 Message-ID: <20260123032445.125259-7-leon.hwang@linux.dev> In-Reply-To: <20260123032445.125259-1-leon.hwang@linux.dev> References: <20260123032445.125259-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 28e22a03ac84..732bc4baee1c 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 f1ed24157d71..3cccb0c5e482 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 6241ef35c164..d17cb243c5b3 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 *attrs_common) { 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, attrs_common); 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(&attrs_common, &attr_common, uattr_common, size_common); + err =3D bpf_btf_load(&attr, uattr, size, &attrs_common); break; case BPF_BTF_GET_FD_BY_ID: err =3D bpf_btf_get_fd_by_id(&attr); --=20 2.52.0