From nobody Tue Jan 27 00:09:33 2026 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 EC84133E35B for ; Mon, 26 Jan 2026 15:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769440569; cv=none; b=m5BkiUxJu/B1jc14L2f18lCJVPQeOavAgdMF8wSMhRKppjy3hzgViQYzU80rnxNxGmfh3hSQWaEIukY2Gv2ynx4Jo8x2YxJrOo1PcC+bRtIsXSvv6EYh4QYd4x1+/aH1TFgrPr45mHiC3Hzbfd5nexPJjJZ3RZFwMK7cW3qTcK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769440569; c=relaxed/simple; bh=j7dw6UF6ug58KgBwYKbX0sX0RWaqzYAcnVLqOfVXLSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YX7CYfkkAty0i/VJkVCB+whx8sWx5N1/8UC/dSez4u8xQX0Npz6x2tB8DcLJcBJE4oHnP9P3cWJ+2MZVM2aXYOgS9TTjasLQFinAHHFMpDu4J+27uB/f/RjWVa1zuPn4z0OFctuQPKejEQEnaswHBaLm/TQAHw+V/YwcyGSVEX4= 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=cY8aGCwK; arc=none smtp.client-ip=95.215.58.173 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="cY8aGCwK" 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=1769440563; 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=mHNwhGZ/a7bs2rBmc5MNX1NQzbdUO+5ibn0YYAlaad0=; b=cY8aGCwK2DtIqjbBpveG/aklLDp0XdpvQQKJGaQrXJG4vgRVWD3L4lm3RujVtL2e6ZP3QS x4kc5GzLpWnbgoij//0NJNSqzfEbbo4iLaj+db13Yojghw4UxFOMOVgI8j3sx5BjVWWfHb cWaPNOYJfc/qwAGrHkM89/4BdAy4xlY= 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 v8 6/9] bpf: Add syscall common attributes support for btf_load Date: Mon, 26 Jan 2026 23:14:06 +0800 Message-ID: <20260126151409.52072-7-leon.hwang@linux.dev> In-Reply-To: <20260126151409.52072-1-leon.hwang@linux.dev> References: <20260126151409.52072-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 1ed007511776..040b105ab676 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5449,7 +5449,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; @@ -5463,7 +5464,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 @@ -6297,7 +6298,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